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

Method insert

nodedb-columnar/src/pk_index.rs:60–70  ·  view source on GitHub ↗

Insert a PK → location mapping. Returns error if PK already exists.

(
        &mut self,
        pk_bytes: Vec<u8>,
        location: RowLocation,
    )

Source from the content-addressed store, hash-verified

58
59 /// Insert a PK → location mapping. Returns error if PK already exists.
60 pub fn insert(
61 &mut self,
62 pk_bytes: Vec<u8>,
63 location: RowLocation,
64 ) -> Result<(), ColumnarError> {
65 if self.inner.contains_key(&pk_bytes) {
66 return Err(ColumnarError::DuplicatePrimaryKey);
67 }
68 self.inner.insert(pk_bytes, location);
69 Ok(())
70 }
71
72 /// Insert or overwrite a PK → location mapping (used during compaction remap).
73 pub fn upsert(&mut self, pk_bytes: Vec<u8>, location: RowLocation) {

Callers 13

trainMethod · 0.45
make_dict_colFunction · 0.45
make_decoded_colFunction · 0.45
upsertMethod · 0.45
remap_segmentMethod · 0.45
bulk_insertMethod · 0.45
from_bytesMethod · 0.45
insert_and_lookupFunction · 0.45
duplicate_pk_rejectedFunction · 0.45
remove_entryFunction · 0.45
mark_deletedMethod · 0.45

Calls

no outgoing calls

Tested by 4

insert_and_lookupFunction · 0.36
duplicate_pk_rejectedFunction · 0.36
remove_entryFunction · 0.36