# HG changeset patch # User e095732 # Date 1363016959 -32400 # Node ID b4ca7f75e6b2b44249ae3ff88953d47aca956613 # Parent fc4dbf4e1978867c3b7bf8bd83cb17d2b9703d2a add put , Update API (no convert to value) diff -r fc4dbf4e1978 -r b4ca7f75e6b2 src/alice/codesegment/OutputDataSegment.java --- a/src/alice/codesegment/OutputDataSegment.java Fri Mar 08 15:56:48 2013 +0900 +++ b/src/alice/codesegment/OutputDataSegment.java Tue Mar 12 00:49:19 2013 +0900 @@ -13,6 +13,21 @@ /** * for local */ + public void put(String key, T val,Boolean flag) { + if (flag){ + put(key, val); + } else { + DataSegment.getLocal().put(key, val); + } + } + + public void update(String key, T val,Boolean flag) { + if (flag){ + update(key, val); + } else { + DataSegment.getLocal().update(key, val); + } + } public void put(String key, Value val) { DataSegment.getLocal().put(key, val); @@ -31,7 +46,11 @@ } public void put(String key, T val) { - DataSegment.getLocal().put(key, val); + try { + DataSegment.getLocal().put(key, SingletonMessage.getInstance().unconvert(val)); + } catch (IOException e) { + e.printStackTrace(); + } } public void update(String key, Value val) { @@ -51,7 +70,11 @@ } public void update(String key, T val) { - DataSegment.getLocal().update(key, val); + try { + DataSegment.getLocal().update(key, SingletonMessage.getInstance().unconvert(val)); + } catch (IOException e) { + e.printStackTrace(); + } } diff -r fc4dbf4e1978 -r b4ca7f75e6b2 src/alice/datasegment/Command.java --- a/src/alice/datasegment/Command.java Fri Mar 08 15:56:48 2013 +0900 +++ b/src/alice/datasegment/Command.java Tue Mar 12 00:49:19 2013 +0900 @@ -17,6 +17,13 @@ public CodeSegment cs; public String reverseKey; public Object obj; + public DataSegmentValue dsv; + + public Command(CommandType cmdType, int seq, DataSegmentValue dsv){ + this.type = cmdType; + this.seq = seq; + this.dsv = dsv; + } public Command(CommandType cmdType, Receiver receiver, String key, Value val, int index, int seq, BlockingQueue replyQueue, CodeSegment cs, String reverseKey) { this.type = cmdType; diff -r fc4dbf4e1978 -r b4ca7f75e6b2 src/alice/datasegment/DataSegmentKey.java --- a/src/alice/datasegment/DataSegmentKey.java Fri Mar 08 15:56:48 2013 +0900 +++ b/src/alice/datasegment/DataSegmentKey.java Tue Mar 12 00:49:19 2013 +0900 @@ -96,7 +96,7 @@ break; case FLIP: index = tailIndex.getAndIncrement(); - dataList.get(0).setDataSegmentValue(index, cmd.val, cmd.obj, cmd.reverseKey); + dataList.set(0, new DataSegmentValue(index, cmd.val, cmd.obj, cmd.reverseKey)); // need to check waitList break; case REMOVE: diff -r fc4dbf4e1978 -r b4ca7f75e6b2 src/alice/datasegment/DataSegmentValue.java --- a/src/alice/datasegment/DataSegmentValue.java Fri Mar 08 15:56:48 2013 +0900 +++ b/src/alice/datasegment/DataSegmentValue.java Tue Mar 12 00:49:19 2013 +0900 @@ -22,7 +22,7 @@ this.from = reverseKey; } - public void setDataSegmentValue(int index, Value val, Object obj,String reverseKey){ + public void setDataSegmentValue(int index, Value val, Object obj, String reverseKey){ this.index = index; this.val = val; this.obj = obj; diff -r fc4dbf4e1978 -r b4ca7f75e6b2 src/alice/datasegment/Receiver.java --- a/src/alice/datasegment/Receiver.java Fri Mar 08 15:56:48 2013 +0900 +++ b/src/alice/datasegment/Receiver.java Tue Mar 12 00:49:19 2013 +0900 @@ -51,11 +51,7 @@ } public void flip(T val) { - try { - DataSegment.getLocal().flip(this.key, SingletonMessage.getInstance().unconvert(val)); - } catch (IOException e) { - e.printStackTrace(); - } + DataSegment.getLocal().flip(key, val); } public void setKey(String managerKey, String key) {