From fe035230839069d3b2748af3a3b229b4a13e8465 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 11 Sep 2023 16:10:22 +0200 Subject: [PATCH] refactor: Removed unused methods --- .../inmemory/ShardedChatHomeService.java | 9 --------- .../inmemory/SimpleChatHomeService.java | 5 ----- .../implementation/kafka/ChatRoomChannel.java | 8 -------- .../kafka/KafkaChatHomeService.java | 5 ----- .../messages/EventChatMessageReceivedTo.java | 17 ----------------- 5 files changed, 44 deletions(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeService.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeService.java index 64cd7e13..06c197bf 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeService.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/ShardedChatHomeService.java @@ -90,15 +90,6 @@ public class ShardedChatHomeService implements ChatHomeService : throwable); } - public Flux getChatRoomData() - { - return Flux - .fromIterable(ownedShards) - .flatMap(shard -> chatHomes[shard].getChatRoomData()); - } - - - private int selectShard(UUID chatroomId) { return shardingStrategy.selectShard(chatroomId); diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java index 61b36ee8..da01a541 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/inmemory/SimpleChatHomeService.java @@ -114,9 +114,4 @@ public class SimpleChatHomeService implements ChatHomeService .justOrEmpty(chatRoomData.get(id)) .switchIfEmpty(Mono.error(() -> new UnknownChatroomException(id))); } - - public Flux getChatRoomData() - { - return Flux.fromIterable(chatRoomData.values()); - } } diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/ChatRoomChannel.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/ChatRoomChannel.java index 7f7d28e6..4143616d 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/ChatRoomChannel.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/ChatRoomChannel.java @@ -425,12 +425,4 @@ public class ChatRoomChannel implements Runnable, ConsumerRebalanceListener return Mono.justOrEmpty(chatRoomInfo[shard].get(id)); } - - Flux getChatRoomData() - { - return Flux - .fromStream(IntStream.range(0, numShards).mapToObj(i -> Integer.valueOf(i))) - .filter(shard -> isShardOwned[shard]) - .flatMap(shard -> Flux.fromIterable(chatRoomData[shard].values())); - } } diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeService.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeService.java index 0769caf1..5019ed20 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeService.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaChatHomeService.java @@ -59,11 +59,6 @@ public class KafkaChatHomeService implements ChatHomeService chatRoomChannel.getOwnedShards()))); } - public Flux getChatRoomData() - { - return chatRoomChannel.getChatRoomData(); - } - int selectShard(UUID chatRoomId) { byte[] serializedKey = chatRoomId.toString().getBytes(); diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/messages/EventChatMessageReceivedTo.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/messages/EventChatMessageReceivedTo.java index 70cac508..17d3a397 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/messages/EventChatMessageReceivedTo.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/messages/EventChatMessageReceivedTo.java @@ -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(); -- 2.20.1