Mercurial > hg > Members > nobuyasu > jungle-network
comparison src/jungle/test/bbs/NetworkJungleBulletinBoard.java @ 52:61b2de3f7730
add HashSetDataSegment and HashLogUpdateCodeSegment.
fix bugs
author | one |
---|---|
date | Sat, 13 Jul 2013 17:10:14 +0900 |
parents | 9e782b4eb06e |
children | ccfe9b5e8f11 |
comparison
equal
deleted
inserted
replaced
51:9e782b4eb06e | 52:61b2de3f7730 |
---|---|
2 | 2 |
3 import java.io.IOException; | 3 import java.io.IOException; |
4 import java.nio.ByteBuffer; | 4 import java.nio.ByteBuffer; |
5 import java.util.concurrent.atomic.AtomicInteger; | 5 import java.util.concurrent.atomic.AtomicInteger; |
6 | 6 |
7 import alice.jungle.codesegment.HashLogUpdateCodeSegment; | |
7 import alice.jungle.core.NetworkDefaultJungle; | 8 import alice.jungle.core.NetworkDefaultJungle; |
8 import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; | 9 import alice.jungle.datasegment.store.operations.DefaultTreeOperationLogContainer; |
9 import alice.jungle.transaction.NetworkDefaultJungleTreeEditor; | 10 import alice.jungle.transaction.NetworkDefaultJungleTreeEditor; |
10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.DefaultJungle; | 11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.DefaultJungle; |
11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.Jungle; | 12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.Jungle; |
214 | 215 |
215 private void putTreeOperationLog(NetworkDefaultJungleTreeEditor editor) throws IOException { | 216 private void putTreeOperationLog(NetworkDefaultJungleTreeEditor editor) throws IOException { |
216 String uuid = editor.getID(); | 217 String uuid = editor.getID(); |
217 String treeName = editor.getTreeName(); | 218 String treeName = editor.getTreeName(); |
218 String updaterName = editor.getUpdaterName(); | 219 String updaterName = editor.getUpdaterName(); |
219 long revision = Long.parseLong(editor.getRevision()); | 220 String revision = editor.getRevision(); |
220 Iterable<TreeOperation> log = editor.getTreeOperationLog(); | 221 Iterable<TreeOperation> log = editor.getTreeOperationLog(); |
221 putDataSegment(uuid, treeName, updaterName, log, revision); | 222 putDataSegment(uuid, treeName, updaterName, log, revision); |
222 } | 223 } |
223 | 224 |
224 private void putDataSegment(String _uuid, String _treeName, String _updaterName, Iterable<TreeOperation> _log, long nextRevision) throws IOException { | 225 private void putDataSegment(String _uuid, String _treeName, String _updaterName, Iterable<TreeOperation> _log, String nextRevision) throws IOException { |
225 DefaultTreeOperationLogContainer container = new DefaultTreeOperationLogContainer(); | 226 DefaultTreeOperationLogContainer container = new DefaultTreeOperationLogContainer(); |
226 container.setTreeName(_treeName); | 227 container.setTreeName(_treeName); |
227 container.setUUID(_uuid); | 228 container.setUUID(_uuid); |
228 container.setUpdaterName(_updaterName); | 229 container.setUpdaterName(_updaterName); |
229 container.setRevision(nextRevision); | 230 container.setRevision(nextRevision); |
230 container.unconvert(_log); | 231 container.unconvert(_log); |
231 NullCodeSegmentForUpdate cs = new NullCodeSegmentForUpdate(); | 232 NullCodeSegmentForUpdate cs = new NullCodeSegmentForUpdate(); |
232 cs.ods.put("log", container); | 233 cs.ods.put("log", container); |
233 /* If this node isn't Root node, push log to parent node's DS */ | 234 new HashLogUpdateCodeSegment(container.getHashLogString()); |
235 System.out.println("putDataSegment"); | |
236 System.out.println(container.getHashLogString()); | |
237 /* If this node is not Root node, push log to parent node's DS */ | |
234 if(!_updaterName.equals("node0")) { | 238 if(!_updaterName.equals("node0")) { |
235 cs.ods.put("parent", "childLog", container); | 239 cs.ods.put("parent", "childLog", container); |
236 } | 240 } |
237 } | 241 } |
238 | 242 |