Mercurial > hg > Database > Alice
changeset 561:f1777341c5a2 dispose
add setZipped to CommandMessage&ReceiveData
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 24 Nov 2015 01:26:41 +0900 |
parents | 72ef96ba4195 |
children | 1cf2697d51a6 |
files | src/main/java/alice/daemon/CommandMessage.java src/main/java/alice/daemon/IncomingTcpConnection.java src/main/java/alice/datasegment/Command.java src/main/java/alice/datasegment/ReceiveData.java |
diffstat | 4 files changed, 17 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/daemon/CommandMessage.java Tue Nov 24 00:46:42 2015 +0900 +++ b/src/main/java/alice/daemon/CommandMessage.java Tue Nov 24 01:26:41 2015 +0900 @@ -20,7 +20,8 @@ public boolean setTime = false; public long time; public int depth; - public int zeppedDataSize = 0;//圧縮後のサイズ + public boolean setZepped = false; + public int zippedDataSize;//圧縮後のサイズ public CommandMessage() {}
--- a/src/main/java/alice/daemon/IncomingTcpConnection.java Tue Nov 24 00:46:42 2015 +0900 +++ b/src/main/java/alice/daemon/IncomingTcpConnection.java Tue Nov 24 01:26:41 2015 +0900 @@ -69,10 +69,10 @@ if (msg.setTime) { rData.setTimes(msg.time, true, msg.depth); } - if (msg.zeppedDataSize == 0){ - rData.setZippedDataSize(dataSize); + if (msg.setZepped){ + rData.setZipped(msg.zippedDataSize, true); } else { - rData.setZippedDataSize(msg.zeppedDataSize); + rData.setZipped(dataSize, true); } cmd = new Command(type, null, null, rData, 0, 0, null, null, reverseKey);
--- a/src/main/java/alice/datasegment/Command.java Tue Nov 24 00:46:42 2015 +0900 +++ b/src/main/java/alice/datasegment/Command.java Tue Nov 24 01:26:41 2015 +0900 @@ -110,6 +110,11 @@ cm.depth = rData.getDepth() + 1; } + if (rData.getSetZipped()){ + cm.setZepped = true; + cm.zippedDataSize = rData.getZippedDataSize(); + } + header = packer.write(cm); dataSize = packer.write(data.length); buf = ByteBuffer.allocate(header.length+dataSize.length+data.length);
--- a/src/main/java/alice/datasegment/ReceiveData.java Tue Nov 24 00:46:42 2015 +0900 +++ b/src/main/java/alice/datasegment/ReceiveData.java Tue Nov 24 01:26:41 2015 +0900 @@ -22,6 +22,7 @@ private long time;//測定用 private boolean setTime = false; private int depth = 1; + private boolean setZepped = false; private int zippedDataSize;//圧縮後のデータサイズ private static final MessagePack packer = new MessagePack(); @@ -263,12 +264,17 @@ return this.depth; } - public void setZippedDataSize(int zippedDataSize){ + public void setZipped(int zippedDataSize, boolean setZepped){ this.zippedDataSize = zippedDataSize; + this.setZepped = setZepped; } public int getZippedDataSize(){ return this.zippedDataSize; } + public boolean getSetZipped(){ + return this.setZepped; + } + }