public final class Txn extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Txn.State
MRT state.
|
| Constructor and Description |
|---|
Txn()
Create MRT, assign random transaction id and initialize reads/writes hashmaps with default
capacities.
|
Txn(int readsCapacity,
int writesCapacity)
Create MRT, assign random transaction id and initialize reads/writes hashmaps with given
capacities.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear MRT.
|
boolean |
closeMonitor()
Return if the MRT monitor record should be closed/deleted.
|
int |
getDeadline()
Get MRT deadline.
|
long |
getId()
Return MRT ID.
|
boolean |
getInDoubt()
Return if MRT is inDoubt.
|
String |
getNamespace()
Return MRT namespace.
|
Set<Map.Entry<Key,Long>> |
getReads()
Get all read keys and their versions.
|
Long |
getReadVersion(Key key)
Get record version for a given key.
|
Txn.State |
getState()
Return MRT state.
|
int |
getTimeout()
Return MRT timeout in seconds.
|
Set<Key> |
getWrites()
Get all write keys and their versions.
|
boolean |
monitorExists()
Does MRT monitor record exist.
|
void |
onRead(Key key,
Long version)
Process the results of a record read.
|
void |
onWrite(Key key,
Long version,
int resultCode)
Process the results of a record write.
|
void |
onWriteInDoubt(Key key)
Add key to write hash when write command is in doubt (usually caused by timeout).
|
void |
setDeadline(int deadline)
Set MRT deadline.
|
void |
setInDoubt(boolean inDoubt)
Set MRT inDoubt flag.
|
void |
setNamespace(String ns)
Set MRT namespace only if doesn't already exist.
|
void |
setState(Txn.State state)
Set MRT state.
|
void |
setTimeout(int timeout)
Set MRT timeout in seconds.
|
void |
verifyCommand()
Verify that the MRT state allows future commands.
|
public Txn()
The default client MRT timeout is zero. This means use the server configuration mrt-duration as the MRT timeout. The default mrt-duration is 10 seconds.
public Txn(int readsCapacity,
int writesCapacity)
The default client MRT timeout is zero. This means use the server configuration mrt-duration as the MRT timeout. The default mrt-duration is 10 seconds.
readsCapacity - expected number of record reads in the MRT. Minimum value is 16.writesCapacity - expected number of record writes in the MRT. Minimum value is 16.public long getId()
public void setTimeout(int timeout)
If the MRT timeout is zero, the server configuration mrt-duration is used. The default mrt-duration is 10 seconds.
public int getTimeout()
public void verifyCommand()
public void onRead(Key key, Long version)
public void onWrite(Key key, Long version, int resultCode)
public void onWriteInDoubt(Key key)
public void setNamespace(String ns)
public String getNamespace()
public void setDeadline(int deadline)
public int getDeadline()
public boolean closeMonitor()
public boolean monitorExists()
public void setState(Txn.State state)
public Txn.State getState()
public void setInDoubt(boolean inDoubt)
public boolean getInDoubt()
public void clear()
Copyright © 2012–2024 Aerospike, Inc. All rights reserved.