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:3089–3099  ·  view source on GitHub ↗
(&self, sha: &str)

Source from the content-addressed store, hash-verified

3087
3088impl GitShaIndexTxnT for ReadTxn {
3089 fn get_by_git_sha(&self, sha: &str) -> PristineResult<Option<NodeId>> {
3090 let table = match self.txn.open_table(GIT_SHA_INDEX) {
3091 Ok(t) => t,
3092 Err(redb::TableError::TableDoesNotExist(_)) => return Ok(None),
3093 Err(e) => return Err(PristineError::from(e)),
3094 };
3095 match table.get(sha)? {
3096 Some(v) => Ok(Some(NodeId::new(v.value()))),
3097 None => Ok(None),
3098 }
3099 }
3100
3101 fn has_git_sha(&self, sha: &str) -> PristineResult<bool> {
3102 Ok(self.get_by_git_sha(sha)?.is_some())

Calls 2

valueMethod · 0.80
getMethod · 0.65