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
partitionKeyinstead of the record key, guaranteeing co-location of records that share the samepartitionKey. - UseIndex — available on
GetOption,ListOptionandRangeScanOption; follows a secondary index registered viaPutOption.SecondaryIndex. - IfVersionIdEquals / IfRecordDoesNotExist — conditional writes used for optimistic concurrency control.
-
InterfacesClassDescriptionOptions for deleting a record.Options for deleting a range of records.Options for getting a record.Options for getting sequence updates.Options for listing records.The PutOption interface defines a set of options for customizing the behavior of a "put" operation in a data store.RangeScanOption is a sealed interface that represents options for controlling range scan operations.