Skip to content

Commit

Permalink
revisionstore: deserialize lfs entry in zero-copy way
Browse files Browse the repository at this point in the history
Summary:
See the previous diff for context. Add a hint so the LFS entry could be
deserialzied in a zero copy way.

Reviewed By: muirdm

Differential Revision: D60189688

fbshipit-source-id: f1aacf9a2d81e3bbf0ece3c7d9cdcaa6a30a28e6
  • Loading branch information
quark-zju authored and facebook-github-bot committed Jul 24, 2024
1 parent 84c0d85 commit 1828b5a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions eden/scm/lib/revisionstore/src/lfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,12 @@ impl LfsIndexedLogBlobsStore {

pub fn get(&self, hash: &Sha256, total_size: u64) -> Result<Option<Bytes>> {
let log = self.inner.read();
let chunks_iter = log
.lookup(0, hash)?
.map(|data| Ok(deserialize::<LfsIndexedLogBlobsEntry>(data?)?));
let chunks_iter = log.lookup(0, hash)?.map(|data| {
let data: Bytes = log.slice_to_bytes(data?);
let deserialized: LfsIndexedLogBlobsEntry =
data.as_deserialize_hint(|| deserialize(&data))?;
Ok(deserialized)
});

// Filter errors. It's possible that one entry is corrupted, or for whatever reason can't
// be deserialized, whenever this blob/entry is refetched, the corrupted entry will still be
Expand Down

0 comments on commit 1828b5a

Please sign in to comment.