Mercurial > hg > Database > Alice
diff src/alice/datasegment/LocalDataSegmentManager.java @ 190:a85ff8dc16c1 working
add Object data
author | one |
---|---|
date | Thu, 07 Mar 2013 21:27:00 +0900 |
parents | d2f5c885a367 |
children | f151dea22b2c |
line wrap: on
line diff
--- a/src/alice/datasegment/LocalDataSegmentManager.java Thu Mar 07 12:31:05 2013 +0900 +++ b/src/alice/datasegment/LocalDataSegmentManager.java Thu Mar 07 21:27:00 2013 +0900 @@ -68,6 +68,14 @@ logger.debug(cmd.getCommandString()); } + 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); + addCommand(dataSegmentKey, cmd); + if (logger.isDebugEnabled()) + logger.debug(cmd.getCommandString()); + } + /** * Enqueue update command to the queue of each DataSegment key */ @@ -79,6 +87,14 @@ if (logger.isDebugEnabled()) logger.debug(cmd.getCommandString()); } + + 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); + addCommand(dataSegmentKey, cmd); + if (logger.isDebugEnabled()) + logger.debug(cmd.getCommandString()); + } @Override public void take(Receiver receiver, String key, int index, CodeSegment cs) { @@ -128,4 +144,12 @@ logger.debug(cmd.getCommandString()); } + public void flip(String key, Object val) { + DataSegmentKey dataSegmentKey = getDataSegmentKey(key); + Command cmd = new Command(CommandType.FLIP, null, key, val, 0, 0, replyQueue, null, reverseKey); + addCommand(dataSegmentKey, cmd); + if (logger.isDebugEnabled()) + logger.debug(cmd.getCommandString()); + } + }