Modifier and Type | Method and Description |
---|---|
void |
abort(StoreTransaction txn)
Ends a transaction after a failure.
|
long |
alloc(int count,
StoreTransaction txn)
Allocates one or more new (and empty) items in the store.
|
ListenableFuture<Long> |
allocAsync(int count,
StoreTransaction txn)
Allocates one or more new (and empty) items in the store.
|
StoreTransaction |
beginTransaction()
Creates a new transaction.
|
void |
commit(StoreTransaction txn)
Ends a transaction, and makes all updates visible by all other nodes in the cluster.
|
void |
del(long id,
StoreTransaction txn)
Deletes an item from the store.
|
ListenableFuture<Void> |
delAsync(long id,
StoreTransaction txn) |
byte[] |
get(long id)
Retrieves a given data item.
|
void |
get(long id,
Persistable object)
Retrieves a given data item into a
Persistable . |
byte[] |
get(long id,
short nodeHint)
Retrieves a given data item, using a hint as to its
owner in the
cluster.If the item is indeed found on the hinted node, the retrieval performance might be superior. |
void |
get(long id,
short nodeHint,
Persistable object)
Retrieves a given data item into a
Persistable , using a hint as to its owner
in the cluster.If the item is indeed found on the hinted node, the retrieval performance might be superior. |
ListenableFuture<byte[]> |
getAsync(long id)
Retrieves a given data item asynchronously.
|
ListenableFuture<Persistable> |
getAsync(long id,
Persistable object)
Retrieves a given data item into a
Persistable asynchronously. |
ListenableFuture<byte[]> |
getAsync(long id,
short nodeHint)
Retrieves a given data item asynchronously, using a hint as to its
owner in
the cluster. |
ListenableFuture<Persistable> |
getAsync(long id,
short nodeHint,
Persistable object)
Retrieves a given data item asynchronously into a
Persistable , using a hint as to its owner
in the cluster. |
byte[] |
getFromOwner(long id,
long ownerOf)
Retrieves a given data item, using a hint as to its
owner in the cluster. |
void |
getFromOwner(long id,
long ownerOf,
Persistable object)
Retrieves a given data item, using a hint as to its
owner in the cluster. |
ListenableFuture<byte[]> |
getFromOwnerAsync(long id,
long ownerOf)
Retrieves a given data item asynchronously, using a hint as to its
owner in
the cluster. |
ListenableFuture<Persistable> |
getFromOwnerAsync(long id,
long ownerOf,
Persistable object)
Retrieves a given data item asynchronously, using a hint as to its
owner in
the cluster. |
CacheListener |
getListener(long id) |
int |
getMaxItemSize()
Returns the maximum size, in bytes, of a data item in the grid.
|
long |
getRoot(String rootName,
long id,
StoreTransaction txn)
Gets or possibly creates a root data item.
|
long |
getRoot(String rootName,
StoreTransaction txn)
Gets or possibly creates a root data item.
|
void |
gets(long id,
Persistable object,
StoreTransaction txn)
Retrieves a given data item into a
Persistable , and pins the shared (cached) instance to this node. |
void |
gets(long id,
short nodeHint,
Persistable object,
StoreTransaction txn)
Retrieves a given data item into a
Persistable with a hint as to its owner
in the cluster, and pins the shared (cached) instance to this node. |
byte[] |
gets(long id,
short nodeHint,
StoreTransaction txn)
Retrieves a given data item with a hint as to its
owner in the cluster, and
pins the shared (cached) instance to this node. |
byte[] |
gets(long id,
StoreTransaction txn)
Retrieves a given data item, and pins the shared (cached) instance to this node.
|
ListenableFuture<Persistable> |
getsAsync(long id,
Persistable object,
StoreTransaction txn)
Retrieves a given data asynchronously item into a
Persistable , and pins the shared (cached) instance to
this node. |
ListenableFuture<Persistable> |
getsAsync(long id,
short nodeHint,
Persistable object,
StoreTransaction txn)
Retrieves a given data asynchronously item into a
Persistable with a hint as to its owner
in the cluster, and pins the shared (cached) instance to this node. |
ListenableFuture<byte[]> |
getsAsync(long id,
short nodeHint,
StoreTransaction txn)
Retrieves a given data item asynchronously with a hint as to its
owner in the cluster,
and pins the shared (cached) instance to this node. |
ListenableFuture<byte[]> |
getsAsync(long id,
StoreTransaction txn)
Retrieves a given data item asynchronously, and pins the shared (cached) instance to this node.
|
void |
getsFromOwner(long id,
long ownerOf,
Persistable object,
StoreTransaction txn)
Retrieves a given data item with a hint as to its
owner in the cluster, and
pins the shared (cached) instance to this node. |
byte[] |
getsFromOwner(long id,
long ownerOf,
StoreTransaction txn)
Retrieves a given data item with a hint as to its
owner in the cluster, and
pins the shared (cached) instance to this node. |
ListenableFuture<Persistable> |
getsFromOwnerAsync(long id,
long ownerOf,
Persistable object,
StoreTransaction txn)
Retrieves a given data item asynchronously with a hint as to its
owner in the cluster, and
pins the shared (cached) instance to this node. |
ListenableFuture<byte[]> |
getsFromOwnerAsync(long id,
long ownerOf,
StoreTransaction txn)
Retrieves a given data item asynchronously with a hint as to its
owner in the cluster,
and pins the shared (cached) instance to this node. |
ItemState |
getState(long id)
Returns an item's state in the local store.
|
long |
getVersion(long id)
CacheLine version
|
void |
getx(long id,
Persistable object,
StoreTransaction txn)
Retrieves a given data item into a
Persistable , makes this node its exclusive owner, and pins it. |
void |
getx(long id,
short nodeHint,
Persistable object,
StoreTransaction txn)
Retrieves a given data item with a hint as to its
owner in the cluster,
makes this node its exclusive owner, and pins it. |
byte[] |
getx(long id,
short nodeHint,
StoreTransaction txn)
Retrieves a given data item with a hint as to its
owner in the cluster,
makes this node its exclusive owner, and pins it. |
byte[] |
getx(long id,
StoreTransaction txn)
Retrieves a given data item, makes this node its exclusive owner, and pins it.
|
ListenableFuture<Persistable> |
getxAsync(long id,
Persistable object,
StoreTransaction txn)
Retrieves a given data item asynchronously into a
Persistable , makes this node its exclusive owner, and
pins it. |
ListenableFuture<Persistable> |
getxAsync(long id,
short nodeHint,
Persistable object,
StoreTransaction txn)
Retrieves a given data item asynchronously with a hint as to its
owner in the cluster,
makes this node its exclusive owner, and pins it. |
ListenableFuture<byte[]> |
getxAsync(long id,
short nodeHint,
StoreTransaction txn)
Retrieves a given data item asynchronously with a hint as to its
owner in the cluster,
makes this node its exclusive owner, and pins it. |
ListenableFuture<byte[]> |
getxAsync(long id,
StoreTransaction txn)
Retrieves a given data item asynchronously, makes this node its exclusive owner, and pins it.
|
void |
getxFromOwner(long id,
long ownerOf,
Persistable object,
StoreTransaction txn)
Retrieves a given data item with a hint as to its
owner in the cluster,
makes this node its exclusive owner, and pins it. |
byte[] |
getxFromOwner(long id,
long ownerOf,
StoreTransaction txn)
Retrieves a given data item with a hint as to its
owner in the cluster,
makes this node its exclusive owner, and pins it. |
ListenableFuture<Persistable> |
getxFromOwnerAsync(long id,
long ownerOf,
Persistable object,
StoreTransaction txn)
Retrieves a given data item asynchronously with a hint as to its
owner in the cluster,
makes this node its exclusive owner, and pins it. |
ListenableFuture<byte[]> |
getxFromOwnerAsync(long id,
long ownerOf,
StoreTransaction txn)
Retrieves a given data item asynchronously with a hint as to its
owner in the cluster,
makes this node its exclusive owner, and pins it. |
<T> T |
invoke(long id,
LineFunction<T> function) |
<T> ListenableFuture<T> |
invokeAsync(long id,
LineFunction<T> function) |
boolean |
isPinned(long id)
Tests whether an item is pinned on this node.
|
boolean |
isRootCreated(long rootId,
StoreTransaction txn)
Tests whether a root item has been newly created.
|
void |
push(long id,
short... toNodes)
Makes the given item available in the given nodes' cache.
|
void |
pushx(long id,
short toNode)
Makes the given item available in the given node's cache, and makes that node the owner of the item.
|
long |
put(byte[] data,
StoreTransaction txn)
Puts a new item into the store and returns its (newly allocated) ID.
|
long |
put(ByteBuffer data,
StoreTransaction txn)
Puts a new item into the store and returns its (newly allocated) ID.
|
long |
put(Persistable object,
StoreTransaction txn)
Puts a new item into the store and returns its (newly allocated) ID.
|
ListenableFuture<Long> |
putAsync(byte[] data,
StoreTransaction txn)
Puts a new item into the store and returns its (newly allocated) ID.
|
ListenableFuture<Long> |
putAsync(ByteBuffer data,
StoreTransaction txn)
Puts a new item into the store and returns its (newly allocated) ID.
|
ListenableFuture<Long> |
putAsync(Persistable object,
StoreTransaction txn)
Puts a new item into the store and returns its (newly allocated) ID.
|
void |
release(long id)
Releases a line that's been pinned to this node by one of the
gets , getx , put operations. |
void |
rollback(StoreTransaction txn)
Reverts
set operations that were performed during the transactions. |
void |
send(long id,
byte[] msg)
Sends a message to an item, which will be received by
CacheListener.messageReceived
on the item's owning node. |
void |
send(long id,
Streamable msg)
Sends a message to an item, which will be received by
CacheListener.messageReceived
on the item's owning node. |
ListenableFuture<Void> |
sendAsync(long id,
byte[] msg)
Sends a message to an item, which will be received by
CacheListener.messageReceived
on the item's owning node. |
ListenableFuture<Void> |
sendAsync(long id,
Streamable msg)
Sends a message to an item, which will be received by
CacheListener.messageReceived
on the item's owning node. |
void |
set(long id,
byte[] data,
StoreTransaction txn)
Gains ownership of an item and sets its contents.
|
void |
set(long id,
ByteBuffer data,
StoreTransaction txn)
Gains ownership of an item and sets its contents.
|
void |
set(long id,
Persistable object,
StoreTransaction txn)
Gains ownership of an item and sets its contents.
|
ListenableFuture<Void> |
setAsync(long id,
byte[] data,
StoreTransaction txn)
Gains ownership of an item and sets its contents asynchronously.
|
ListenableFuture<Void> |
setAsync(long id,
ByteBuffer data,
StoreTransaction txn)
Gains ownership of an item and sets its contents asynchronously.
|
ListenableFuture<Void> |
setAsync(long id,
Persistable object,
StoreTransaction txn)
Gains ownership of an item and sets its contents asynchronously.
|
void |
setListener(long id,
CacheListener listener)
Sets a listener listening for local cache events on the given item.
|
CacheListener |
setListenerIfAbsent(long id,
CacheListener listener)
Sets a listener listening for local cache events on the given item if absent.
|
boolean |
tryPin(long id,
ItemState state,
StoreTransaction txn)
Pins item if it can be done locally.
|
int getMaxItemSize()
StoreTransaction beginTransaction()
A transaction can be used by more than one thread.
void commit(StoreTransaction txn) throws InterruptedException
txn
- The current transaction, which we wish to complete.InterruptedException
void abort(StoreTransaction txn) throws InterruptedException
This method must be called only after rollback()
has been called, or a manual rollback has been done.
txn
- The current transaction, which we wish to complete after failure.InterruptedException
void rollback(StoreTransaction txn)
set
operations that were performed during the transactions.
This method does not complete the
transaction. endTransaction()
must still be called.
txn
- The current transaction.void release(long id)
gets
, getx
, put
operations.
This method must be called to release a line used in one of the gets
, getx
, put
operations, if they were called with a null
transaction.
id
- long getRoot(String rootName, StoreTransaction txn) throws TimeoutException
You can test if the root has been newly created by this transaction by calling .
rootName
- The root's name.txn
- The current transaction. May not be null.TimeoutException
- This exception is thrown if the operation has times-out.long getRoot(String rootName, long id, StoreTransaction txn) throws TimeoutException
You can test if the root has been newly created by this transaction by calling .
rootName
- The root's name.id
- If the root does not yet exist, it will be created and given this ID.txn
- The current transaction. May not be null.TimeoutException
- This exception is thrown if the operation has times-out.boolean isRootCreated(long rootId, StoreTransaction txn)
rootId
- The root item's ID.txn
- The current transaction.true
if the root has been created by the current transaction; false
if it existed before
current transaction.void setListener(long id, CacheListener listener)
setListener
in interface Cache
id
- The item's ID.listener
- The listener.CacheListener setListenerIfAbsent(long id, CacheListener listener)
setListenerIfAbsent
in interface Cache
id
- The item's ID.listener
- The listener.CacheListener getListener(long id)
getListener
in interface Cache
id
- The item's ID.long alloc(int count, StoreTransaction txn) throws TimeoutException
When allocating a single item, it's better to use put()
, but some data
structures might require allocating an array of items.
count
- The number of items to allocate.txn
- The current transaction. May not be null.count - 1
IDs belong to the
following elements of the array.TimeoutException
long put(byte[] data, StoreTransaction txn) throws TimeoutException
data
- The item's contents.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.long put(ByteBuffer data, StoreTransaction txn) throws TimeoutException
data
- The item's contents.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.long put(Persistable object, StoreTransaction txn) throws TimeoutException
object
- The item's contents.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.byte[] get(long id) throws TimeoutException
id
- The item's ID.TimeoutException
- This exception is thrown if the operation has times-out.void get(long id, Persistable object) throws TimeoutException
Persistable
.id
- The item's ID.object
- The object into which the contents of the item will be written. May be null
.TimeoutException
- This exception is thrown if the operation has times-out.byte[] get(long id, short nodeHint) throws TimeoutException
owner
in the
cluster.id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.TimeoutException
- This exception is thrown if the operation has times-out.void get(long id, short nodeHint, Persistable object) throws TimeoutException
Persistable
, using a hint as to its owner
in the cluster.id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.object
- The object into which the contents of the item will be written. May be null
.TimeoutException
- This exception is thrown if the operation has times-out.byte[] getFromOwner(long id, long ownerOf) throws TimeoutException
owner
in the cluster.
Unlike the direct hint given in get(long, short)
, the hinted node here is the owner of
a given item.id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.TimeoutException
- This exception is thrown if the operation has times-out.void getFromOwner(long id, long ownerOf, Persistable object) throws TimeoutException
owner
in the cluster.
Unlike the direct hint given in get(long, short, Persistable)
, the hinted
node here is the owner of a given item.id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.object
- The object into which the contents of the item will be written. May be null
.TimeoutException
- This exception is thrown if the operation has times-out.byte[] gets(long id, StoreTransaction txn) throws TimeoutException
end the transaction
or release
it.id
- The item's ID.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.void gets(long id, Persistable object, StoreTransaction txn) throws TimeoutException
Persistable
, and pins the shared (cached) instance to this node. What
this means is that while other nodes will be able to read the same item, no node will be able to update it until
until we end the transaction
or release
it.id
- The item's ID.object
- The object into which the contents of the item will be written. May be null
.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.byte[] gets(long id, short nodeHint, StoreTransaction txn) throws TimeoutException
owner
in the cluster, and
pins the shared (cached) instance to this node. What this means is that while other nodes will be able to read
the same item, no node will be able to update it until until we end the transaction
or release
it. id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.void gets(long id, short nodeHint, Persistable object, StoreTransaction txn) throws TimeoutException
Persistable
with a hint as to its owner
in the cluster, and pins the shared (cached) instance to this node. What this means is that while other nodes
will be able to read the same item, no node will be able to update it until until we end the transaction
or release
it.id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.txn
- The current transaction. May be null, in which case you must later call release(id)
.object
- The object into which the contents of the item will be written. May be null
.TimeoutException
- This exception is thrown if the operation has times-out.byte[] getsFromOwner(long id, long ownerOf, StoreTransaction txn) throws TimeoutException
owner
in the cluster, and
pins the shared (cached) instance to this node. What this means is that while other nodes will be able to update
it until until we end the transaction
or release
it. Unlike the direct hint given in
gets(long, short, StoreTransaction)
, the hinted node here is the owner of a given item.id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.void getsFromOwner(long id, long ownerOf, Persistable object, StoreTransaction txn) throws TimeoutException
owner
in the cluster, and
pins the shared (cached) instance to this node. What this means is that while other nodes will be able to read
the same item, no node will be able to update it until until we end the transaction
or release
it.gets(long, short, Persistable, StoreTransaction)
,
the hinted node here is the owner of a given item.id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.object
- The object into which the contents of the item will be written. May be null
.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.byte[] getx(long id, StoreTransaction txn) throws TimeoutException
end the transaction
or release
it. it.id
- The item's ID.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.void getx(long id, Persistable object, StoreTransaction txn) throws TimeoutException
Persistable
, makes this node its exclusive owner, and pins it. What
this means is that no other node will be able to read or update the same item until until we end the transaction
or release
it.id
- The item's ID.object
- The object into which the contents of the item will be written. May be null
.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.byte[] getx(long id, short nodeHint, StoreTransaction txn) throws TimeoutException
owner
in the cluster,
makes this node its exclusive owner, and pins it. What this means is that no other node will be able to read or
update the same item until until we end the transaction
or release
it.id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.void getx(long id, short nodeHint, Persistable object, StoreTransaction txn) throws TimeoutException
owner
in the cluster,
makes this node its exclusive owner, and pins it. What this means is that no other node will be able to read or
update the same item until we end the transaction
or release
it.id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.object
- The object into which the contents of the item will be written. May be null
.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.byte[] getxFromOwner(long id, long ownerOf, StoreTransaction txn) throws TimeoutException
owner
in the cluster,
makes this node its exclusive owner, and pins it. What this means is that no other node will be able to read or
update the same item until we end the transaction
or release
it.
Unlike the direct hint given in getx(long, short, StoreTransaction)
, the hinted node here is the owner
of a given item.id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.void getxFromOwner(long id, long ownerOf, Persistable object, StoreTransaction txn) throws TimeoutException
owner
in the cluster,
makes this node its exclusive owner, and pins it. What this means is that no other node will be able to read or
update the same item until we end the transaction
or release
it.
Unlike the direct hint given in getx(long, short, Persistable, StoreTransaction)
, the hinted node here
is the owner of a given item.id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.object
- The object into which the contents of the item will be written. May be null
.txn
- The current transaction. May be null, in which case you must later call release(id)
.TimeoutException
- This exception is thrown if the operation has times-out.void set(long id, byte[] data, StoreTransaction txn) throws TimeoutException
id
- The item's ID.data
- The contents to write into the item.txn
- The current transaction. May be null.TimeoutException
- This exception is thrown if the operation has times-out.void set(long id, ByteBuffer data, StoreTransaction txn) throws TimeoutException
id
- The item's ID.data
- The contents to write into the item.txn
- The current transaction. May be null.TimeoutException
- This exception is thrown if the operation has times-out.void set(long id, Persistable object, StoreTransaction txn) throws TimeoutException
id
- The item's ID.object
- The contents to write into the item.txn
- The current transaction. May be null.TimeoutException
- This exception is thrown if the operation has times-out.void del(long id, StoreTransaction txn) throws TimeoutException
id
- txn
- The current transaction. May be null.TimeoutException
<T> T invoke(long id, LineFunction<T> function) throws TimeoutException
TimeoutException
ListenableFuture<Long> allocAsync(int count, StoreTransaction txn)
When allocating a single item, it's better to use put()
, but some data
structures might require allocating an array of items.
count
- The number of items to allocate.txn
- The current transaction. May not be null.count - 1
IDs belong to the
following elements of the array.ListenableFuture<Long> putAsync(byte[] data, StoreTransaction txn)
data
- The item's contents.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<Long> putAsync(ByteBuffer data, StoreTransaction txn)
data
- The item's contents.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<Long> putAsync(Persistable object, StoreTransaction txn)
object
- The item's contents.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<byte[]> getAsync(long id)
The asynchronous version of get(long)
.
id
- The item's ID.ListenableFuture<Persistable> getAsync(long id, Persistable object)
Persistable
asynchronously.
The asynchronous version of get(long, Persistable)
.
id
- The item's ID.object
- The object into which the contents of the item will be written when the operation completes (after
the future has been waited for).ListenableFuture<byte[]> getAsync(long id, short nodeHint)
owner
in
the cluster.
The asynchronous version of get(long, short)
.
id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.ListenableFuture<Persistable> getAsync(long id, short nodeHint, Persistable object)
Persistable
, using a hint as to its owner
in the cluster.
The asynchronous version of get(long, short, Persistable)
.
id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.object
- The object into which the contents of the item will be written.ListenableFuture<byte[]> getFromOwnerAsync(long id, long ownerOf)
owner
in
the cluster. Unlike the direct hint given in get(long, short)
, the hinted node here is
the owner of a given item.
The asynchronous version of getFromOwner(long, long)
id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.ListenableFuture<Persistable> getFromOwnerAsync(long id, long ownerOf, Persistable object)
owner
in
the cluster. Unlike the direct hint given in get(long, short, Persistable)
,
the hinted node here is the owner of a given item.
The asynchronous version of getFromOwner(long, long, Persistable)
id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.object
- The object into which the contents of the item will be written. May be null
.ListenableFuture<byte[]> getsAsync(long id, StoreTransaction txn)
end the transaction
or release
it.
The asynchronous version of gets(long, StoreTransaction)
id
- The item's ID.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<Persistable> getsAsync(long id, Persistable object, StoreTransaction txn)
Persistable
, and pins the shared (cached) instance to
this node. What this means is that while other nodes will be able to read the same item, no node will be able to
update it until until we end the transaction
or release
it.
The asynchronous version of gets(long, Persistable, StoreTransaction)
id
- The item's ID.object
- The object into which the contents of the item will be written. May be null
.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<byte[]> getsAsync(long id, short nodeHint, StoreTransaction txn)
owner
in the cluster,
and pins the shared (cached) instance to this node. What this means is that while other nodes will be able to
read the same item, no node will be able to update it until until we end the transaction
or release
it.
The asynchronous version of gets(long, short, StoreTransaction)
id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<Persistable> getsAsync(long id, short nodeHint, Persistable object, StoreTransaction txn)
Persistable
with a hint as to its owner
in the cluster, and pins the shared (cached) instance to this node. What this means is that while other nodes
will be able to read the same item, no node will be able to update it until until we end the transaction
or release
it.
The asynchronous version of gets(long, short, Persistable, StoreTransaction)
id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.txn
- The current transaction. May be null, in which case you must later call release(id)
.object
- The object into which the contents of the item will be written.ListenableFuture<byte[]> getsFromOwnerAsync(long id, long ownerOf, StoreTransaction txn)
owner
in the cluster,
and pins the shared (cached) instance to this node. What this means is that while other nodes will be able to
update it until until we end the transaction
or release
it. Unlike the direct hint given in
gets(long, short, StoreTransaction)
, the hinted node here is the owner of a given item.
The asynchronous version of getsFromOwner(long, long, StoreTransaction)
id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<Persistable> getsFromOwnerAsync(long id, long ownerOf, Persistable object, StoreTransaction txn)
owner
in the cluster, and
pins the shared (cached) instance to this node. What this means is that while other nodes will be able to read
the same item, no node will be able to update it until until we end the transaction
or release
it.gets(long, short, Persistable, StoreTransaction)
,
the hinted node here is the owner of a given item.
The asynchronous version of getsFromOwner(long, long, Persistable, StoreTransaction)
id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.object
- The object into which the contents of the item will be written. May be null
.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<byte[]> getxAsync(long id, StoreTransaction txn)
end the transaction
or release
it. it.
The asynchronous version of getx(long, StoreTransaction)
id
- The item's ID.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<Persistable> getxAsync(long id, Persistable object, StoreTransaction txn)
Persistable
, makes this node its exclusive owner, and
pins it. What this means is that no other node will be able to read or update the same item until until we end the transaction
or release
it.
The asynchronous version of getx(long, Persistable, StoreTransaction)
id
- The item's ID.object
- The object into which the contents of the item will be written. May be null
.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<byte[]> getxAsync(long id, short nodeHint, StoreTransaction txn)
owner
in the cluster,
makes this node its exclusive owner, and pins it. What this means is that no other node will be able to read or
update the same item until until we end the transaction
or release
it.
The asynchronous version of getx(long, short, StoreTransaction)
id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<Persistable> getxAsync(long id, short nodeHint, Persistable object, StoreTransaction txn)
owner
in the cluster,
makes this node its exclusive owner, and pins it. What this means is that no other node will be able to read or
update the same item until we end the transaction
or release
it.
The asynchronous version of getx(long, short, Persistable, StoreTransaction)
id
- The item's ID.nodeHint
- The ID of the node the data item is probably owned by.object
- The object into which the contents of the item will be written. May be null
.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<byte[]> getxFromOwnerAsync(long id, long ownerOf, StoreTransaction txn)
owner
in the cluster,
makes this node its exclusive owner, and pins it. What this means is that no other node will be able to read or
update the same item until we end the transaction
or release
it.
Unlike the direct hint given in getx(long, short, StoreTransaction)
, the hinted node here is the owner
of a given item.
The asynchronous version of getxFromOwner(long, long, StoreTransaction)
id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<Persistable> getxFromOwnerAsync(long id, long ownerOf, Persistable object, StoreTransaction txn)
owner
in the cluster,
makes this node its exclusive owner, and pins it. What this means is that no other node will be able to read or
update the same item until we end the transaction
or release
it.
Unlike the direct hint given in getx(long, short, Persistable, StoreTransaction)
, the hinted node here
is the owner of a given item.
The asynchronous version of getxFromOwner(long, long, Persistable, StoreTransaction)
id
- The item's ID.ownerOf
- The ID of an item whose owner is probably the owner of the requested item as well.object
- The object into which the contents of the item will be written. May be null
.txn
- The current transaction. May be null, in which case you must later call release(id)
.ListenableFuture<Void> setAsync(long id, byte[] data, StoreTransaction txn)
set(long, byte[], StoreTransaction)
.
Upon completion of the future returned by this method, the item will be pinned if and only if it had been pinned
when the method was called.id
- The item's ID.data
- The contents to write into the item.txn
- The current transaction. May be null.ListenableFuture<Void> setAsync(long id, ByteBuffer data, StoreTransaction txn)
set(long, ByteBuffer, StoreTransaction)
.
Upon completion of the future returned by this method, the item will be pinned if and only if it had been pinned
when the method was called.id
- The item's ID.data
- The contents to write into the item.txn
- The current transaction. May be null.ListenableFuture<Void> setAsync(long id, Persistable object, StoreTransaction txn)
set(long, Persistable, StoreTransaction)
.
Upon completion of the future returned by this method, the item will be pinned if and only if it had been pinned
when the method was called.id
- The item's ID.object
- The contents to write into the item.txn
- The current transaction. May be null.<T> ListenableFuture<T> invokeAsync(long id, LineFunction<T> function)
ListenableFuture<Void> delAsync(long id, StoreTransaction txn)
void push(long id, short... toNodes)
id
- The ID of item to push.toNodes
- The nodes to which the item is to be pushed.void pushx(long id, short toNode)
id
- The ID of item to push.toNode
- The node to which the item is to be pushed.boolean isPinned(long id)
id
- The item's ID.true
if the item is pinned; false
otherwise.boolean tryPin(long id, ItemState state, StoreTransaction txn) throws IllegalStateException
id
- The item's ID.state
- can be X for writePin or S for readPin.txn
- The current transaction. May be null, in which case you must later call release(id)
.IllegalStateException
- if state is not X or SItemState getState(long id)
id
- The item's ID.long getVersion(long id)
id
- The item's ID.void send(long id, Streamable msg) throws TimeoutException
CacheListener.messageReceived
on the item's owning node.id
- The item's ID.msg
- The message.TimeoutException
- This exception is thrown if the operation has times-out.void send(long id, byte[] msg) throws TimeoutException
CacheListener.messageReceived
on the item's owning node.id
- The item's ID.msg
- The message.TimeoutException
- This exception is thrown if the operation has times-out.ListenableFuture<Void> sendAsync(long id, Streamable msg)
CacheListener.messageReceived
on the item's owning node.id
- The item's ID.msg
- The message.ListenableFuture<Void> sendAsync(long id, byte[] msg)
CacheListener.messageReceived
on the item's owning node.id
- The item's ID.msg
- The message.