MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / put_trunk

Method put_trunk

atomic-core/src/crdt/apply/traits.rs:502–508  ·  view source on GitHub ↗
(&mut self, trunk: &Trunk)

Source from the content-addressed store, hash-verified

500 type Error = PristineError;
501
502 fn put_trunk(&mut self, trunk: &Trunk) -> Result<bool, Self::Error> {
503 let is_new = !self.trunks.contains_key(&trunk.id());
504 self.trunks.insert(trunk.id(), trunk.clone());
505 self.path_index.insert(trunk.path().to_string(), trunk.id());
506 self.inode_index.insert(trunk.inode(), trunk.id());
507 Ok(is_new)
508 }
509
510 fn get_trunk(&self, id: TrunkId) -> Result<Option<Trunk>, Self::Error> {
511 Ok(self.trunks.get(&id).cloned())

Callers 6

create_trunkMethod · 0.45
test_has_trunkFunction · 0.45
test_del_trunkFunction · 0.45
test_get_trunk_by_pathFunction · 0.45
test_get_trunk_by_inodeFunction · 0.45
test_update_trunk_pathFunction · 0.45

Calls 6

contains_keyMethod · 0.80
idMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45
pathMethod · 0.45
inodeMethod · 0.45

Tested by 5

test_has_trunkFunction · 0.36
test_del_trunkFunction · 0.36
test_get_trunk_by_pathFunction · 0.36
test_get_trunk_by_inodeFunction · 0.36
test_update_trunk_pathFunction · 0.36