| 3116 | |
| 3117 | impl 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()) |