Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import lombok.NonNull;

/** Asynchronous client for the Oxia service. */
public interface AsyncOxiaClient extends AutoCloseable {
Expand All @@ -41,7 +40,6 @@ public interface AsyncOxiaClient extends AutoCloseable {
* UnexpectedVersionIdException} if the versionId at the server did not that match supplied in
* the call.
*/
@NonNull
CompletableFuture<PutResult> put(String key, byte[] value, Set<PutOption> options);

/**
Expand All @@ -54,7 +52,6 @@ public interface AsyncOxiaClient extends AutoCloseable {
* @return The result of the put at the specified key. Supplied via a future that returns the
* {@link PutResult}.
*/
@NonNull
CompletableFuture<PutResult> put(String key, byte[] value);

/**
Expand All @@ -70,7 +67,6 @@ public interface AsyncOxiaClient extends AutoCloseable {
* future will complete exceptionally with an {@link UnexpectedVersionIdException} the
* versionId at the server did not that match supplied in the call.
*/
@NonNull
CompletableFuture<Boolean> delete(String key, Set<DeleteOption> options);

/**
Expand All @@ -80,7 +76,6 @@ public interface AsyncOxiaClient extends AutoCloseable {
* @return A future that completes when the delete call has returned. The future can return a flag
* that will be true if the key was actually present on the server, false otherwise.
*/
@NonNull
CompletableFuture<Boolean> delete(String key);

/**
Expand All @@ -95,7 +90,6 @@ public interface AsyncOxiaClient extends AutoCloseable {
* the range.
* @return A future that completes when the delete call has returned.
*/
@NonNull
CompletableFuture<Void> deleteRange(String startKeyInclusive, String endKeyExclusive);

/**
Expand All @@ -110,7 +104,6 @@ public interface AsyncOxiaClient extends AutoCloseable {
* the range.
* @return A future that completes when the delete call has returned.
*/
@NonNull
CompletableFuture<Void> deleteRange(
String startKeyInclusive, String endKeyExclusive, Set<DeleteRangeOption> options);

Expand All @@ -122,7 +115,6 @@ CompletableFuture<Void> deleteRange(
* @return The value associated with the supplied key, or {@code null} if the key did not exist.
* Supplied via a future returning a {@link GetResult}.
*/
@NonNull
CompletableFuture<GetResult> get(String key);

/**
Expand All @@ -134,7 +126,6 @@ CompletableFuture<Void> deleteRange(
* @return The value associated with the supplied key, or {@code null} if the key did not exist.
* Supplied via a future returning a {@link GetResult}.
*/
@NonNull
CompletableFuture<GetResult> get(String key, Set<GetOption> options);

/**
Expand All @@ -150,7 +141,6 @@ CompletableFuture<Void> deleteRange(
* @return The list of keys that exist within the specified range or an empty list if there were
* none. Supplied via a future.
*/
@NonNull
CompletableFuture<List<String>> list(String startKeyInclusive, String endKeyExclusive);

/**
Expand All @@ -166,7 +156,6 @@ CompletableFuture<Void> deleteRange(
* @return The list of keys that exist within the specified range or an empty list if there were
* none. Supplied via a future.
*/
@NonNull
CompletableFuture<List<String>> list(
String startKeyInclusive, String endKeyExclusive, Set<ListOption> options);

Expand All @@ -179,10 +168,7 @@ CompletableFuture<List<String>> list(
* the range.
* @param consumer A {@link RangeScanConsumer} that will be invoked with the records or errors.
*/
void rangeScan(
@NonNull String startKeyInclusive,
@NonNull String endKeyExclusive,
@NonNull RangeScanConsumer consumer);
void rangeScan(String startKeyInclusive, String endKeyExclusive, RangeScanConsumer consumer);

/**
* Scan any existing records within the specified range of keys.
Expand All @@ -195,18 +181,18 @@ void rangeScan(
* @param options the range scan options
*/
void rangeScan(
@NonNull String startKeyInclusive,
@NonNull String endKeyExclusive,
@NonNull RangeScanConsumer consumer,
@NonNull Set<RangeScanOption> options);
String startKeyInclusive,
String endKeyExclusive,
RangeScanConsumer consumer,
Set<RangeScanOption> options);

/**
* Registers a callback to receive Oxia {@link Notification record change notifications}. Multiple
* callbacks can be registered.
*
* @param notificationCallback A callback to receive notifications.
*/
void notifications(@NonNull Consumer<Notification> notificationCallback);
void notifications(Consumer<Notification> notificationCallback);

/**
* GetSequenceUpdates allows to subscribe to the updates happening on a sequential key The channel
Expand All @@ -219,7 +205,5 @@ void rangeScan(
* @return
*/
Closeable getSequenceUpdates(
@NonNull String key,
@NonNull Consumer<String> listener,
@NonNull Set<GetSequenceUpdatesOption> options);
String key, Consumer<String> listener, Set<GetSequenceUpdatesOption> options);
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package io.oxia.client.api;

import lombok.NonNull;

public sealed interface DeleteOption permits OptionPartitionKey, OptionVersionId {

static DeleteOption IfVersionIdEquals(long versionId) {
Expand All @@ -32,7 +30,7 @@ static DeleteOption IfVersionIdEquals(long versionId) {
*
* @param partitionKey the partition key to use
*/
static DeleteOption PartitionKey(@NonNull String partitionKey) {
static DeleteOption PartitionKey(String partitionKey) {
return new OptionPartitionKey(partitionKey);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package io.oxia.client.api;

import lombok.NonNull;

public sealed interface DeleteRangeOption permits OptionPartitionKey {

/**
Expand All @@ -28,7 +26,7 @@ public sealed interface DeleteRangeOption permits OptionPartitionKey {
*
* @param partitionKey the partition key to use
*/
static DeleteRangeOption PartitionKey(@NonNull String partitionKey) {
static DeleteRangeOption PartitionKey(String partitionKey) {
return new OptionPartitionKey(partitionKey);
}
}
6 changes: 2 additions & 4 deletions client-api/src/main/java/io/oxia/client/api/GetOption.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package io.oxia.client.api;

import lombok.NonNull;

public sealed interface GetOption
permits OptionComparisonType, OptionIncludeValue, OptionPartitionKey, OptionSecondaryIndexName {

Expand Down Expand Up @@ -63,7 +61,7 @@ public sealed interface GetOption
*
* @param partitionKey the partition key to use
*/
static GetOption PartitionKey(@NonNull String partitionKey) {
static GetOption PartitionKey(String partitionKey) {
return new OptionPartitionKey(partitionKey);
}

Expand All @@ -86,7 +84,7 @@ static GetOption IncludeValue(boolean includeValue) {
*
* @param secondaryIndexName the name of the secondary index to use for the list operation
*/
static GetOption UseIndex(@NonNull String secondaryIndexName) {
static GetOption UseIndex(String secondaryIndexName) {
return new OptionSecondaryIndexName(secondaryIndexName);
}
}
7 changes: 3 additions & 4 deletions client-api/src/main/java/io/oxia/client/api/GetResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@
*/
package io.oxia.client.api;

import lombok.NonNull;
import lombok.Value;

/** The result of a client get request. */
@Value
public class GetResult {

/** The key associated with the record. */
@NonNull String key;
String key;

/** The value associated with the key specified in the call. */
@NonNull byte[] value;
byte[] value;

/** Metadata for the record associated with the key specified in the call. */
@NonNull Version version;
Version version;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package io.oxia.client.api;

import lombok.NonNull;

public sealed interface GetSequenceUpdatesOption permits OptionPartitionKey {

/**
Expand All @@ -28,7 +26,7 @@ public sealed interface GetSequenceUpdatesOption permits OptionPartitionKey {
*
* @param partitionKey the partition key to use
*/
static GetSequenceUpdatesOption PartitionKey(@NonNull String partitionKey) {
static GetSequenceUpdatesOption PartitionKey(String partitionKey) {
return new OptionPartitionKey(partitionKey);
}
}
6 changes: 2 additions & 4 deletions client-api/src/main/java/io/oxia/client/api/ListOption.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package io.oxia.client.api;

import lombok.NonNull;

public sealed interface ListOption permits OptionPartitionKey, OptionSecondaryIndexName {

/**
Expand All @@ -28,7 +26,7 @@ public sealed interface ListOption permits OptionPartitionKey, OptionSecondaryIn
*
* @param partitionKey the partition key to use
*/
static ListOption PartitionKey(@NonNull String partitionKey) {
static ListOption PartitionKey(String partitionKey) {
return new OptionPartitionKey(partitionKey);
}

Expand All @@ -39,7 +37,7 @@ static ListOption PartitionKey(@NonNull String partitionKey) {
*
* @param secondaryIndexName the name of the secondary index to use for the list operation
*/
static ListOption UseIndex(@NonNull String secondaryIndexName) {
static ListOption UseIndex(String secondaryIndexName) {
return new OptionSecondaryIndexName(secondaryIndexName);
}
}
11 changes: 4 additions & 7 deletions client-api/src/main/java/io/oxia/client/api/Notification.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package io.oxia.client.api;

import lombok.NonNull;

/** A notification from an Oxia server indicating a change to a record associated with a key. */
public sealed interface Notification
permits Notification.KeyCreated,
Expand All @@ -35,7 +33,7 @@ public sealed interface Notification
* @param key The key of the record created.
* @param version The versionId of the new record.
*/
record KeyCreated(@NonNull String key, long version) implements Notification {
record KeyCreated(String key, long version) implements Notification {
public KeyCreated {
Version.requireValidVersionId(version);
}
Expand All @@ -47,7 +45,7 @@ record KeyCreated(@NonNull String key, long version) implements Notification {
* @param key The key of the record modified.
* @param version The versionId of the record after the modification.
*/
record KeyModified(@NonNull String key, long version) implements Notification {
record KeyModified(String key, long version) implements Notification {
public KeyModified {
Version.requireValidVersionId(version);
}
Expand All @@ -58,16 +56,15 @@ record KeyModified(@NonNull String key, long version) implements Notification {
*
* @param key The key of the deleted record.
*/
record KeyDeleted(@NonNull String key) implements Notification {}
record KeyDeleted(String key) implements Notification {}

/**
* The record associated with the key range has been deleted.
*
* @param startKeyInclusive The range deletion start key. (inclusive)
* @param endKeyExclusive The range deletion end key. (exclusive)
*/
record KeyRangeDelete(@NonNull String startKeyInclusive, @NonNull String endKeyExclusive)
implements Notification {
record KeyRangeDelete(String startKeyInclusive, String endKeyExclusive) implements Notification {
@Override
public String key() {
return startKeyInclusive;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@
package io.oxia.client.api;

import java.util.List;
import lombok.NonNull;

public record OptionSequenceKeysDeltas(@NonNull List<Long> sequenceKeysDeltas)
implements PutOption {
public record OptionSequenceKeysDeltas(List<Long> sequenceKeysDeltas) implements PutOption {
public OptionSequenceKeysDeltas {
if (sequenceKeysDeltas.isEmpty()) {
throw new IllegalArgumentException("Sequence keys deltas cannot be empty");
Expand Down
7 changes: 3 additions & 4 deletions client-api/src/main/java/io/oxia/client/api/PutOption.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import java.util.List;
import java.util.Set;
import lombok.NonNull;

public sealed interface PutOption
permits OptionEphemeral,
Expand All @@ -42,7 +41,7 @@ static OptionVersionId.OptionVersionIdEqual IfVersionIdEquals(long versionId) {
*
* @param partitionKey the partition key to use
*/
static PutOption PartitionKey(@NonNull String partitionKey) {
static PutOption PartitionKey(String partitionKey) {
return new OptionPartitionKey(partitionKey);
}

Expand All @@ -57,7 +56,7 @@ static PutOption PartitionKey(@NonNull String partitionKey) {
* @param sequenceKeysDeltas
* @return
*/
static PutOption SequenceKeysDeltas(@NonNull List<Long> sequenceKeysDeltas) {
static PutOption SequenceKeysDeltas(List<Long> sequenceKeysDeltas) {
return new OptionSequenceKeysDeltas(sequenceKeysDeltas);
}

Expand All @@ -75,7 +74,7 @@ static PutOption SequenceKeysDeltas(@NonNull List<Long> sequenceKeysDeltas) {
* @param secondaryKey the secondary key for this record
* @return
*/
static PutOption SecondaryIndex(@NonNull String indexName, String secondaryKey) {
static PutOption SecondaryIndex(String indexName, String secondaryKey) {
return new OptionSecondaryIndex(indexName, secondaryKey);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
*/
package io.oxia.client.api;

import lombok.NonNull;

/**
* The result of a client get request.
*
* @param key the effective key stored in Oxia
* @param version Metadata for the record associated with the key specified in the call.
*/
public record PutResult(@NonNull String key, @NonNull Version version) {}
public record PutResult(String key, Version version) {}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
*/
package io.oxia.client.api;

import lombok.NonNull;

public sealed interface RangeScanOption permits OptionPartitionKey, OptionSecondaryIndexName {

/**
Expand All @@ -28,7 +26,7 @@ public sealed interface RangeScanOption permits OptionPartitionKey, OptionSecond
*
* @param partitionKey the partition key to use
*/
static RangeScanOption PartitionKey(@NonNull String partitionKey) {
static RangeScanOption PartitionKey(String partitionKey) {
return new OptionPartitionKey(partitionKey);
}

Expand All @@ -38,7 +36,7 @@ static RangeScanOption PartitionKey(@NonNull String partitionKey) {
* @param secondaryIndexName the name of the secondary index to use
* @return
*/
static RangeScanOption UseIndex(@NonNull String secondaryIndexName) {
static RangeScanOption UseIndex(String secondaryIndexName) {
return new OptionSecondaryIndexName(secondaryIndexName);
}
}
Loading