MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / decode_sync_message

Function decode_sync_message

gateway/src/web_routes/wavekv_sync.rs:39–52  ·  view source on GitHub ↗

Decode compressed msgpack data

(data: &[u8])

Source from the content-addressed store, hash-verified

37
38/// Decode compressed msgpack data
39fn decode_sync_message(data: &[u8]) -> Result<SyncMessage, Status> {
40 // Decompress
41 let mut decoder = GzDecoder::new(data);
42 let mut decompressed = Vec::new();
43 decoder.read_to_end(&mut decompressed).map_err(|e| {
44 warn!("failed to decompress sync message: {e}");
45 Status::BadRequest
46 })?;
47
48 decode(&decompressed).map_err(|e| {
49 warn!("failed to decode sync message: {e}");
50 Status::BadRequest
51 })
52}
53
54/// Encode and compress sync response
55fn encode_sync_response(response: &SyncResponse) -> Result<Vec<u8>, Status> {

Callers 1

sync_storeFunction · 0.85

Calls 1

decodeFunction · 0.85

Tested by

no test coverage detected