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

Method get_by_git_sha

atomic-core/src/pristine/txn/read.rs:3118–3128  ·  view source on GitHub ↗
(&self, sha: &str)

Source from the content-addressed store, hash-verified

3116
3117impl GitShaIndexTxnT for ReadTxn {
3118 fn get_by_git_sha(&self, sha: &str) -> PristineResult<Option<NodeId>> {
3119 let table = match self.txn.open_table(GIT_SHA_INDEX) {
3120 Ok(t) => t,
3121 Err(redb::TableError::TableDoesNotExist(_)) => return Ok(None),
3122 Err(e) => return Err(PristineError::from(e)),
3123 };
3124 match table.get(sha)? {
3125 Some(v) => Ok(Some(NodeId::new(v.value()))),
3126 None => Ok(None),
3127 }
3128 }
3129
3130 fn has_git_sha(&self, sha: &str) -> PristineResult<bool> {
3131 Ok(self.get_by_git_sha(sha)?.is_some())

Calls 2

getMethod · 0.65
valueMethod · 0.45