A bundle's hash and V3 bytes. An empty schema reads as V3.
(bundle: &pb::ChangeBundle)
| 315 | |
| 316 | /// A bundle's hash and V3 bytes. An empty schema reads as V3. |
| 317 | pub 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 | |
| 330 | pub fn provenance_graph_bytes(graph: Vec<u8>) -> pb::VersionedBytes { |
| 331 | versioned(PROVENANCE_GRAPH_SCHEMA, graph) |
no test coverage detected