From 30d82efa774f72e6d33c2070b32d365121654c54 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 12 Dec 2023 15:48:01 +0200 Subject: refactor(tvix/castore/blobservice): use io::Result in trait 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 Tested-by: BuildkiteCI Autosubmit: flokli --- tvix/castore/src/blobservice/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tvix/castore/src/blobservice/mod.rs') 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; + async fn has(&self, digest: &B3Digest) -> io::Result; /// Request a blob from the store, by its content hash. - async fn open_read(&self, digest: &B3Digest) -> Result>, Error>; + async fn open_read(&self, digest: &B3Digest) -> io::Result>>; /// 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; + async fn close(&mut self) -> io::Result; } /// A [tokio::io::AsyncRead] that also allows seeking. -- cgit 1.4.1