Mercurial > hg > Database > Alice
comparison src/main/java/alice/datasegment/Command.java @ 574:ea21af9a4762 dispose
delete serializeFlag, fix MessagePack pack&unpack
author | Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Dec 2015 11:49:07 +0900 |
parents | f1777341c5a2 |
children | 3284428f525e |
comparison
equal
deleted
inserted
replaced
570:b7cb1062828e | 574:ea21af9a4762 |
---|---|
78 | 78 |
79 try { | 79 try { |
80 byte[] header = null; | 80 byte[] header = null; |
81 byte[] data = null; | 81 byte[] data = null; |
82 byte[] dataSize = null; | 82 byte[] dataSize = null; |
83 boolean serialized = false; | |
84 boolean compressed = false; | |
85 switch (type) { | 83 switch (type) { |
86 /* | 84 /* |
87 * UPDATE, PUT, REPLY need send DataSegment to RemoteDataSegment | 85 * UPDATE, PUT, REPLY need send DataSegment to RemoteDataSegment |
88 * case UPDATE and PUT | 86 * case UPDATE and PUT |
89 * compress and serialize flag are selected by user, so if true, need convert. | 87 * compress and serialize flag are selected by user, so if true, need convert. |
93 */ | 91 */ |
94 case UPDATE: | 92 case UPDATE: |
95 case PUT: | 93 case PUT: |
96 case REPLY: | 94 case REPLY: |
97 if(compressFlag){ | 95 if(compressFlag){ |
98 // ToDo: Do not pack again | 96 data = rData.getZMessagePack(); |
99 data = packer.write(rData.getZMessagePack()); | |
100 compressed = true; | |
101 } else { | 97 } else { |
102 data = rData.getMessagePack(); | 98 data = rData.getMessagePack(); |
103 serialized = true; | |
104 } | 99 } |
105 | 100 |
106 CommandMessage cm = new CommandMessage(type.id, index, seq, key, false, serialized, compressed, rData.getDataSize()); | 101 CommandMessage cm = new CommandMessage(type.id, index, seq, key, false, compressFlag, rData.getDataSize()); |
107 if (rData.getSetTime()) { | 102 if (rData.getSetTime()) { |
108 cm.setTime = true; | 103 cm.setTime = true; |
109 cm.time = rData.getTime(); | 104 cm.time = rData.getTime(); |
110 cm.depth = rData.getDepth() + 1; | 105 cm.depth = rData.getDepth() + 1; |
111 } | 106 } |
121 buf.put(header); | 116 buf.put(header); |
122 buf.put(dataSize); | 117 buf.put(dataSize); |
123 buf.put(data); | 118 buf.put(data); |
124 break; | 119 break; |
125 default: | 120 default: |
126 header = packer.write(new CommandMessage(type.id, index, seq, key, quickFlag, false, compressFlag, 0)); | 121 header = packer.write(new CommandMessage(type.id, index, seq, key, quickFlag, compressFlag, 0)); |
127 buf = ByteBuffer.allocate(header.length); | 122 buf = ByteBuffer.allocate(header.length); |
128 buf.put(header); | 123 buf.put(header); |
129 break; | 124 break; |
130 } | 125 } |
131 | 126 |