refactor: Removed unused methods
authorKai Moritz <kai@juplo.de>
Mon, 11 Sep 2023 14:10:22 +0000 (16:10 +0200)
committerKai Moritz <kai@juplo.de>
Tue, 20 Feb 2024 09:35:33 +0000 (10:35 +0100)
src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeService.java
src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java
src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/ChatRoomChannel.java
src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeService.java
src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/messages/EventChatMessageReceivedTo.java

index 64cd7e1..06c197b 100644 (file)
@@ -90,15 +90,6 @@ public class ShardedChatHomeService implements ChatHomeService
                 : throwable);
   }
 
-  public Flux<ChatRoomData> getChatRoomData()
-  {
-    return Flux
-        .fromIterable(ownedShards)
-        .flatMap(shard -> chatHomes[shard].getChatRoomData());
-  }
-
-
-
   private int selectShard(UUID chatroomId)
   {
     return shardingStrategy.selectShard(chatroomId);
index 61b36ee..da01a54 100644 (file)
@@ -114,9 +114,4 @@ public class SimpleChatHomeService implements ChatHomeService
         .justOrEmpty(chatRoomData.get(id))
         .switchIfEmpty(Mono.error(() -> new UnknownChatroomException(id)));
   }
-
-  public Flux<ChatRoomData> getChatRoomData()
-  {
-    return Flux.fromIterable(chatRoomData.values());
-  }
 }
index 7f7d28e..4143616 100644 (file)
@@ -425,12 +425,4 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener
 
     return Mono.justOrEmpty(chatRoomInfo[shard].get(id));
   }
-
-  Flux<ChatRoomData> getChatRoomData()
-  {
-    return Flux
-        .fromStream(IntStream.range(0, numShards).mapToObj(i -> Integer.valueOf(i)))
-        .filter(shard -> isShardOwned[shard])
-        .flatMap(shard -> Flux.fromIterable(chatRoomData[shard].values()));
-  }
 }
index 0769caf..5019ed2 100644 (file)
@@ -59,11 +59,6 @@ public class KafkaChatHomeService implements ChatHomeService
             chatRoomChannel.getOwnedShards())));
   }
 
-  public Flux<ChatRoomData> getChatRoomData()
-  {
-      return chatRoomChannel.getChatRoomData();
-  }
-
   int selectShard(UUID chatRoomId)
   {
     byte[] serializedKey = chatRoomId.toString().getBytes();
index 70cac50..17d3a39 100644 (file)
@@ -1,10 +1,7 @@
 package de.juplo.kafka.chat.backend.implementation.kafka.messages;
 
-import de.juplo.kafka.chat.backend.domain.Message;
 import lombok.*;
 
-import java.time.LocalDateTime;
-
 
 @Getter
 @Setter
@@ -23,20 +20,6 @@ public class EventChatMessageReceivedTo extends AbstractMessageTo
   }
 
 
-  public Message toMessage(long offset, LocalDateTime timestamp)
-  {
-    return new Message(Message.MessageKey.of(user, id), offset, timestamp, text);
-  }
-
-  public static EventChatMessageReceivedTo from(Message message)
-  {
-    return EventChatMessageReceivedTo.of(
-        message.getUsername(),
-        message.getId(),
-        message.getMessageText());
-  }
-
-
   public static EventChatMessageReceivedTo of(String user, Long id, String text)
   {
     EventChatMessageReceivedTo to = new EventChatMessageReceivedTo();