Mercurial > hg > Members > nobuyasu > jungle-network
changeset 84:82d1d3dac7bc
Modfied NetworkTransactionManager
author | one |
---|---|
date | Sun, 27 Oct 2013 20:05:53 +0900 |
parents | b3ccefdf2b43 |
children | e641f559559c |
files | src/alice/jungle/operations/NetworkTreeOperationLog.java src/alice/jungle/persistence/NetworkJournal.java |
diffstat | 2 files changed, 33 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/jungle/operations/NetworkTreeOperationLog.java Fri Oct 25 18:44:29 2013 +0900 +++ b/src/alice/jungle/operations/NetworkTreeOperationLog.java Sun Oct 27 20:05:53 2013 +0900 @@ -15,10 +15,23 @@ { public LinkedList<NetworkTreeOperation> list; public int size; + String treeName; public NetworkTreeOperationLog() { list = new LinkedList<NetworkTreeOperation>(); size = 0; + treeName = ""; + } + + public NetworkTreeOperationLog(String _treeName, Iterable<TreeOperation> _list) + { + treeName = _treeName; + list = new LinkedList<NetworkTreeOperation>(); + for(TreeOperation op: _list) { + NetworkTreeOperation nOp = new NetworkTreeOperation(op); + list.add(nOp); + } + size = list.size(); } public NetworkTreeOperationLog(Iterable<TreeOperation> _list) @@ -29,17 +42,9 @@ list.add(nOp); } size = list.size(); + treeName = ""; } - public NetworkTreeOperationLog(Iterable<TreeOperation> _list, int _size) - { - list = new LinkedList<NetworkTreeOperation>(); - for(TreeOperation op: _list) { - NetworkTreeOperation nOp = new NetworkTreeOperation(op); - list.add(nOp); - } - size = _size; - } @Override public Iterator<TreeOperation> iterator() { @@ -73,5 +78,9 @@ { return size; } + + public String getTreeName() { + return treeName; + } }
--- a/src/alice/jungle/persistence/NetworkJournal.java Fri Oct 25 18:44:29 2013 +0900 +++ b/src/alice/jungle/persistence/NetworkJournal.java Sun Oct 27 20:05:53 2013 +0900 @@ -19,6 +19,7 @@ import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.ChangeListWriter; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.Journal; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent.Result; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.ChangeSet; import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; public class NetworkJournal implements Journal { @@ -82,9 +83,22 @@ } return Result.SUCCESS; } + + public Result write(ChangeSet cs) + { + NetworkTreeOperationLog log = new NetworkTreeOperationLog(cs.uuid(),cs.getChangeList()); + try { + msgpack.write(out, log); + out.flush(); + } catch (IOException e) { + return null; + } + return Result.SUCCESS; + } + } - public MessagePack getMessagePack() { + public static MessagePack getMessagePack() { return msgpack; }