MCPcopy Create free account
hub / github.com/apache/iggy / decode

Function decode

core/server/src/binary/dispatch.rs:69–88  ·  view source on GitHub ↗
(payload: &[u8])

Source from the content-addressed store, hash-verified

67}
68
69fn decode<T: WireDecode>(payload: &[u8]) -> Result<T, IggyError> {
70 use iggy_binary_protocol::error::WireError;
71
72 let (val, consumed) = T::decode(payload).map_err(|e| {
73 warn!("wire decode error: {e}");
74 match e {
75 WireError::PayloadTooLarge { .. } => IggyError::InvalidSizeBytes,
76 WireError::Validation(_) => IggyError::InvalidFormat,
77 _ => IggyError::InvalidCommand,
78 }
79 })?;
80 if consumed != payload.len() {
81 warn!(
82 "wire decode: {} trailing bytes (consumed {consumed}, payload {})",
83 payload.len() - consumed,
84 payload.len()
85 );
86 }
87 Ok(val)
88}
89
90/// Convert a `WireIdentifier` to the domain `Identifier`.
91pub fn wire_id_to_identifier(

Calls 1

lenMethod · 0.45