Class WritePolicy
-
Field Summary
FieldsModifier and TypeFieldDescriptionDesired consistency guarantee when committing a command on the server.booleanIf the command results in a record deletion, leave a tombstone for the record.intRecord expiration.intExpected generation.Qualify how to handle record writes based on record generation.booleanExecute the write command only if the record is not already locked by this transaction.Qualify how to handle writes where the record already exists.booleanFor client operate(), return a result for every operation.booleanOperate in XDR mode.Fields inherited from class com.aerospike.client.policy.Policy
compress, connectTimeout, failOnFilteredOut, filterExp, maxRetries, readModeAP, readModeSC, readTouchTtlPercent, replica, sendKey, sleepBetweenRetries, socketTimeout, timeoutDelay, totalTimeout, txn -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.WritePolicy(Policy other) Copy write policy from another policy.WritePolicy(WritePolicy other) Copy write policy from another write policy.WritePolicy(WritePolicy other, com.aerospike.client.configuration.ConfigurationProvider configProvider) Copy write policy from another write policy AND override certain policy attributes if they exist in the configProvider.WritePolicy(WritePolicy other, com.aerospike.client.configuration.ConfigurationProvider configProvider, boolean isDefaultPolicy, String preText) Copy write policy from another write policy AND override certain policy attributes if they exist in the configProvider. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()voidsetCommitLevel(CommitLevel commitLevel) voidsetDurableDelete(boolean durableDelete) voidsetExpiration(int expiration) voidsetGeneration(int generation) voidsetGenerationPolicy(GenerationPolicy generationPolicy) voidsetOnLockingOnly(boolean onLockingOnly) voidsetRecordExistsAction(RecordExistsAction recordExistsAction) voidsetRespondAllOps(boolean respondAllOps) voidsetXdr(boolean xdr) Methods inherited from class com.aerospike.client.policy.Policy
setCompress, setConnectTimeout, setFailOnFilteredOut, setFilterExp, setMaxRetries, setReadModeAP, setReadModeSC, setReadTouchTtlPercent, setReplica, setSendKey, setSleepBetweenRetries, setSocketTimeout, setTimeout, setTimeoutDelay, setTimeouts, setTotalTimeout, setTxn
-
Field Details
-
recordExistsAction
Qualify how to handle writes where the record already exists.Default: RecordExistsAction.UPDATE
-
generationPolicy
Qualify how to handle record writes based on record generation. The default (NONE) indicates that the generation is not used to restrict writes.The server does not support this field for UDF execute() calls. The read-modify-write usage model can still be enforced inside the UDF code itself.
Default: GenerationPolicy.NONE
-
commitLevel
Desired consistency guarantee when committing a command on the server. The default (COMMIT_ALL) indicates that the server should wait for master and all replica commits to be successful before returning success to the client.Default: CommitLevel.COMMIT_ALL
-
generation
public int generationExpected generation. Generation is the number of times a record has been modified (including creation) on the server. If a write operation is creating a record, the expected generation would be0. This field is only relevant when generationPolicy is not NONE.The server does not support this field for UDF execute() calls. The read-modify-write usage model can still be enforced inside the UDF code itself.
Default: 0
-
expiration
public int expirationRecord expiration. Also known as ttl (time to live). Seconds record will live before being removed by the server.Expiration values:
- -2: Do not change ttl when record is updated.
- -1: Never expire.
- 0: Default to namespace configuration variable "default-ttl" on the server.
- > 0: Actual ttl in seconds.
Default: 0
-
respondAllOps
public boolean respondAllOpsFor client operate(), return a result for every operation.Some operations do not return results by default (ListOperation.clear() for example). This can make it difficult to determine the desired result offset in the returned bin's result list.
Setting respondAllOps to true makes it easier to identify the desired result offset (result offset equals bin's operate sequence). If there is a map operation in operate(), respondAllOps will be forced to true for that operate() call.
Default: false
-
durableDelete
public boolean durableDeleteIf the command results in a record deletion, leave a tombstone for the record. This prevents deleted records from reappearing after node failures. Valid for Aerospike Server Enterprise Edition 3.10+ only.Default: false (do not tombstone deleted records).
-
onLockingOnly
public boolean onLockingOnlyExecute the write command only if the record is not already locked by this transaction. If this field is true and the record is already locked by this transaction, the command will throw an exception with theResultCode.MRT_ALREADY_LOCKEDerror code.This field is useful for safely retrying non-idempotent writes as an alternative to simply aborting the transaction. This field is not applicable to record delete commands.
Default: false.
-
xdr
public boolean xdrOperate in XDR mode. Some external connectors may need to emulate an XDR client. If enabled, an XDR bit is set for writes in the wire protocol.Default: false.
-
-
Constructor Details
-
WritePolicy
public WritePolicy(WritePolicy other, com.aerospike.client.configuration.ConfigurationProvider configProvider) Copy write policy from another write policy AND override certain policy attributes if they exist in the configProvider. Any policy overrides will not get logged. -
WritePolicy
public WritePolicy(WritePolicy other, com.aerospike.client.configuration.ConfigurationProvider configProvider, boolean isDefaultPolicy, String preText) Copy write policy from another write policy AND override certain policy attributes if they exist in the configProvider. Any default policy overrides will get logged. -
WritePolicy
Copy write policy from another write policy. -
WritePolicy
Copy write policy from another policy. -
WritePolicy
public WritePolicy()Default constructor.
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
setRecordExistsAction
-
setGenerationPolicy
-
setCommitLevel
-
setGeneration
public void setGeneration(int generation) -
setExpiration
public void setExpiration(int expiration) -
setRespondAllOps
public void setRespondAllOps(boolean respondAllOps) -
setDurableDelete
public void setDurableDelete(boolean durableDelete) -
setOnLockingOnly
public void setOnLockingOnly(boolean onLockingOnly) -
setXdr
public void setXdr(boolean xdr)
-