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

Method from_schema

nodedb-array/src/sync/schema_crdt.rs:64–73  ·  view source on GitHub ↗

Construct a schema doc pre-populated with `schema`. The schema is encoded as MessagePack and stored under `root["content"]`. `generator.next()` is called to assign the initial `schema_hlc`.

(
        replica_id: ReplicaId,
        schema: &ArraySchema,
        generator: &HlcGenerator,
    )

Source from the content-addressed store, hash-verified

62 /// `root["content"]`. `generator.next()` is called to assign the initial
63 /// `schema_hlc`.
64 pub fn from_schema(
65 replica_id: ReplicaId,
66 schema: &ArraySchema,
67 generator: &HlcGenerator,
68 ) -> ArrayResult<Self> {
69 let mut doc_self = Self::new(replica_id);
70 doc_self.write_schema_to_doc(schema)?;
71 doc_self.schema_hlc = generator.next()?;
72 Ok(doc_self)
73 }
74
75 /// Return the current schema HLC.
76 pub fn schema_hlc(&self) -> Hlc {

Callers

nothing calls this directly

Calls 2

write_schema_to_docMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected