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

Method write_schema_to_doc

nodedb-array/src/sync/schema_crdt.rs:185–196  ·  view source on GitHub ↗
(&self, schema: &ArraySchema)

Source from the content-addressed store, hash-verified

183 // ─── Internal helpers ────────────────────────────────────────────────────
184
185 fn write_schema_to_doc(&self, schema: &ArraySchema) -> ArrayResult<()> {
186 let schema_bytes =
187 zerompk::to_msgpack_vec(schema).map_err(|e| ArrayError::SegmentCorruption {
188 detail: format!("schema encode failed: {e}"),
189 })?;
190 let root: LoroMap = self.doc.get_map("root");
191 root.insert("content", LoroValue::Binary(schema_bytes.into()))
192 .map_err(|e| ArrayError::LoroError {
193 detail: format!("loro map insert failed: {e}"),
194 })?;
195 Ok(())
196 }
197
198 fn read_content_bytes(&self, root: &LoroMap) -> ArrayResult<Vec<u8>> {
199 match root.get("content") {

Callers 2

from_schemaMethod · 0.80
replace_schemaMethod · 0.80

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected