Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java: new xautoclaim #408

Closed
wants to merge 17 commits into from
Closed
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
137 changes: 137 additions & 0 deletions java/client/src/main/java/glide/api/BaseClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static glide.api.models.commands.bitmap.BitFieldOptions.createBitFieldArgs;
import static glide.api.models.commands.bitmap.BitFieldOptions.createBitFieldGlideStringArgs;
import static glide.api.models.commands.stream.StreamClaimOptions.JUST_ID_REDIS_API;
import static glide.api.models.commands.stream.StreamReadOptions.READ_COUNT_REDIS_API;
import static glide.ffi.resolvers.SocketListenerResolver.getSocket;
import static glide.utils.ArrayTransformUtils.cast3DArray;
import static glide.utils.ArrayTransformUtils.castArray;
Expand Down Expand Up @@ -139,6 +140,7 @@
import static redis_request.RedisRequestOuterClass.RequestType.Watch;
import static redis_request.RedisRequestOuterClass.RequestType.XAck;
import static redis_request.RedisRequestOuterClass.RequestType.XAdd;
import static redis_request.RedisRequestOuterClass.RequestType.XAutoClaim;
import static redis_request.RedisRequestOuterClass.RequestType.XClaim;
import static redis_request.RedisRequestOuterClass.RequestType.XDel;
import static redis_request.RedisRequestOuterClass.RequestType.XGroupCreate;
Expand Down Expand Up @@ -2794,6 +2796,141 @@ public CompletableFuture<Map<GlideString, Object>[]> xinfoConsumers(
response -> castArray(handleArrayResponseBinary(response), Map.class));
}

@Override
public CompletableFuture<Object[]> xautoclaim(
@NonNull String key,
@NonNull String group,
@NonNull String consumer,
long minIdleTime,
@NonNull String start) {
String[] args = new String[] {key, group, consumer, Long.toString(minIdleTime), start};
return commandManager.submitNewCommand(XAutoClaim, args, this::handleArrayResponse);
}

@Override
public CompletableFuture<Object[]> xautoclaim(
@NonNull GlideString key,
@NonNull GlideString group,
@NonNull GlideString consumer,
long minIdleTime,
@NonNull GlideString start) {
GlideString[] args =
new GlideString[] {key, group, consumer, gs(Long.toString(minIdleTime)), start};
return commandManager.submitNewCommand(XAutoClaim, args, this::handleArrayResponseBinary);
}

@Override
public CompletableFuture<Object[]> xautoclaim(
@NonNull String key,
@NonNull String group,
@NonNull String consumer,
long minIdleTime,
@NonNull String start,
long count) {
String[] args =
new String[] {
key,
group,
consumer,
Long.toString(minIdleTime),
start,
READ_COUNT_REDIS_API,
Long.toString(count)
};
return commandManager.submitNewCommand(XAutoClaim, args, this::handleArrayResponse);
}

@Override
public CompletableFuture<Object[]> xautoclaim(
@NonNull GlideString key,
@NonNull GlideString group,
@NonNull GlideString consumer,
long minIdleTime,
@NonNull GlideString start,
long count) {
GlideString[] args =
new GlideString[] {
key,
group,
consumer,
gs(Long.toString(minIdleTime)),
start,
gs(READ_COUNT_REDIS_API),
gs(Long.toString(count))
};
return commandManager.submitNewCommand(XAutoClaim, args, this::handleArrayResponseBinary);
}

@Override
public CompletableFuture<Object[]> xautoclaimJustId(
@NonNull String key,
@NonNull String group,
@NonNull String consumer,
long minIdleTime,
@NonNull String start) {
String[] args =
new String[] {key, group, consumer, Long.toString(minIdleTime), start, JUST_ID_REDIS_API};
return commandManager.submitNewCommand(XAutoClaim, args, this::handleArrayResponse);
}

@Override
public CompletableFuture<Object[]> xautoclaimJustId(
@NonNull GlideString key,
@NonNull GlideString group,
@NonNull GlideString consumer,
long minIdleTime,
@NonNull GlideString start) {
GlideString[] args =
new GlideString[] {
key, group, consumer, gs(Long.toString(minIdleTime)), start, gs(JUST_ID_REDIS_API)
};
return commandManager.submitNewCommand(XAutoClaim, args, this::handleArrayResponseBinary);
}

@Override
public CompletableFuture<Object[]> xautoclaimJustId(
@NonNull String key,
@NonNull String group,
@NonNull String consumer,
long minIdleTime,
@NonNull String start,
long count) {
String[] args =
new String[] {
key,
group,
consumer,
Long.toString(minIdleTime),
start,
READ_COUNT_REDIS_API,
Long.toString(count),
JUST_ID_REDIS_API
};
return commandManager.submitNewCommand(XAutoClaim, args, this::handleArrayResponse);
}

@Override
public CompletableFuture<Object[]> xautoclaimJustId(
@NonNull GlideString key,
@NonNull GlideString group,
@NonNull GlideString consumer,
long minIdleTime,
@NonNull GlideString start,
long count) {
GlideString[] args =
new GlideString[] {
key,
group,
consumer,
gs(Long.toString(minIdleTime)),
start,
gs(READ_COUNT_REDIS_API),
gs(Long.toString(count)),
gs(JUST_ID_REDIS_API)
};
return commandManager.submitNewCommand(XAutoClaim, args, this::handleArrayResponseBinary);
}

@Override
public CompletableFuture<Long> pttl(@NonNull String key) {
return commandManager.submitNewCommand(PTTL, new String[] {key}, this::handleLongResponse);
Expand Down
Loading
Loading