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

Method put_clone_copyup

nodedb/src/control/security/catalog/clone_catalog.rs:27–47  ·  view source on GitHub ↗

Record a copy-up: `source_surrogate` in `target_collection` is now represented by `target_surrogate` in target storage.

(
        &self,
        target_collection_key: &str,
        source_surrogate: u32,
        target_surrogate: u32,
    )

Source from the content-addressed store, hash-verified

25 /// Record a copy-up: `source_surrogate` in `target_collection` is now
26 /// represented by `target_surrogate` in target storage.
27 pub fn put_clone_copyup(
28 &self,
29 target_collection_key: &str,
30 source_surrogate: u32,
31 target_surrogate: u32,
32 ) -> crate::Result<()> {
33 let txn = self
34 .db
35 .begin_write()
36 .map_err(|e| catalog_err("clone_copyups begin_write", e))?;
37 {
38 let mut table = txn
39 .open_table(CLONE_COPYUPS)
40 .map_err(|e| catalog_err("open clone_copyups", e))?;
41 table
42 .insert((target_collection_key, source_surrogate), target_surrogate)
43 .map_err(|e| catalog_err("insert clone_copyups", e))?;
44 }
45 txn.commit()
46 .map_err(|e| catalog_err("clone_copyups commit", e))
47 }
48
49 /// Look up the target surrogate for a copied-up source row.
50 /// Returns `None` if no copy-up has been recorded for this surrogate.

Callers 4

copyup_roundtripFunction · 0.80
copyup_deleteFunction · 0.80
perform_clone_copyupFunction · 0.80

Calls 4

begin_writeMethod · 0.80
catalog_errFunction · 0.70
insertMethod · 0.45
commitMethod · 0.45

Tested by 3

copyup_roundtripFunction · 0.64
copyup_deleteFunction · 0.64