about summary refs log tree commit diff
path: root/tvix/castore/src/blobservice/sled.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tvix/castore/src/blobservice/sled.rs')
-rw-r--r--tvix/castore/src/blobservice/sled.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/tvix/castore/src/blobservice/sled.rs b/tvix/castore/src/blobservice/sled.rs
index f7bf33e8c50f..3dd4bff7bc8e 100644
--- a/tvix/castore/src/blobservice/sled.rs
+++ b/tvix/castore/src/blobservice/sled.rs
@@ -34,19 +34,19 @@ impl SledBlobService {
 #[async_trait]
 impl BlobService for SledBlobService {
     #[instrument(skip(self), fields(blob.digest=%digest))]
-    async fn has(&self, digest: &B3Digest) -> Result<bool, Error> {
+    async fn has(&self, digest: &B3Digest) -> io::Result<bool> {
         match self.db.contains_key(digest.as_slice()) {
             Ok(has) => Ok(has),
-            Err(e) => Err(Error::StorageError(e.to_string())),
+            Err(e) => Err(io::Error::new(io::ErrorKind::Other, e.to_string())),
         }
     }
 
     #[instrument(skip(self), fields(blob.digest=%digest))]
-    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>>> {
         match self.db.get(digest.as_slice()) {
             Ok(None) => Ok(None),
             Ok(Some(data)) => Ok(Some(Box::new(Cursor::new(data[..].to_vec())))),
-            Err(e) => Err(Error::StorageError(e.to_string())),
+            Err(e) => Err(io::Error::new(io::ErrorKind::Other, e.to_string())),
         }
     }
 
@@ -118,12 +118,13 @@ impl tokio::io::AsyncWrite for SledBlobWriter {
 
 #[async_trait]
 impl BlobWriter for SledBlobWriter {
-    async fn close(&mut self) -> Result<B3Digest, Error> {
+    async fn close(&mut self) -> io::Result<B3Digest> {
         if self.writers.is_none() {
             match &self.digest {
                 Some(digest) => Ok(digest.clone()),
-                None => Err(crate::Error::StorageError(
-                    "previously closed with error".to_string(),
+                None => Err(io::Error::new(
+                    io::ErrorKind::NotConnected,
+                    "already closed",
                 )),
             }
         } else {