public class ReadOp extends Object implements TransactionOperation, TransactionSingleOpOperation
Constructor and Description |
---|
ReadOp(OtpErlangString key)
Constructor
|
ReadOp(String key)
Constructor
|
Modifier and Type | Method and Description |
---|---|
OtpErlangObject |
getErlang(boolean compressed)
Gets the erlang representation of the operation.
|
OtpErlangString |
getKey()
Gets the key the operation is working on (if available)
|
OtpErlangObject |
getResult()
Gets the (raw Erlang) result set via
Operation.setResult(OtpErlangObject, boolean) . |
boolean |
getResultCompressed()
Determines if the result set via
Operation.setResult(OtpErlangObject, boolean) is compressed or not. |
ErlangValue |
processResult()
Processes the result set by
Operation.setResult(OtpErlangObject, boolean) . |
ErlangValue |
processResultSingle()
Processes the result set by
Operation.setResult(OtpErlangObject, boolean)
assuming that operation was committed. |
void |
setResult(OtpErlangObject resultRaw,
boolean compressed)
Sets the raw erlang result value.
|
String |
toString() |
public ReadOp(OtpErlangString key)
key
- the key to readpublic ReadOp(String key)
key
- the key to readpublic OtpErlangObject getErlang(boolean compressed)
Operation
public OtpErlangString getKey()
Operation
public void setResult(OtpErlangObject resultRaw, boolean compressed)
Operation
Operation.processResult()
.public OtpErlangObject getResult()
Operation
Operation.setResult(OtpErlangObject, boolean)
.public boolean getResultCompressed()
Operation
Operation.setResult(OtpErlangObject, boolean)
is compressed or not.getResultCompressed
in interface Operation
public ErlangValue processResult() throws NotFoundException, UnknownException
Operation
Operation.setResult(OtpErlangObject, boolean)
.
Note: the created value is not cached!processResult
in interface Operation
NotFoundException
- if the requested key does not existUnknownException
- if any other error occurspublic ErlangValue processResultSingle() throws NotFoundException, KeyChangedException, NotANumberException, NotAListException, AbortException, UnknownException
TransactionSingleOpOperation
Operation.setResult(OtpErlangObject, boolean)
assuming that operation was committed.
In contrast to Operation.processResult()
operations like WriteOp
will throw a proper AbortException
for their commit part instead
of an UnknownException
.
Note: the created value is not cached!processResultSingle
in interface TransactionSingleOpOperation
NotFoundException
- if the requested key does not existKeyChangedException
- if the key did not match old_valueNotANumberException
- if the previously stored value was not a numberNotAListException
- if the previously stored value was no listAbortException
- if a commit failedUnknownException
- if any other error occurs