feat(tvix/store/fuse): implement open explicitly

This "reverts" commit 9f600de226 (the
initial revert of f5e291cf83).

Now with BlobService returning a BlobReader that implements io::Seek, we
can actually just call blob_reader.seek(io::SeekFrom::Start(offset as
u64)).

This means, we currently will fail to seek backwards inside a file.

Change-Id: I9c19448df6831a3537252f99210374f2126ecfc0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8886
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
This commit is contained in:
Florian Klink 2023-06-30 16:11:13 +02:00 committed by clbot
parent 7613e2e769
commit 638f3e874d
2 changed files with 91 additions and 31 deletions

View file

@ -80,7 +80,17 @@ impl<R: io::Read> io::Seek for DumbSeeker<R> {
Err(e) => return Err(e),
}
}
debug_assert_eq!(bytes_to_skip, bytes_skipped);
// This will fail when seeking past the end of self.r
if bytes_to_skip != bytes_skipped {
return Err(std::io::Error::new(
std::io::ErrorKind::UnexpectedEof,
format!(
"tried to skip {} bytes, but only was able to skip {} until reaching EOF",
bytes_to_skip, bytes_skipped
),
));
}
self.pos = absolute_offset;