USERKEY - The user key type.STOREKEY - The data store key type.VALUE - The value being stored.public class TransactionalNodeStore<USERKEY,STOREKEY,VALUE> extends java.lang.Object implements NodeStore<USERKEY,STOREKEY,VALUE>
NodeStore.
Operations are stored cached internally until commit() is called or rollback() causes
the data to be abandoned.
A transaction. This is implemented as a NodeStore in which methods not related
to the transaction are directly proxied to the NodeStore used to
initialize this object.| Modifier and Type | Class and Description |
|---|---|
static interface |
TransactionalNodeStore.SubTx<USERKEY,STOREKEY,VALUE>
An interface to provide a callback for doing operations on sub-
TransactionalNodeStores. |
| Constructor and Description |
|---|
TransactionalNodeStore(NodeStore<USERKEY,STOREKEY,VALUE> nodeStore) |
TransactionalNodeStore(NodeStore<USERKEY,STOREKEY,VALUE> nodeStore,
TransactionalNodeStore<USERKEY,STOREKEY,VALUE> parentTransaction)
Create a new transaction that operates against the given
NodeStore. |
| Modifier and Type | Method and Description |
|---|---|
void |
commit()
Execute all operations in this transaction.
|
STOREKEY |
convert(USERKEY key)
Convert user keys to store keys.
|
STOREKEY |
generateKey(Node<USERKEY,STOREKEY> node,
VALUE value)
Generate a key to store a node or data element.
|
VALUE |
loadData(STOREKEY key)
Load the user's data.
|
Node<USERKEY,STOREKEY> |
loadNode(STOREKEY key)
Load a node object from
NodeStore. |
void |
removeData(STOREKEY key)
Remove the given data key.
|
void |
removeNode(STOREKEY key)
Remove the given node key.
|
void |
rollback()
Rollback and clear all internal structures of this transaction.
|
void |
store(STOREKEY key,
Node<USERKEY,STOREKEY> node)
Store the given node.
|
void |
store(STOREKEY key,
VALUE value)
Store user data.
|
void |
subTransaction(TransactionalNodeStore.SubTx<USERKEY,STOREKEY,VALUE> subTx)
Give the user a sub-transaction which is merged into this transaction when
TransactionalNodeStore.SubTx.buildTx(TransactionalNodeStore) returns. |
public void subTransaction(TransactionalNodeStore.SubTx<USERKEY,STOREKEY,VALUE> subTx)
TransactionalNodeStore.SubTx.buildTx(TransactionalNodeStore) returns.public void rollback()
public void commit()
public STOREKEY convert(USERKEY key)
public STOREKEY generateKey(Node<USERKEY,STOREKEY> node, VALUE value)
generateKey in interface NodeStore<USERKEY,STOREKEY,VALUE>node - This is provided to implementations for some context.
If generateKey is being called for the purposes of
storing a user key, this will be null.value - If a key is being generated for a user key value, it will
be passed along. This is most useful
when things like a PagedList
are adding a value, but the List API does not
provide a way to specify a key.public void removeNode(STOREKEY key)
removeNode in interface NodeStore<USERKEY,STOREKEY,VALUE>public void removeData(STOREKEY key)
removeData in interface NodeStore<USERKEY,STOREKEY,VALUE>public void store(STOREKEY key, Node<USERKEY,STOREKEY> node)