Skip to content

Commit

Permalink
Use key-value interface in server
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanja-m committed Nov 30, 2024
1 parent 19a5aaa commit f1d7cd3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions kiwi-server/src/main/java/kiwi/server/resp/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;
import kiwi.core.common.Bytes;
import kiwi.core.storage.KeyValueStore;
import kiwi.core.storage.bitcask.BitcaskStore;
import kiwi.server.config.Options;
import kiwi.server.resp.codec.RESPDecoder;
Expand Down Expand Up @@ -58,9 +60,9 @@ public void start() throws InterruptedException {
}

static class ServerInitializer extends ChannelInitializer<SocketChannel> {
private final BitcaskStore db;
private final KeyValueStore<Bytes, Bytes> db;

public ServerInitializer(BitcaskStore db) {
public ServerInitializer(KeyValueStore<Bytes, Bytes> db) {
this.db = db;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import kiwi.core.common.Bytes;
import kiwi.core.storage.bitcask.BitcaskStore;
import kiwi.core.storage.KeyValueStore;
import kiwi.server.resp.command.RESPCommand;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -13,9 +13,9 @@
public class RESPCommandHandler extends SimpleChannelInboundHandler<RESPCommand> {
private static final Logger logger = LoggerFactory.getLogger(RESPCommandHandler.class);

private final BitcaskStore db;
private final KeyValueStore<Bytes, Bytes> db;

public RESPCommandHandler(BitcaskStore db) {
public RESPCommandHandler(KeyValueStore<Bytes, Bytes> db) {
this.db = db;
}

Expand Down

0 comments on commit f1d7cd3

Please sign in to comment.