-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed the API to support binary transaction (#1731)
* Changed the API to support binary transaction In addition, the following commands are modified to support it: customCommand, echo, ping, del, get, getdel, getex, set, append, mget, mset, msetnx, incr, incrBy, incrByFloat, decr, decrBy, strlen, setrange , getrange, hget, hset, hsetnx, hdel, hlen, hvals, hmget, spopCount * Temporarily disable large-values tests * ArgsBuilder now collects all arguments and returns `GlideString[]` Restored large value tests
- Loading branch information
1 parent
fbbcb17
commit 111de9f
Showing
9 changed files
with
630 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
java/client/src/main/java/glide/api/models/ArgsBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ | ||
package glide.api.models; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* Helper class for collecting arbitrary type of arguments and stores them as an array of | ||
* GlideString | ||
*/ | ||
public class ArgsBuilder { | ||
ArrayList<GlideString> argumentsList = null; | ||
|
||
public ArgsBuilder() { | ||
argumentsList = new ArrayList<>(); | ||
} | ||
|
||
public <ArgType> ArgsBuilder add(ArgType[] args) { | ||
for (ArgType arg : args) { | ||
argumentsList.add(GlideString.of(arg)); | ||
} | ||
|
||
return this; | ||
} | ||
|
||
public <ArgType> ArgsBuilder add(ArgType arg) { | ||
argumentsList.add(GlideString.of(arg)); | ||
return this; | ||
} | ||
|
||
public ArgsBuilder add(String[] args) { | ||
for (String arg : args) { | ||
argumentsList.add(GlideString.of(arg)); | ||
} | ||
return this; | ||
} | ||
|
||
public GlideString[] toArray() { | ||
return argumentsList.toArray(new GlideString[0]); | ||
} | ||
} |
Oops, something went wrong.