Mercurial > hg > Members > tatsuki > bench > jungle-core
comparison src/main/java/jp/ac/u_ryukyu/ie/cr/shoshi/jungle/store/impl/logger/LoggingAttributes.java @ 117:74723b26ad96
add IndexJungleTreeEditr and remove DefaultJungleIndexTreeEditor
author | one |
---|---|
date | Tue, 30 Sep 2014 13:15:22 +0900 |
parents | bed3afd5c2e2 |
children | 0854f9a9e81d |
comparison
equal
deleted
inserted
replaced
115:a6250c32451f | 117:74723b26ad96 |
---|---|
8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; | 8 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.NodeOperation; |
9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; | 9 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.store.operations.PutAttributeOperation; |
10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; | 10 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.DefaultEither; |
11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; | 11 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Either; |
12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; | 12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.util.Error; |
13 import jp.ac.u_ryukyu.ie.cr.tatsuki.jungle.store.index.Logging; | |
14 | 13 |
15 public class LoggingAttributes //implements EditableAttributes | 14 public class LoggingAttributes //implements EditableAttributes |
16 { | 15 { |
17 private final TreeNode wrap; | 16 private final TreeNode wrap; |
18 private final OperationLog log; | 17 private final OperationLog log; |
27 { | 26 { |
28 TreeNodeAttributes attributes = wrap.getAttributes(); | 27 TreeNodeAttributes attributes = wrap.getAttributes(); |
29 return attributes.get(_key); | 28 return attributes.get(_key); |
30 } | 29 } |
31 | 30 |
32 private Either<Error,Logging> edit(NodeOperation _op) | 31 private Either<Error,LoggingNode> edit(NodeOperation _op) |
33 { | 32 { |
34 Either<Error,TreeNode> either = _op.invoke(wrap); | 33 Either<Error,TreeNode> either = _op.invoke(wrap); |
35 if(either.isA()){ | 34 if(either.isA()){ |
36 return DefaultEither.newA(either.a()); | 35 return DefaultEither.newA(either.a()); |
37 } | 36 } |
38 | 37 |
39 TreeNode newNode = either.b(); | 38 TreeNode newNode = either.b(); |
40 OperationLog newLog = log.add(_op); | 39 OperationLog newLog = log.add(_op); |
41 Logging newLogNode = new LoggingNode(newNode,newLog); | 40 LoggingNode newLogNode = new LoggingNode(newNode,newLog); |
42 | 41 |
43 return DefaultEither.newB(newLogNode); | 42 return DefaultEither.newB(newLogNode); |
44 } | 43 } |
45 | 44 |
46 public Either<Error,Logging> delete(final String _key) | 45 public Either<Error,LoggingNode> delete(final String _key) |
47 { | 46 { |
48 | 47 |
49 DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(_key); | 48 DeleteAttributeOperation deleteAttribute = new DeleteAttributeOperation(_key); |
50 return edit(deleteAttribute); | 49 return edit(deleteAttribute); |
51 } | 50 } |
52 | 51 |
53 public Either<Error,Logging> put(final String _key,final ByteBuffer _value) | 52 public Either<Error,LoggingNode> put(final String _key,final ByteBuffer _value) |
54 { | 53 { |
55 PutAttributeOperation putAttribute = new PutAttributeOperation(_key,_value); | 54 PutAttributeOperation putAttribute = new PutAttributeOperation(_key,_value); |
56 return edit(putAttribute); | 55 return edit(putAttribute); |
57 } | 56 } |
58 } | 57 } |