Mercurial > hg > Database > Alice
diff src/main/java/alice/codesegment/OutputDataSegment.java @ 523:145c425db88d dispose
add CompressedLDSM
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 09 Apr 2015 18:36:26 +0900 |
parents | b6e663a9a372 |
children | 30a74eee59c7 |
line wrap: on
line diff
--- a/src/main/java/alice/codesegment/OutputDataSegment.java Fri Jan 23 23:53:36 2015 +0900 +++ b/src/main/java/alice/codesegment/OutputDataSegment.java Thu Apr 09 18:36:26 2015 +0900 @@ -7,23 +7,26 @@ import alice.datasegment.SendOption; public class OutputDataSegment { - private boolean compressFlag = false; + private boolean compressFlag = false;//圧縮するかどうか /** * for local */ + /** + * input→ds変更→outputのときコピーを防ぐ + */ public void flip(Receiver receiver) { - DataSegment.getLocal().put(receiver.key, receiver.getReceiveData(), null); + DataSegment.getLocal().put(receiver.key, receiver.getReceiveData(), false); } public void flip(Receiver receiver, CommandType type) { switch (type) { case PUT: - DataSegment.getLocal().put(receiver.key, receiver.getReceiveData(), null); + DataSegment.getLocal().put(receiver.key, receiver.getReceiveData(), false);//localなら全部false。 break; case UPDATE: - DataSegment.getLocal().update(receiver.key, receiver.getReceiveData(), null); + DataSegment.getLocal().update(receiver.key, receiver.getReceiveData(), false); break; default: break; @@ -31,21 +34,17 @@ } public void put(String key, ReceiveData rData) { - DataSegment.getLocal().put(key, rData, null); + DataSegment.getLocal().put(key, rData, false); } public void put(String key, Object val) { ReceiveData rData = new ReceiveData(val, false, false); - put(key, rData); - } - - public void update(String key, ReceiveData rData) { - DataSegment.getLocal().update(key, rData, null); + DataSegment.getLocal().put(key, rData, false); } public void update(String key, Object val) { ReceiveData rData = new ReceiveData(val, false, false); - update(key, rData); + DataSegment.getLocal().update(key, rData, false); } /** @@ -53,58 +52,70 @@ */ public void put(String managerKey, String key, ReceiveData rData) { if (!managerKey.equals("local") && DataSegment.contains(managerKey)){ - SendOption option = new SendOption(false, compressFlag()); - DataSegment.get(managerKey).put(key, rData, option); + DataSegment.get(managerKey).put(key, rData, false); } else { put(key, rData); } } public void put(String managerKey, String key, Object val) { - ReceiveData rData = new ReceiveData(val, false, false); - put(managerKey, key, rData); + if (!managerKey.equals("local") && DataSegment.contains(managerKey)){ + ReceiveData rData = new ReceiveData(val, true, false);///false false + DataSegment.get(managerKey).put(key, rData, false); + } else { + put(key, val); + } } public void quickPut(String managerKey, String key, ReceiveData rData) { if (!managerKey.equals("local") && DataSegment.contains(managerKey)){ - SendOption option = new SendOption(true, compressFlag()); - DataSegment.get(managerKey).put(key, rData, option); + DataSegment.get(managerKey).put(key, rData, true); } else { put(key, rData); } } public void quickPut(String managerKey, String key, Object val) { - ReceiveData rData = new ReceiveData(val, false, false); - quickPut(managerKey, key, rData); + if (!managerKey.equals("local") && DataSegment.contains(managerKey)){ + ReceiveData rData = new ReceiveData(val, false, false); + DataSegment.get(managerKey).put(key, rData, true); + } else { + put(key, val); + } } public void update(String managerKey, String key, ReceiveData rData) { if (!managerKey.equals("local") && DataSegment.contains(managerKey)){ - SendOption option = new SendOption(false, compressFlag()); - DataSegment.get(managerKey).update(key, rData, option); + DataSegment.get(managerKey).update(key, rData, false); } else { update(key, rData); } } public void update(String managerKey, String key, Object val) { - ReceiveData rData = new ReceiveData(val, false, false); - update(managerKey, key, rData); + if (!managerKey.equals("local") && DataSegment.contains(managerKey)){ + ReceiveData rData = new ReceiveData(val, true, false);///false, false + DataSegment.get(managerKey).update(key, rData, false); + } else { + update(key, val); + } } public void quickUpdate(String managerKey, String key, ReceiveData rData) { if (!managerKey.equals("local") && DataSegment.contains(managerKey)){ - SendOption option = new SendOption(true, compressFlag()); - DataSegment.get(managerKey).update(key, rData, option); + DataSegment.get(managerKey).update(key, rData, true); } else { update(key, rData); } } public void quickUpdate(String managerKey, String key, Object val) { - ReceiveData rData = new ReceiveData(val, false, false); - quickUpdate(managerKey, key, rData); + if (!managerKey.equals("local") && DataSegment.contains(managerKey)){ + ReceiveData rData = new ReceiveData(val, false, false); + DataSegment.get(managerKey).update(key, rData, true); + } else { + update(key, val); + } } /** @@ -134,7 +145,7 @@ * "Ping Response" return in this "key" * * @param managerKey - * @param key + * @param returnKey */ public void ping(String managerKey, String returnKey) { if (DataSegment.contains(managerKey))