Interface SyncOxiaClient

All Superinterfaces:
AutoCloseable

public interface SyncOxiaClient extends AutoCloseable
Synchronous client for the Oxia service.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    delete(@NonNull String key)
    Unconditionally deletes the record associated with the key if the record exists.
    boolean
    delete(@NonNull String key, @NonNull Set<DeleteOption> options)
    Conditionally deletes the record associated with the key if the record exists, and the server's versionId of the record is as specified, at the instant when the delete is applied.
    void
    deleteRange(@NonNull String startKeyInclusive, @NonNull String endKeyExclusive)
    Deletes any records with keys within the specified range.
    void
    deleteRange(@NonNull String startKeyInclusive, @NonNull String endKeyExclusive, @NonNull Set<DeleteRangeOption> options)
    Deletes any records with keys within the specified range.
    get(@NonNull String key)
    Returns the record associated with the specified key.
    get(@NonNull String key, @NonNull Set<GetOption> options)
    Returns the record associated with the specified key.
    @NonNull List<String>
    list(@NonNull String startKeyInclusive, @NonNull String endKeyExclusive)
    Lists any existing keys within the specified range.
    @NonNull List<String>
    list(@NonNull String startKeyInclusive, @NonNull String endKeyExclusive, Set<ListOption> options)
    Lists any existing keys within the specified range.
    void
    notifications(@NonNull Consumer<Notification> notificationCallback)
    Registers a callback to receive Oxia record change notifications.
    put(@NonNull String key, byte @NonNull [] value)
    Associates a value with a key if the server's versionId of the record is as specified, at the instant when the put is applied.
    put(@NonNull String key, byte @NonNull [] value, Set<PutOption> options)
    Conditionally associates a value with a key if the server's versionId of the record is as specified, at the instant when the put is applied.
    rangeScan(@NonNull String startKeyInclusive, @NonNull String endKeyExclusive)
    Scan any existing records within the specified range of keys.
    rangeScan(@NonNull String startKeyInclusive, @NonNull String endKeyExclusive, Set<RangeScanOption> options)
    Scan any existing records within the specified range of keys.

    Methods inherited from interface java.lang.AutoCloseable

    close
  • Method Details

    • put

      PutResult put(@NonNull @NonNull String key, byte @NonNull [] value)
      Associates a value with a key if the server's versionId of the record is as specified, at the instant when the put is applied.
      Parameters:
      key - The key with which the value should be associated.
      value - The value to associate with the key.
      Returns:
      The result of the put at the specified key.
    • put

      PutResult put(@NonNull @NonNull String key, byte @NonNull [] value, Set<PutOption> options) throws UnexpectedVersionIdException
      Conditionally associates a value with a key if the server's versionId of the record is as specified, at the instant when the put is applied. The put will not be applied if the server's versionId of the record does not match the expectation set in the call. If you wish the put to succeed only if the key does not already exist on the server, then pass the Version.KeyNotExists value.
      Parameters:
      key - The key with which the value should be associated.
      value - The value to associate with the key.
      options - Set options for the put.
      Returns:
      The result of the put at the specified key.
      Throws:
      UnexpectedVersionIdException - The versionId at the server did not that match supplied in the call.
    • delete

      boolean delete(@NonNull @NonNull String key)
      Unconditionally deletes the record associated with the key if the record exists.
      Parameters:
      key - Deletes the record with the specified key.
      Returns:
      True if the key was actually present on the server, false otherwise.
    • delete

      boolean delete(@NonNull @NonNull String key, @NonNull @NonNull Set<DeleteOption> options) throws UnexpectedVersionIdException
      Conditionally deletes the record associated with the key if the record exists, and the server's versionId of the record is as specified, at the instant when the delete is applied. The delete will not be applied if the server's versionId of the record does not match the expectation set in the call.
      Parameters:
      key - Deletes the record with the specified key.
      options - Set options for the delete.
      Returns:
      True if the key was actually present on the server, false otherwise.
      Throws:
      UnexpectedVersionIdException - The versionId at the server did not that match supplied in the call.
    • deleteRange

      void deleteRange(@NonNull @NonNull String startKeyInclusive, @NonNull @NonNull String endKeyExclusive)
      Deletes any records with keys within the specified range. For more information on how keys are sorted, check the relevant section in the Oxia documentation.
      Parameters:
      startKeyInclusive - The key that declares start of the range, and is included from the range.
      endKeyExclusive - The key that declares the end of the range, and is excluded from the range.
    • deleteRange

      void deleteRange(@NonNull @NonNull String startKeyInclusive, @NonNull @NonNull String endKeyExclusive, @NonNull @NonNull Set<DeleteRangeOption> options)
      Deletes any records with keys within the specified range. For more information on how keys are sorted, check the relevant section in the Oxia documentation.
      Parameters:
      startKeyInclusive - The key that declares start of the range, and is included from the range.
      endKeyExclusive - The key that declares the end of the range, and is excluded from the range.
    • get

      GetResult get(@NonNull @NonNull String key)
      Returns the record associated with the specified key. The returned value includes the value, and other metadata.
      Parameters:
      key - The key associated with the record to be fetched.
      Returns:
      The value associated with the supplied key, or null if the key did not exist.
    • get

      GetResult get(@NonNull @NonNull String key, @NonNull @NonNull Set<GetOption> options)
      Returns the record associated with the specified key. The returned value includes the value, and other metadata.
      Parameters:
      key - The key associated with the record to be fetched.
      options - Set options for the get operation.
      Returns:
      The value associated with the supplied key, or null if the key did not exist.
    • list

      @NonNull @NonNull List<String> list(@NonNull @NonNull String startKeyInclusive, @NonNull @NonNull String endKeyExclusive)
      Lists any existing keys within the specified range. For more information on how keys are sorted, check the relevant section in the Oxia documentation.
      Parameters:
      startKeyInclusive - The key that declares start of the range, and is included from the range.
      endKeyExclusive - The key that declares the end of the range, and is excluded from the range.
      Returns:
      The list of keys that exist within the specified range, or an empty list if there were none.
    • list

      @NonNull @NonNull List<String> list(@NonNull @NonNull String startKeyInclusive, @NonNull @NonNull String endKeyExclusive, Set<ListOption> options)
      Lists any existing keys within the specified range. For more information on how keys are sorted, check the relevant section in the Oxia documentation.
      Parameters:
      startKeyInclusive - The key that declares start of the range, and is included from the range.
      endKeyExclusive - The key that declares the end of the range, and is excluded from the range.
      Returns:
      The list of keys that exist within the specified range, or an empty list if there were none.
    • rangeScan

      Iterable<GetResult> rangeScan(@NonNull @NonNull String startKeyInclusive, @NonNull @NonNull String endKeyExclusive)
      Scan any existing records within the specified range of keys.
      Parameters:
      startKeyInclusive - The key that declares start of the range, and is included from the range.
      endKeyExclusive - The key that declares the end of the range, and is excluded from the range.
      Returns:
      An iterable object that will provide all the records and their version objects.
    • rangeScan

      Iterable<GetResult> rangeScan(@NonNull @NonNull String startKeyInclusive, @NonNull @NonNull String endKeyExclusive, Set<RangeScanOption> options)
      Scan any existing records within the specified range of keys.
      Parameters:
      startKeyInclusive - The key that declares start of the range, and is included from the range.
      endKeyExclusive - The key that declares the end of the range, and is excluded from the range.
      options - the range scan options
      Returns:
      An iterable object that will provide all the records and their version objects.
    • notifications

      void notifications(@NonNull @NonNull Consumer<Notification> notificationCallback)
      Registers a callback to receive Oxia record change notifications. Multiple callbacks can be registered.
      Parameters:
      notificationCallback - A callback to receive notifications.