You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,8 @@
23
23
* Node: Add OpenTelemetry parent span context propagation support ([#4655](https://github.com/valkey-io/valkey-glide/issues/4655))
24
24
* JAVA: Add cluster information and topology commands (CLUSTER INFO, CLUSTER NODES, CLUSTER SHARDS, CLUSTER LINKS, CLUSTER MYID, CLUSTER MYSHARDID) with batch support ([#5106](https://github.com/valkey-io/valkey-glide/issues/5106))
25
25
* CORE: Add read only flag, enforcing no write commands and allowing for connecting without a primary ([#5411](https://github.com/valkey-io/valkey-glide/issues/5411))
26
+
* Python Sync: Accept `bytearray` and `memoryview` as command argument types to improve performance by reducing copies ([#5492](https://github.com/valkey-io/valkey-glide/pull/5492))
27
+
* Python Sync: Add response buffer support to get() to improve performance by reducing copies ([#5493](https://github.com/valkey-io/valkey-glide/pull/5493))
26
28
27
29
#### Fixes
28
30
* CORE: Fix empty hostname in CLUSTER SLOTS metadata causing AllConnectionsUnavailable ([#5367](https://github.com/valkey-io/valkey-glide/issues/5367)). AWS ElastiCache (plaintext, cluster mode) returns `hostname: ""` in node metadata, which was used as the connection address instead of falling back to the IP.
/// A Send-safe wrapper around a raw buffer pointer and length.
216
+
/// The caller guarantees the buffer remains valid for the duration of the FFI call.
217
+
structResponseBuffer(*mutu8,usize);
218
+
unsafeimplSendforResponseBuffer{}
219
+
215
220
/// Success callback that is called when a command succeeds.
216
221
///
217
222
/// The success callback needs to copy the given string synchronously, since it will be dropped by Rust once the callback returns. The callback should be offloaded to a separate thread in order not to exhaust the client's thread pool.
@@ -434,6 +439,18 @@ impl ClientAdapter {
434
439
/// For sync clients, blocks on the future and returns a `CommandResult`.
/// Executes a command, optionally copying a BulkString response directly into a
1251
+
/// caller-provided buffer instead of returning it as a heap-allocated value.
1252
+
///
1253
+
/// When `response_buf` is null (and `response_buf_len` is 0), behaves identically
1254
+
/// to [`command`] — the response flows through the normal `execute_request` path.
1255
+
///
1256
+
/// When `response_buf` is non-null, the response is written directly into the buffer:
1257
+
/// - `response.string_value` = number of bytes written as a string, or Nil response for missing keys.
1258
+
/// - Errors if the value exceeds `response_buf_len`.
1259
+
///
1260
+
/// # Safety
1261
+
///
1262
+
/// * `client_adapter_ptr` must not be `null` and must be obtained from the `ConnectionResponse` returned from [`create_client`].
1263
+
/// * `client_adapter_ptr` must be able to be safely casted to a valid [`Arc<ClientAdapter>`] via [`Arc::from_raw`]. See the safety documentation of [`std::sync::Arc::from_raw`].
1264
+
/// * `request_id` must be a request ID from the foreign language and must be valid until either `success_callback` or `failure_callback` is finished.
1265
+
/// * `args` is an optional bytes pointers array. The array must be allocated by the caller and subsequently freed by the caller after this function returns.
1266
+
/// * `args_len` is an optional bytes length array. The array must be allocated by the caller and subsequently freed by the caller after this function returns.
1267
+
/// * `arg_count` the number of elements in `args` and `args_len`. It must also not be greater than the max value of a signed pointer-sized integer.
1268
+
/// * `arg_count` must be 0 if `args` and `args_len` are null.
1269
+
/// * `args` and `args_len` must either be both null or be both not null.
1270
+
/// * `route_bytes` is an optional array of bytes that will be parsed into a Protobuf `Routes` object. The array must be allocated by the caller and subsequently freed by the caller after this function returns.
1271
+
/// * `route_bytes_len` is the number of bytes in `route_bytes`. It must also not be greater than the max value of a signed pointer-sized integer.
1272
+
/// * `route_bytes_len` must be 0 if `route_bytes` is null.
1273
+
/// * When non-null, `response_buf` must point to a writable buffer of at least `response_buf_len` bytes.
1274
+
/// * `response_buf_len` must be 0 if `response_buf` is null.
1275
+
/// * `span_ptr` is a valid pointer to [`Arc<GlideSpan>`], a span created by [`create_otel_span`] or `0`. The span must be valid until the command is finished.
1276
+
/// * This function should only be called with a `client_adapter_ptr` created by [`create_client`], before [`close_client`] was called with the pointer.
1277
+
#[unsafe(no_mangle)]
1278
+
pubunsafeextern"C-unwind"fncommand_with_buffer(
1279
+
client_adapter_ptr:*constc_void,
1280
+
request_id:usize,
1281
+
command_type:RequestType,
1282
+
arg_count:c_ulong,
1283
+
args:*constusize,
1284
+
args_len:*constc_ulong,
1285
+
route_bytes:*constu8,
1286
+
route_bytes_len:usize,
1287
+
response_buf:*mutu8,
1288
+
response_buf_len:usize,
1289
+
span_ptr:u64,
1184
1290
) -> *mutCommandResult{
1185
1291
let client_adapter = unsafe{
1186
1292
// we increment the strong count to ensure that the client is not dropped just because we turned it into an Arc.
0 commit comments