-
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.
Get protocol string constants from Rust instead of hard-coding them
- Loading branch information
Showing
5 changed files
with
212 additions
and
13 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
11 changes: 11 additions & 0 deletions
11
java/client/src/main/java/glide/ffi/resolvers/ClusterScanCursorResolver.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 |
---|---|---|
@@ -1,11 +1,22 @@ | ||
/** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ | ||
package glide.ffi.resolvers; | ||
|
||
import glide.managers.CommandManager; | ||
|
||
/** | ||
* Helper class for invoking JNI resources for {@link CommandManager.ClusterScanCursorDetail} | ||
* implementations. | ||
*/ | ||
public final class ClusterScanCursorResolver { | ||
public static final String FINISHED_CURSOR_HANDLE; | ||
|
||
// TODO: consider lazy loading the glide_rs library | ||
static { | ||
NativeUtils.loadGlideLib(); | ||
FINISHED_CURSOR_HANDLE = getFinishedCursorHandleConstant(); | ||
} | ||
|
||
public static native void releaseNativeCursor(String cursor); | ||
|
||
public static native String getFinishedCursorHandleConstant(); | ||
} |
37 changes: 37 additions & 0 deletions
37
java/client/src/main/java/glide/ffi/resolvers/ObjectTypeResolver.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,37 @@ | ||
/** Copyright Valkey GLIDE Project Contributors - SPDX Identifier: Apache-2.0 */ | ||
package glide.ffi.resolvers; | ||
|
||
import glide.api.models.commands.scan.ScanOptions; | ||
|
||
/** Helper class for invoking JNI resources for the {@link ScanOptions.ObjectType} enum. */ | ||
public class ObjectTypeResolver { | ||
public static final String OBJECT_TYPE_STRING_NATIVE_NAME; | ||
public static final String OBJECT_TYPE_LIST_NATIVE_NAME; | ||
public static final String OBJECT_TYPE_SET_NATIVE_NAME; | ||
public static final String OBJECT_TYPE_ZSET_NATIVE_NAME; | ||
public static final String OBJECT_TYPE_HASH_NATIVE_NAME; | ||
public static final String OBJECT_TYPE_STREAM_NATIVE_NAME; | ||
|
||
// TODO: consider lazy loading the glide_rs library | ||
static { | ||
NativeUtils.loadGlideLib(); | ||
OBJECT_TYPE_STRING_NATIVE_NAME = getTypeStringConstant(); | ||
OBJECT_TYPE_LIST_NATIVE_NAME = getTypeListConstant(); | ||
OBJECT_TYPE_SET_NATIVE_NAME = getTypeSetConstant(); | ||
OBJECT_TYPE_ZSET_NATIVE_NAME = getTypeZSetConstant(); | ||
OBJECT_TYPE_HASH_NATIVE_NAME = getTypeHashConstant(); | ||
OBJECT_TYPE_STREAM_NATIVE_NAME = getTypeStreamConstant(); | ||
} | ||
|
||
public static native String getTypeStringConstant(); | ||
|
||
public static native String getTypeListConstant(); | ||
|
||
public static native String getTypeSetConstant(); | ||
|
||
public static native String getTypeZSetConstant(); | ||
|
||
public static native String getTypeHashConstant(); | ||
|
||
public static native String getTypeStreamConstant(); | ||
} |
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