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

Method put_branch

atomic-core/src/crdt/apply/branch.rs:550–562  ·  view source on GitHub ↗

Branch methods

(
            &mut self,
            branch: &Branch,
            _after: Option<BranchId>,
        )

Source from the content-addressed store, hash-verified

548
549 // Branch methods
550 fn put_branch(
551 &mut self,
552 branch: &Branch,
553 _after: Option<BranchId>,
554 ) -> Result<bool, Self::Error> {
555 let is_new = !self.branches.contains_key(&branch.id());
556 self.branches.insert(branch.id(), branch.clone());
557 self.trunk_branches
558 .entry(branch.trunk())
559 .or_default()
560 .push(branch.id());
561 Ok(is_new)
562 }
563
564 fn get_branch(&self, id: BranchId) -> Result<Option<Branch>, Self::Error> {
565 Ok(self.branches.get(&id).cloned())

Callers 1

apply_insert_onlyFunction · 0.45

Calls 6

contains_keyMethod · 0.80
idMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45
pushMethod · 0.45
trunkMethod · 0.45

Tested by

no test coverage detected