diff src/alice/datasegment/RemoteDataSegmentManager.java @ 264:b4690114a0cd

refactor API
author sugi
date Tue, 13 Aug 2013 06:02:55 +0900
parents 2ec10cfa8cc3
children f866178f3018
line wrap: on
line diff
--- a/src/alice/datasegment/RemoteDataSegmentManager.java	Tue Aug 06 02:14:40 2013 +0900
+++ b/src/alice/datasegment/RemoteDataSegmentManager.java	Tue Aug 13 06:02:55 2013 +0900
@@ -5,8 +5,6 @@
 import java.nio.channels.SocketChannel;
 
 import org.apache.log4j.Logger;
-import org.msgpack.type.Value;
-
 import alice.codesegment.CodeSegment;
 import alice.daemon.Connection;
 import alice.daemon.IncomingTcpConnection;
@@ -50,7 +48,15 @@
 	 * send put command to target DataSegment
 	 */
 	@Override
-	public void put(String key, Value val) {
+	public void put(String key, byte[] val) {
+		Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, null, null, null);
+		connection.sendCommand(cmd); // put command on the transmission thread
+		if (logger.isDebugEnabled())
+			logger.debug(cmd.getCommandString());
+	}
+	
+	@Override
+	public void put(String key, Object val) {
 		Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, null, null, null);
 		connection.sendCommand(cmd); // put command on the transmission thread
 		if (logger.isDebugEnabled())
@@ -58,7 +64,15 @@
 	}
 
 	@Override
-	public void quickPut(String key, Value val) {
+	public void quickPut(String key, byte[] val) {
+		Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, null, null, null);
+		connection.write(cmd); // put command is executed right now
+		if (logger.isDebugEnabled())
+			logger.debug(cmd.getCommandString());
+	}
+	
+	@Override
+	public void quickPut(String key, Object val) {
 		Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, null, null, null);
 		connection.write(cmd); // put command is executed right now
 		if (logger.isDebugEnabled())
@@ -66,7 +80,7 @@
 	}
 	
 	@Override
-	public void update(String key, Value val) {
+	public void update(String key, byte[] val) {
 		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, null);
 		connection.sendCommand(cmd);
 		if (logger.isDebugEnabled())
@@ -74,12 +88,27 @@
 	}
 	
 	@Override
-	public void quickUpdate(String key, Value val) {
+	public void update(String key, Object val) {
+		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, null);
+		connection.sendCommand(cmd);
+		if (logger.isDebugEnabled())
+			logger.debug(cmd.getCommandString());
+	}
+	
+	@Override
+	public void quickUpdate(String key, byte[] val) {
 		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, null);
 		connection.write(cmd);
 		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
-		
+	}
+	
+	@Override
+	public void quickUpdate(String key, Object val) {
+		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, null);
+		connection.write(cmd);
+		if (logger.isDebugEnabled())
+			logger.debug(cmd.getCommandString());
 	}
 
 	@Override
@@ -92,7 +121,6 @@
 			logger.debug(cmd.getCommandString());
 	}
 	
-	@Override
 	public void quickTake(Receiver receiver, CodeSegment cs) {
 		int seq = this.seq.getAndIncrement();
 		Command cmd = new Command(CommandType.TAKE, receiver, receiver.key, null, receiver.index, seq, replyQueue, cs, null, true);
@@ -112,8 +140,6 @@
 			logger.debug(cmd.getCommandString());
 	}
 	
-
-	@Override
 	public void quickPeek(Receiver receiver, CodeSegment cs) {
 		int seq = this.seq.getAndIncrement();
 		Command cmd = new Command(CommandType.PEEK, receiver, receiver.key, null, receiver.index, seq, replyQueue, cs, null, true);