MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / versioned_encode

Function versioned_encode

nodedb-cluster/src/rpc_codec/raft_rpc.rs:86–91  ·  view source on GitHub ↗

Encode a [`RaftRpc`] and wrap the framed bytes in a v2 versioned envelope. The outer envelope allows peers to detect and reject incompatible future wire versions rather than silently misinterpreting them.

(rpc: &RaftRpc)

Source from the content-addressed store, hash-verified

84/// The outer envelope allows peers to detect and reject incompatible future
85/// wire versions rather than silently misinterpreting them.
86pub fn versioned_encode(rpc: &RaftRpc) -> Result<Vec<u8>> {
87 let framed = encode(rpc)?;
88 wrap_bytes_versioned(&framed).map_err(|e| ClusterError::Codec {
89 detail: format!("RaftRpc versioned encode: {e}"),
90 })
91}
92
93/// Decode a versioned-envelope-wrapped [`RaftRpc`] frame.
94///

Callers

nothing calls this directly

Calls 2

wrap_bytes_versionedFunction · 0.85
encodeFunction · 0.70

Tested by

no test coverage detected