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

Method get_git_commit_closure

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

Source from the content-addressed store, hash-verified

2996
2997impl GitCommitClosureTxnT for ReadTxn {
2998 fn get_git_commit_closure(&self, sha: &str) -> PristineResult<Option<Vec<Hash>>> {
2999 let table = match self.txn.open_table(GIT_COMMIT_CLOSURES) {
3000 Ok(table) => table,
3001 Err(redb::TableError::TableDoesNotExist(_)) => return Ok(None),
3002 Err(error) => return Err(PristineError::from(error)),
3003 };
3004 match table.get(sha)? {
3005 Some(bytes) => {
3006 let nodes = match self.txn.open_table(GIT_CLOSURE_NODES) {
3007 Ok(table) => Some(table),
3008 Err(redb::TableError::TableDoesNotExist(_)) => None,
3009 Err(error) => return Err(error.into()),
3010 };
3011 crate::pristine::git_closure::decode(bytes.value(), |id| match &nodes {
3012 Some(table) => Ok(table.get(id)?.map(|value| *value.value())),
3013 None => Ok(None),
3014 })
3015 .map(Some)
3016 }
3017 None => Ok(None),
3018 }
3019 }
3020
3021 fn has_git_commit_closure(&self, sha: &str) -> PristineResult<bool> {
3022 let table = match self.txn.open_table(GIT_COMMIT_CLOSURES) {

Callers 5

publishMethod · 0.45
git_commit_closureMethod · 0.45
index_replayed_git_spanFunction · 0.45

Calls 3

valueMethod · 0.80
getMethod · 0.65
decodeFunction · 0.50

Tested by

no test coverage detected