pub struct LocalBlobStore { /* private fields */ }Expand description
Filesystem-backed BlobStore.
Blobs are written to a temporary file in the destination directory and renamed into place, so a reader never observes a partially written blob.
§Examples
use ironflow_artifacts::blob_store::BlobStore;
use ironflow_artifacts::local::LocalBlobStore;
use ironflow_artifacts::stream_from_bytes;
let store = LocalBlobStore::new("/var/lib/ironflow/artifacts").max_bytes(10 * 1024 * 1024);
store
.put("artifacts/run/step/id", stream_from_bytes(b"report".to_vec()))
.await?;Implementations§
Source§impl LocalBlobStore
impl LocalBlobStore
Sourcepub fn new(root: impl Into<PathBuf>) -> Self
pub fn new(root: impl Into<PathBuf>) -> Self
Create a store rooted at root, with the default size limit.
The directory is created lazily on the first write.
§Examples
use ironflow_artifacts::local::{DEFAULT_MAX_ARTIFACT_BYTES, LocalBlobStore};
let store = LocalBlobStore::new("/tmp/ironflow-artifacts");
assert_eq!(store.max_bytes_limit(), DEFAULT_MAX_ARTIFACT_BYTES);Sourcepub fn max_bytes(self, limit: u64) -> Self
pub fn max_bytes(self, limit: u64) -> Self
Override the per-artifact size limit.
§Examples
use ironflow_artifacts::local::LocalBlobStore;
let store = LocalBlobStore::new("/tmp/a").max_bytes(1024);
assert_eq!(store.max_bytes_limit(), 1024);Sourcepub fn max_bytes_limit(&self) -> u64
pub fn max_bytes_limit(&self) -> u64
The configured per-artifact size limit, in bytes.
Trait Implementations§
Source§impl BlobStore for LocalBlobStore
impl BlobStore for LocalBlobStore
Source§fn put<'a>(
&'a self,
key: &'a str,
content: ByteStream,
) -> BlobFuture<'a, BlobDigest>
fn put<'a>( &'a self, key: &'a str, content: ByteStream, ) -> BlobFuture<'a, BlobDigest>
Write a blob under
key, replacing any existing content. Read moreSource§fn get<'a>(&'a self, key: &'a str) -> BlobFuture<'a, ByteStream>
fn get<'a>(&'a self, key: &'a str) -> BlobFuture<'a, ByteStream>
Open a blob for reading. Read more
Source§impl Clone for LocalBlobStore
impl Clone for LocalBlobStore
Source§fn clone(&self) -> LocalBlobStore
fn clone(&self) -> LocalBlobStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for LocalBlobStore
impl RefUnwindSafe for LocalBlobStore
impl Send for LocalBlobStore
impl Sync for LocalBlobStore
impl Unpin for LocalBlobStore
impl UnsafeUnpin for LocalBlobStore
impl UnwindSafe for LocalBlobStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more