MCPcopy Create free account
hub / github.com/GraphiteEditor/Graphite / to_registry

Function to_registry

document/graph-storage/src/tests/round_trip.rs:25–29  ·  view source on GitHub ↗

Convert a runtime network to a storage `Registry`, returning the declarations alongside it. Proto-node declaration content is no longer stored in the registry (it lives in a byte store); these tests have no byte store, so they keep the extracted bytes in hand and rebuild a `Declarations` map for the back-conversion.

(network: &NodeNetwork)

Source from the content-addressed store, hash-verified

23/// these tests have no byte store, so they keep the extracted bytes in hand and rebuild a
24/// `Declarations` map for the back-conversion.
25fn to_registry(network: &NodeNetwork) -> (Registry, crate::Declarations) {
26 let conversion = Registry::convert_from_runtime(network, &crate::NoMetadata, &Default::default(), PeerId(0)).expect("Failed to convert NodeNetwork to Registry");
27 let declarations = conversion.declarations().expect("rebuild declarations");
28 (conversion.registry, declarations)
29}
30
31/// A one-node network whose single node references `id` via a `TaggedValue::Resource` input, so
32/// `convert_resources` (which only snapshots network-referenced resources) carries the resource.

Calls 2

PeerIdClass · 0.85
declarationsMethod · 0.45

Tested by

no test coverage detected