Class BatchWritePolicy

java.lang.Object
com.aerospike.client.policy.BatchWritePolicy

public final class BatchWritePolicy extends Object
Policy attributes used in batch write commands.
  • Field Details

    • filterExp

      public Expression filterExp
      Optional expression filter. If filterExp exists and evaluates to false, the specific batch key request is not performed and BatchRecord.resultCode is set to ResultCode.FILTERED_OUT.

      If exists, this filter overrides the batch parent filter Policy.filterExp for the specific key in batch commands that allow a different policy per key. Otherwise, this filter is ignored.

      Default: null

    • recordExistsAction

      public RecordExistsAction recordExistsAction
      Qualify how to handle writes where the record already exists.

      Default: RecordExistsAction.UPDATE

    • commitLevel

      public CommitLevel 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

    • generationPolicy

      public GenerationPolicy 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

    • generation

      public int generation
      Expected 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 be 0. 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 expiration
      Record 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

    • durableDelete

      public boolean durableDelete
      If 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 only.

      Default: false (do not tombstone deleted records).

    • sendKey

      public boolean sendKey
      Send user defined key in addition to hash digest. If true, the key will be stored with the record on the server.

      Default: false (do not send the user defined key)

  • Constructor Details

    • BatchWritePolicy

      public BatchWritePolicy(BatchWritePolicy other)
      Copy constructor.
    • BatchWritePolicy

      public BatchWritePolicy()
      Default constructor.
  • Method Details

    • setFilterExp

      public void setFilterExp(Expression filterExp)
    • setRecordExistsAction

      public void setRecordExistsAction(RecordExistsAction recordExistsAction)
    • setCommitLevel

      public void setCommitLevel(CommitLevel commitLevel)
    • setGenerationPolicy

      public void setGenerationPolicy(GenerationPolicy generationPolicy)
    • setGeneration

      public void setGeneration(int generation)
    • setExpiration

      public void setExpiration(int expiration)
    • setDurableDelete

      public void setDurableDelete(boolean durableDelete)
    • setSendKey

      public void setSendKey(boolean sendKey)