Mercurial > hg > Database > Alice
view src/main/java/alice/codesegment/OutputDataSegment.java @ 533:b3c9554ccb1b dispose
change compressed API to set data specified DSM name
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 04 May 2015 16:02:22 +0900 |
parents | 4aeebea0c9b5 |
children | 8c17a9e66cc7 |
line wrap: on
line source
package alice.codesegment; import alice.datasegment.CommandType; import alice.datasegment.DataSegment; import alice.datasegment.ReceiveData; import alice.datasegment.Receiver; import alice.datasegment.SendOption; public class OutputDataSegment { /** * for local */ /** * input→ds変更→outputのときコピーを防ぐ */ public void flip(Receiver receiver) { if (receiver.isCompressed()){ DataSegment.getCompressedLocal().put(receiver.key, receiver.getReceiveData(), false); } else { DataSegment.getLocal().put(receiver.key, receiver.getReceiveData(), false); } } public void flip(Receiver receiver, CommandType type) {// ToDo: add remote switch (type) { case PUT: if (receiver.isCompressed()){ DataSegment.getCompressedLocal().put(receiver.key, receiver.getReceiveData(), false);//localなら全部false。 } else { DataSegment.getLocal().put(receiver.key, receiver.getReceiveData(), false); } break; case UPDATE: if (receiver.isCompressed()){ DataSegment.getCompressedLocal().update(receiver.key, receiver.getReceiveData(), false); } else { DataSegment.getLocal().update(receiver.key, receiver.getReceiveData(), false); } break; default: break; } } public void put(String key, ReceiveData rData) { DataSegment.getLocal().put(key, rData, false); } public void put(String key, Object val) { ReceiveData rData = new ReceiveData(val); DataSegment.getLocal().put(key, rData, false); } public void update(String key, Object val) { ReceiveData rData = new ReceiveData(val); DataSegment.getLocal().update(key, rData, false); } /** * for remote */ public void put(String managerKey, String key, ReceiveData rData) { DataSegment.get(managerKey).put(key, rData, false); } public void put(String managerKey, String key, Object val) {//追加 ReceiveData rData = new ReceiveData(val); DataSegment.get(managerKey).put(key, rData, false); } public void quickPut(String managerKey, String key, ReceiveData rData) { DataSegment.get(managerKey).put(key, rData, true); } public void quickPut(String managerKey, String key, Object val) { ReceiveData rData = new ReceiveData(val); DataSegment.get(managerKey).put(key, rData, true); } public void update(String managerKey, String key, ReceiveData rData) { DataSegment.get(managerKey).update(key, rData, false); } public void update(String managerKey, String key, Object val) { ReceiveData rData = new ReceiveData(val); DataSegment.get(managerKey).update(key, rData, false); } public void quickUpdate(String managerKey, String key, ReceiveData rData) { DataSegment.get(managerKey).update(key, rData, true); } public void quickUpdate(String managerKey, String key, Object val, boolean cFlag) { ReceiveData rData = new ReceiveData(val); DataSegment.get(managerKey).update(key, rData, true); } /** * kill the Alice process after send other messages. * * @param managerKey */ public void finish(String managerKey) { if (DataSegment.contains(managerKey)) DataSegment.get(managerKey).finish(); } /** * close socket for RemoteDataSegment after send other messages. * * @param managerKey */ public void close(String managerKey) { if (DataSegment.contains(managerKey)) DataSegment.get(managerKey).close(); } /** * "key" is not remote DataSegment's key. * "Ping Response" return in this "key" * * @param managerKey * @param returnKey */ public void ping(String managerKey, String returnKey) { if (DataSegment.contains(managerKey)) DataSegment.get(managerKey).ping(returnKey); } }