Package glide.internal
Class GlideNativeBridge
- java.lang.Object
-
- glide.internal.GlideNativeBridge
-
public class GlideNativeBridge extends java.lang.ObjectNative bridge for the Valkey client. Methods expose a handle-based API for safe cross-language operations.
-
-
Constructor Summary
Constructors Constructor Description GlideNativeBridge()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcloseClient(long clientPtr)Close and release a native clientstatic longcreateClient(byte[] connectionRequestBytes, AddressResolver addressResolver)Create a new native client instance.static voidexecuteBatchAsync(long clientPtr, byte[] batchRequestBytes, boolean expectUtf8Response, long callbackId)Execute batch (pipeline/transaction) asynchronouslystatic voidexecuteBinaryCommandAsync(long clientPtr, byte[] requestBytes, long callbackId)Execute binary command with mixed String/byte[] arguments asynchronouslystatic voidexecuteClusterScanAsync(long clientPtr, java.lang.String cursorId, java.lang.String matchPattern, long count, java.lang.String objectType, boolean expectUtf8Response, long callbackId)Execute cluster scan command asynchronouslystatic voidexecuteCommandAsync(long clientPtr, byte[] requestBytes, long callbackId)Execute command asynchronouslystatic voidexecuteScriptAsync(long clientPtr, long callbackId, java.lang.String hash, byte[][] keys, byte[][] args, boolean hasRoute, int routeType, java.lang.String routeParam, boolean expectUtf8Response)Execute script asynchronously using glide-core's invoke_scriptstatic voidgetCacheMetrics(long clientPtr, long callbackId, int metricsType)Get cache metricsstatic java.lang.StringgetClientInfo(long clientPtr)Get client information from native layerstatic longgetGlideCoreDefaultConnectionTimeoutMs()Get glide-core default connection timeout in millisecondsstatic intgetGlideCoreDefaultMaxInflightRequests()Get glide-core default maximum inflight requests limitstatic longgetGlideCoreDefaultRequestTimeoutMs()Get glide-core default request timeout in millisecondsstatic booleanisConnected(long clientPtr)Check if the native client is connectedstatic voidmarkTimedOut(long callbackId)Mark a callback as timed out on the native side.static voidrefreshIamToken(long clientPtr, long callbackId)Refresh the IAM authentication token.static voidupdateConnectionPassword(long clientPtr, java.lang.String password, boolean immediateAuth, long callbackId)Update the connection password with optional immediate authentication.
-
-
-
Method Detail
-
createClient
public static long createClient(byte[] connectionRequestBytes, AddressResolver addressResolver)Create a new native client instance.If an AddressResolver is provided, it will be stored as a global reference on the native side to prevent garbage collection while the client is alive. The resolver will be called from any thread when address resolution is needed.
- Parameters:
connectionRequestBytes- Protobuf-encoded ConnectionRequestaddressResolver- The address resolver callback, or null if not needed- Returns:
- Native client handle, or 0 on failure
-
executeCommandAsync
public static void executeCommandAsync(long clientPtr, byte[] requestBytes, long callbackId)Execute command asynchronously
-
executeBinaryCommandAsync
public static void executeBinaryCommandAsync(long clientPtr, byte[] requestBytes, long callbackId)Execute binary command with mixed String/byte[] arguments asynchronously
-
executeBatchAsync
public static void executeBatchAsync(long clientPtr, byte[] batchRequestBytes, boolean expectUtf8Response, long callbackId)Execute batch (pipeline/transaction) asynchronously
-
updateConnectionPassword
public static void updateConnectionPassword(long clientPtr, java.lang.String password, boolean immediateAuth, long callbackId)Update the connection password with optional immediate authentication.
-
refreshIamToken
public static void refreshIamToken(long clientPtr, long callbackId)Refresh the IAM authentication token.
-
isConnected
public static boolean isConnected(long clientPtr)
Check if the native client is connected
-
getClientInfo
public static java.lang.String getClientInfo(long clientPtr)
Get client information from native layer
-
closeClient
public static void closeClient(long clientPtr)
Close and release a native client
-
executeScriptAsync
public static void executeScriptAsync(long clientPtr, long callbackId, java.lang.String hash, byte[][] keys, byte[][] args, boolean hasRoute, int routeType, java.lang.String routeParam, boolean expectUtf8Response)Execute script asynchronously using glide-core's invoke_script
-
getGlideCoreDefaultConnectionTimeoutMs
public static long getGlideCoreDefaultConnectionTimeoutMs()
Get glide-core default connection timeout in milliseconds
-
getGlideCoreDefaultRequestTimeoutMs
public static long getGlideCoreDefaultRequestTimeoutMs()
Get glide-core default request timeout in milliseconds
-
getGlideCoreDefaultMaxInflightRequests
public static int getGlideCoreDefaultMaxInflightRequests()
Get glide-core default maximum inflight requests limit
-
executeClusterScanAsync
public static void executeClusterScanAsync(long clientPtr, java.lang.String cursorId, java.lang.String matchPattern, long count, java.lang.String objectType, boolean expectUtf8Response, long callbackId)Execute cluster scan command asynchronously
-
markTimedOut
public static void markTimedOut(long callbackId)
Mark a callback as timed out on the native side.
-
getCacheMetrics
public static void getCacheMetrics(long clientPtr, long callbackId, int metricsType)Get cache metrics
-
-