# HG changeset patch # User e095732 # Date 1359883785 -32400 # Node ID 8d3cb7e5fa5702fee68c7dfa9dd22dbcb2b65aa7 # Parent 1b532146b355b185b61989a78879a5d4399b58e6 add TEST API flip diff -r 1b532146b355 -r 8d3cb7e5fa57 src/alice/codesegment/OutputDataSegment.java --- a/src/alice/codesegment/OutputDataSegment.java Sun Feb 03 18:20:46 2013 +0900 +++ b/src/alice/codesegment/OutputDataSegment.java Sun Feb 03 18:29:45 2013 +0900 @@ -7,9 +7,14 @@ import org.msgpack.type.ValueFactory; import alice.datasegment.DataSegment; +import alice.datasegment.Receiver; public class OutputDataSegment { + public void flip(Receiver receiver, Value val) { + DataSegment.getLocal().flip(receiver, val); + } + public void put(String managerKey, String key, Value val) { DataSegment.get(managerKey).put(key, val); } diff -r 1b532146b355 -r 8d3cb7e5fa57 src/alice/datasegment/DataSegmentKey.java --- a/src/alice/datasegment/DataSegmentKey.java Sun Feb 03 18:20:46 2013 +0900 +++ b/src/alice/datasegment/DataSegmentKey.java Sun Feb 03 18:29:45 2013 +0900 @@ -17,6 +17,10 @@ private ArrayList waitList = new ArrayList(); private AtomicInteger tailIndex = new AtomicInteger(1); + public ArrayList getDataList(){ + return dataList; + } + public void runCommand(Command cmd) { switch (cmd.type) { case UPDATE: diff -r 1b532146b355 -r 8d3cb7e5fa57 src/alice/datasegment/LocalDataSegmentManager.java --- a/src/alice/datasegment/LocalDataSegmentManager.java Sun Feb 03 18:20:46 2013 +0900 +++ b/src/alice/datasegment/LocalDataSegmentManager.java Sun Feb 03 18:29:45 2013 +0900 @@ -1,5 +1,6 @@ package alice.datasegment; +import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.LinkedBlockingQueue; @@ -120,4 +121,13 @@ } + public void flip(Receiver receiver, Value val){ + DataSegmentKey dataSegmentKey = getDataSegmentKey(receiver.key); + ArrayList dataList = dataSegmentKey.getDataList(); + DataSegmentValue dval = new DataSegmentValue(receiver.index, val, "local"); + synchronized(dataList){ + dataList.set(receiver.index, dval); + } + } + }