Package io.oxia.client.api.options


package io.oxia.client.api.options
Per-operation options for the Oxia client.

Every option is a marker or a value type implementing one of the operation-specific marker interfaces (PutOption, GetOption, DeleteOption, DeleteRangeOption, ListOption, RangeScanOption, GetSequenceUpdatesOption). They are passed to client methods as a Set, so multiple compatible options can be combined.

Examples


 // Insert only if the key is new.
 client.put("k", value, Set.of(PutOption.IfRecordDoesNotExist));

 // Compare-and-swap with a known versionId.
 client.put("k", value, Set.of(PutOption.IfVersionIdEquals(currentVersionId)));

 // Co-locate records under the same partition and add a secondary index.
 client.put("k", value, Set.of(
         PutOption.PartitionKey("tenant-1"),
         PutOption.SecondaryIndex("by-name", "alice")));

 // Read using a comparison instead of equality (find the floor key).
 GetResult floor = client.get("k", Set.of(GetOption.ComparisonFloor));

 // Read by following a secondary index.
 GetResult byName = client.get("alice", Set.of(GetOption.UseIndex("by-name")));
 

Common options

  • PartitionKey — available on every operation. Routes the call to the shard determined by partitionKey instead of the record key, guaranteeing co-location of records that share the same partitionKey.
  • UseIndex — available on GetOption, ListOption and RangeScanOption; follows a secondary index registered via PutOption.SecondaryIndex.
  • IfVersionIdEquals / IfRecordDoesNotExist — conditional writes used for optimistic concurrency control.