diff src/alice/datasegment/LocalDataSegmentManager.java @ 202:7f47231ef509 working

add new flip API
author sugi
date Mon, 25 Mar 2013 17:46:07 +0900
parents 15b68b65f8a4
children 28469b1671e7
line wrap: on
line diff
--- a/src/alice/datasegment/LocalDataSegmentManager.java	Sat Mar 23 17:07:59 2013 +0900
+++ b/src/alice/datasegment/LocalDataSegmentManager.java	Mon Mar 25 17:46:07 2013 +0900
@@ -62,7 +62,7 @@
 	@Override
 	public void put(String key, Value val) {
 		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
-		Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, replyQueue, null, reverseKey);
+		Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, null, null, reverseKey);
 		addCommand(dataSegmentKey, cmd);
 		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
@@ -70,7 +70,7 @@
 	
 	public void put(String key, Object obj) {
 		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
-		Command cmd = new Command(CommandType.PUT, null, key, obj, 0, 0, replyQueue, null, reverseKey);
+		Command cmd = new Command(CommandType.PUT, null, key, obj, 0, 0, null, null, reverseKey);
 		addCommand(dataSegmentKey, cmd);
 		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
@@ -82,7 +82,7 @@
 	@Override
 	public void update(String key, Value val) {
 		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
-		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, replyQueue, null, reverseKey);
+		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, reverseKey);
 		addCommand(dataSegmentKey, cmd);
 		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
@@ -90,7 +90,7 @@
 	
 	public void update(String key, Object val) {
 		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
-		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, replyQueue, null, reverseKey);
+		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, reverseKey);
 		addCommand(dataSegmentKey, cmd);
 		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
@@ -136,17 +136,11 @@
 		
 	}
 
-	public void flip(String key ,Value val, Object obj, DataSegmentValue dsv) {
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
-		int index = dataSegmentKey.getIndex();
-		dsv.setValue(index, val, obj);
-		if (dataSegmentKey.getWaitListSize()!=0){
-			Command cmd = new Command(CommandType.FLIP, 0, dsv);
-			addCommand(dataSegmentKey, cmd);
-			if (logger.isDebugEnabled())
-				logger.debug(cmd.getCommandString());
-		}
-		
+	public void flip(Command cmd){
+		DataSegmentKey dataSegmentKey = getDataSegmentKey(cmd.key);
+		addCommand(dataSegmentKey, cmd);
+		if (logger.isDebugEnabled())
+			logger.debug(cmd.getCommandString());
 	}
 	
 }