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

Source from the content-addressed store, hash-verified

3025
3026impl GitCommitClosureTxnT for ReadTxn {
3027 fn get_git_commit_closure(&self, sha: &str) -> PristineResult<Option<Vec<Hash>>> {
3028 let table = match self.txn.open_table(GIT_COMMIT_CLOSURES) {
3029 Ok(table) => table,
3030 Err(redb::TableError::TableDoesNotExist(_)) => return Ok(None),
3031 Err(error) => return Err(PristineError::from(error)),
3032 };
3033 match table.get(sha)? {
3034 Some(bytes) => {
3035 let nodes = match self.txn.open_table(GIT_CLOSURE_NODES) {
3036 Ok(table) => Some(table),
3037 Err(redb::TableError::TableDoesNotExist(_)) => None,
3038 Err(error) => return Err(error.into()),
3039 };
3040 crate::pristine::git_closure::decode(bytes.value(), |id| match &nodes {
3041 Some(table) => Ok(table.get(id)?.map(|value| *value.value())),
3042 None => Ok(None),
3043 })
3044 .map(Some)
3045 }
3046 None => Ok(None),
3047 }
3048 }
3049
3050 fn has_git_commit_closure(&self, sha: &str) -> PristineResult<bool> {
3051 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

getMethod · 0.65
decodeFunction · 0.50
valueMethod · 0.45

Tested by

no test coverage detected