Initializes a new WritePolicy from the provided policy values.
Optionalprops: WritePolicyOptionsWritePolicy values
OptionalcommitSpecifies the number of replicas required to be committed successfully when writing before returning command succeeded.
policy.commitLevel for supported policy values.
OptionalcompressUse zlib compression on write or batch read commands when the command buffer size is greater than 128 bytes. In addition, tell the server to compress it's response on read commands. The server response compression threshold is also 128 bytes.
This option will increase cpu and memory usage (for extra compressed buffers), but decrease the size of data sent over the network.
Requires Enterprise Server version >= 4.8.
@default: false
OptionalcompressionMinimum record size beyond which it is compressed and sent to the server.
OptionalconnectSocket connect timeout in milliseconds. If connect_timeout greater than zero, it will be applied to creating a connection plus optional user authentication. Otherwise, socket_timeout or total_timeout will be used depending on their values.
If connect, socket and total timeouts are zero, the actual socket connect timeout is hard-coded to 2000ms.
connect_timeout is useful when new connection creation is expensive (ie TLS connections) and it's acceptable to allow extra time to create a new connection compared to using an existing connection from the pool.
@default: 0
OptionaldurableSpecifies whether a http://www.aerospike.com/docs/guide/durable_deletes.html|tombstone should be written in place of a record that gets deleted as a result of this command.
OptionalexistsSpecifies the behavior for the existence of the record.
policy.exists for supported policy values.
OptionalfilterOptional expression filter. If filter exp exists and evaluates to false, the command is ignored. This can be used to eliminate a client/server roundtrip in some cases.
expression filters can only be applied to the following commands:
OptionalgenSpecifies the behavior for the generation value.
policy.gen for supported policy values.
OptionalkeySpecifies the behavior for the key.
policy.key for supported policy values.
OptionalmaxMaximum number of retries before aborting the current command. The initial attempt is not counted as a retry.
If maxRetries is exceeded, the command will return error ERR_TIMEOUT.
WARNING: Database writes that are not idempotent (such as "add") should not be retried because the write command may be performed multiple times if the client timed out previous command attempts. It is important to use a distinct write policy for non-idempotent writes which sets maxRetries to zero.
@default: 2 (initial attempt + 2 retries = 3 attempts)
OptionalonExecute 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 return MRT_ALREADY_LOCKED.
This field is useful for safely retrying non-idempotent writes as an alternative to simply aborting the transaction.
Default: false.
OptionalreplicaAlgorithm used to determine target node.
policy.replica for supported policy values.
OptionalsocketSocket idle timeout in milliseconds when processing a database command.
If socketTimeout is not zero and the socket has been idle for at least socketTimeout, both maxRetries and totalTimeout are checked. If maxRetries and totalTimeout are not exceeded, the command is retried.
If both socketTimeout and totalTimeout are non-zero and socketTimeout > totalTimeout, then socketTimeout will be set to totalTimeout. If socketTimeout is zero, there will be no socket idle limit.
OptionaltimeoutNumber of milliseconds to wait after a socket read times out before closing the socket for good. If set to zero, this feature will be disabled.
If, upon performing a database operation, the host finds the socket it was using timing out while reading, the client will receive a timeout error. However, we don't always want to close that socket right away; doing so introduces unwanted latencies. It might be possible to recover the socket, thus saving the socket for future re-use.
The socket will be closed only if it could not be successfully recovered within timeout_delay milliseconds of the original timeout. If this is set to zero, the socket may be closed right away, effectively disabling this feature.
Please note that this feature only applies to sockets being read; write timeouts are not affected by this setting. Also, this feature does not apply to pipeline connections.
OptionaltotalTotal command timeout in milliseconds.
The totalTimeout is tracked on the client and sent to the server along with the command in the wire protocol. The client will most likely timeout first, but the server also has the capability to timeout the command
If totalTimeout is not zero and totalTimeout is reached before the command completes, the command will return error ERR_TIMEOUT. If totalTimeout is zero, there will be no total time limit.
OptionaltxnTransaction identifier. See Transaction for more information.
A policy affecting the behavior of write commands.
Since
v3.0.0