refactor(tvix/store/blobsvc): drop Result<_,_> around open_write
We never returned Err here anyways, and we can still return an error during the first (or subsequent) write(s). Change-Id: I4b4cd3d35f6ea008e9ffe2f7b71bfc9187309e2f Reviewed-on: https://cl.tvl.fyi/c/depot/+/8750 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
b49f7cfec6
commit
64a4f6185c
7 changed files with 15 additions and 19 deletions
|
|
@ -121,9 +121,9 @@ impl BlobService for GRPCBlobService {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns a [Self::BlobWriter], that'll internally wrap each write in a
|
||||
// [proto::BlobChunk] and which is passed to the
|
||||
fn open_write(&self) -> Result<Box<dyn BlobWriter>, crate::Error> {
|
||||
/// Returns a BlobWriter, that'll internally wrap each write in a
|
||||
// [proto::BlobChunk], which is send to the gRPC server.
|
||||
fn open_write(&self) -> Box<dyn BlobWriter> {
|
||||
let mut grpc_client = self.grpc_client.clone();
|
||||
|
||||
// set up an mpsc channel passing around Bytes.
|
||||
|
|
@ -155,11 +155,11 @@ impl BlobService for GRPCBlobService {
|
|||
// … which is then turned into a [io::Write].
|
||||
let writer = SyncIoBridge::new(async_writer);
|
||||
|
||||
Ok(Box::new(GRPCBlobWriter {
|
||||
Box::new(GRPCBlobWriter {
|
||||
tokio_handle: self.tokio_handle.clone(), // TODO: is the clone() ok here?
|
||||
task_and_writer: Some((task, writer)),
|
||||
digest: None,
|
||||
}))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ impl BlobService for MemoryBlobService {
|
|||
}
|
||||
|
||||
#[instrument(skip(self))]
|
||||
fn open_write(&self) -> Result<Box<dyn BlobWriter>, Error> {
|
||||
Ok(Box::new(MemoryBlobWriter::new(self.db.clone())))
|
||||
fn open_write(&self) -> Box<dyn BlobWriter> {
|
||||
Box::new(MemoryBlobWriter::new(self.db.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ pub trait BlobService: Send + Sync {
|
|||
|
||||
/// Insert a new blob into the store. Returns a [BlobWriter], which
|
||||
/// implements [io::Write] and a [BlobWriter::close].
|
||||
/// TODO: is there any reason we want this to be a Result<>, and not just T?
|
||||
fn open_write(&self) -> Result<Box<dyn BlobWriter>, Error>;
|
||||
fn open_write(&self) -> Box<dyn BlobWriter>;
|
||||
}
|
||||
|
||||
/// A [io::Write] that you need to close() afterwards, and get back the digest
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ impl BlobService for SledBlobService {
|
|||
}
|
||||
|
||||
#[instrument(skip(self))]
|
||||
fn open_write(&self) -> Result<Box<dyn BlobWriter>, Error> {
|
||||
Ok(Box::new(SledBlobWriter::new(self.db.clone())))
|
||||
fn open_write(&self) -> Box<dyn BlobWriter> {
|
||||
Box::new(SledBlobWriter::new(self.db.clone()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue