MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / change_from_bundle

Function change_from_bundle

libatomic/src/daemon/sandbox_wire.rs:317–328  ·  view source on GitHub ↗

A bundle's hash and V3 bytes. An empty schema reads as V3.

(bundle: &pb::ChangeBundle)

Source from the content-addressed store, hash-verified

315
316/// A bundle's hash and V3 bytes. An empty schema reads as V3.
317pub fn change_from_bundle(bundle: &pb::ChangeBundle) -> Result<(Hash, Vec<u8>), String> {
318 if !bundle.schema.is_empty() && bundle.schema != CHANGE_SCHEMA {
319 return Err(format!(
320 "expected {CHANGE_SCHEMA} change bytes, got '{}'",
321 bundle.schema
322 ));
323 }
324 Ok((
325 hash_from_proto(bundle.hash.as_ref())?,
326 bundle.payload.clone(),
327 ))
328}
329
330pub fn provenance_graph_bytes(graph: Vec<u8>) -> pb::VersionedBytes {
331 versioned(PROVENANCE_GRAPH_SCHEMA, graph)

Callers 1

submit_changeMethod · 0.85

Calls 4

hash_from_protoFunction · 0.85
as_refMethod · 0.80
is_emptyMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected