| 3087 | |
| 3088 | impl 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()) |