about summary refs log tree commit diff
path: root/tvix/castore/src/blobservice/mod.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-12-12T13·48+0200
committerclbot <clbot@tvl.fyi>2023-12-12T18·06+0000
commit30d82efa774f72e6d33c2070b32d365121654c54 (patch)
treef0842e93b043c1dcad569127a9904f06c8112a4b /tvix/castore/src/blobservice/mod.rs
parent91456c3520a03e0f3b73224f1d80c56a5392fe32 (diff)
refactor(tvix/castore/blobservice): use io::Result in trait r/7207
For all these calls, the caller has enough context about what it did, so
it should be fine to use io::Result here.

We pretty much only constructed crate::Error::StorageError before
anyways, so this conveys *more* information.

Change-Id: I5cabb3769c9c2314bab926d34dda748fda9d3ccc
Reviewed-on: https://cl.tvl.fyi/c/depot/+/10328
Reviewed-by: raitobezarius <tvl@lahfa.xyz>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/castore/src/blobservice/mod.rs')
-rw-r--r--tvix/castore/src/blobservice/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/tvix/castore/src/blobservice/mod.rs b/tvix/castore/src/blobservice/mod.rs
index 61d5583b99..faaf94f037 100644
--- a/tvix/castore/src/blobservice/mod.rs
+++ b/tvix/castore/src/blobservice/mod.rs
@@ -1,7 +1,7 @@
 use std::io;
 use tonic::async_trait;
 
-use crate::{B3Digest, Error};
+use crate::B3Digest;
 
 mod from_addr;
 mod grpc;
@@ -25,10 +25,10 @@ pub use self::sled::SledBlobService;
 #[async_trait]
 pub trait BlobService: Send + Sync {
     /// Check if the service has the blob, by its content hash.
-    async fn has(&self, digest: &B3Digest) -> Result<bool, Error>;
+    async fn has(&self, digest: &B3Digest) -> io::Result<bool>;
 
     /// Request a blob from the store, by its content hash.
-    async fn open_read(&self, digest: &B3Digest) -> Result<Option<Box<dyn BlobReader>>, Error>;
+    async fn open_read(&self, digest: &B3Digest) -> io::Result<Option<Box<dyn BlobReader>>>;
 
     /// Insert a new blob into the store. Returns a [BlobWriter], which
     /// implements [io::Write] and a [BlobWriter::close].
@@ -43,7 +43,7 @@ pub trait BlobWriter: tokio::io::AsyncWrite + Send + Sync + Unpin + 'static {
     /// contents written.
     ///
     /// Closing a already-closed BlobWriter is a no-op.
-    async fn close(&mut self) -> Result<B3Digest, Error>;
+    async fn close(&mut self) -> io::Result<B3Digest>;
 }
 
 /// A [tokio::io::AsyncRead] that also allows seeking.