fix: add --meta filtering support to client/server list mode
Plumb metadata filter from client CLI through the HTTP API to the server's data_service.list_items(). The server accepts a JSON-encoded meta query parameter where null values mean 'key exists' and string values mean 'exact match'. Also fix LZ4 compression round-trip for client mode: - Explicit flush FrameEncoder before drop to avoid sending only the frame header when compress=false - Send _client_compression metadata so client knows actual compression on retrieval (server records compression=None when compress=false) - Use FrameDecoder (frame format) instead of decompress_size_prepended (size-prepended format) to match server storage format
This commit is contained in:
@@ -84,7 +84,10 @@ pub fn mode(
|
||||
compressor.write_all(&buffer[..n])?;
|
||||
}
|
||||
|
||||
// Finalize compression (flushes any buffered compressed data)
|
||||
// Explicitly flush and finalize compression before dropping.
|
||||
// LZ4 FrameEncoder buffers data internally; without explicit flush,
|
||||
// only the frame header (7 bytes) gets written to the pipe.
|
||||
compressor.flush()?;
|
||||
drop(compressor);
|
||||
|
||||
// Pipe writer is now dropped (inside compressor), signaling EOF to streamer
|
||||
@@ -147,6 +150,17 @@ pub fn mode(
|
||||
uncompressed_size.to_string(),
|
||||
);
|
||||
|
||||
// Record client compression type so the client can decompress on retrieval.
|
||||
// When compress=false, the server stores the blob as-is with compression=None.
|
||||
// Without this metadata, the client would get compressed bytes back but think
|
||||
// they're uncompressed.
|
||||
if !matches!(compression_type, CompressionType::None) {
|
||||
local_metadata.insert(
|
||||
"_client_compression".to_string(),
|
||||
compression_type.to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
// Add hostname
|
||||
if let Ok(hostname) = gethostname::gethostname().into_string() {
|
||||
local_metadata.insert("hostname".to_string(), hostname.clone());
|
||||
|
||||
Reference in New Issue
Block a user