Mercurial > hg > Members > shoshi > jungle > jungle-core
changeset 57:b136a24f82aa
commit for test
author | Shoshi TAMAKI |
---|---|
date | Sat, 09 Feb 2013 19:44:37 +0900 |
parents | 18c5cb49beca |
children | a3a8c49ad209 |
files | src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/persistent/NullJournal.java src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTreeNodeChildren.java |
diffstat | 2 files changed, 37 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/persistent/NullJournal.java Fri Feb 08 20:14:31 2013 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/persistent/NullJournal.java Sat Feb 09 19:44:37 2013 +0900 @@ -1,5 +1,12 @@ package jp.ac.u_ryukyu.ie.cr.shoshi.jungle.persistent; +import java.nio.ByteBuffer; + +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.Command; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.NodePath; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; +import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.TreeOperation; + public class NullJournal implements Journal { private static final NullChangeListWriter NULL_WRITER = new NullChangeListWriter(); @@ -22,6 +29,35 @@ @Override public Result write(ChangeList _operations) { + /* + for(TreeOperation op : _operations){ + NodePath p = op.getNodePath(); + NodeOperation nodeOp = op.getNodeOperation(); + Command c = nodeOp.getCommand(); + String args = ""; + switch(c){ + case PUT_ATTRIBUTE: + String key = nodeOp.getKey(); + ByteBuffer value = nodeOp.getValue(); + if(value.limit() < 100){ + args = String.format("key:%s,value:%s",key,new String(value.array())); + }else{ + args = String.format("key:%s,value:%d",key,value.limit()); + } + break; + case DELETE_ATTRIBUTE: + args = String.format("key:%s",nodeOp.getKey()); + break; + case APPEND_CHILD: + args = String.format("pos:%d",nodeOp.getPosition()); + break; + case DELETE_CHILD: + args = String.format("pos:%d",nodeOp.getPosition()); + break; + } + System.out.println(String.format("[%s:%s:%s]",c,p,args)); + } + */ return Result.SUCCESS; } }
--- a/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTreeNodeChildren.java Fri Feb 08 20:14:31 2013 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/transaction/DefaultTreeNodeChildren.java Sat Feb 09 19:44:37 2013 +0900 @@ -115,7 +115,7 @@ List<DefaultNode> rawList = node.getChildren().getChildrenAsRawList(); P2<List<DefaultNode>,List<DefaultNode>> split = rawList.splitAt(_pos + 1); - List<DefaultNode> init = split._1().init(); + List<DefaultNode> init = split._1().reverse().tail().reverse(); List<DefaultNode> newInit = init.snoc(replacement); List<DefaultNode> newList = newInit.append(split._2()); TreeMap<String, ByteBuffer> rawMap = node.getAttributes().getAttributesAsRawMap();