Struct FileBlobStore
pub struct FileBlobStore { /* private fields */ }Expand description
NVMe-backed, O_DIRECT, single-packed-file blob store.
Construct via FileBlobStore::open. Thread-safe; the
underlying file handle is shared and pread/pwrite are
atomic at the syscall boundary.
Implementations§
§impl FileBlobStore
impl FileBlobStore
pub fn open<P: Into<PathBuf>>(data_dir: P) -> Result<Self>
pub fn open<P: Into<PathBuf>>(data_dir: P) -> Result<Self>
Open or create a persistent store at data_dir.
Creates the directory if missing. On Linux opens the packed
data file with O_DIRECT | O_CLOEXEC; on other Unixes opens
with O_CLOEXEC only (macOS additionally sets F_NOCACHE).
Loads the manifest if present; otherwise starts empty.
Trait Implementations§
§impl BlobStore for FileBlobStore
impl BlobStore for FileBlobStore
§fn alloc_blob_buf_zeroed(&self) -> AlignedBlobBuf
fn alloc_blob_buf_zeroed(&self) -> AlignedBlobBuf
Allocate a zero-filled blob buffer suitable for this store. Read more
§fn alloc_blob_buf_uninit(&self) -> AlignedBlobBuf
fn alloc_blob_buf_uninit(&self) -> AlignedBlobBuf
Allocate an uninitialized blob buffer suitable for this
store. Callers must fill all bytes before reading.
§fn read_blob(&self, guid: BlobGuid, dst: &mut AlignedBlobBuf) -> Result<()>
fn read_blob(&self, guid: BlobGuid, dst: &mut AlignedBlobBuf) -> Result<()>
Read blob
guid into dst. dst.len() == PAGE_SIZE.§fn write_blob(&self, guid: BlobGuid, src: &AlignedBlobBuf) -> Result<()>
fn write_blob(&self, guid: BlobGuid, src: &AlignedBlobBuf) -> Result<()>
§fn write_blobs(&self, writes: &[(BlobGuid, &AlignedBlobBuf)]) -> Result<()>
fn write_blobs(&self, writes: &[(BlobGuid, &AlignedBlobBuf)]) -> Result<()>
Write a batch of full-blob images. Read more
§fn write_blobs_with_data_sync(
&self,
writes: &[(BlobGuid, &AlignedBlobBuf)],
) -> Result<()>
fn write_blobs_with_data_sync( &self, writes: &[(BlobGuid, &AlignedBlobBuf)], ) -> Result<()>
Write a batch and, if the store can do it cheaply, make
the data-file bytes durable before returning. Read more
§fn delete_blob(&self, guid: BlobGuid) -> Result<()>
fn delete_blob(&self, guid: BlobGuid) -> Result<()>
Delete blob
guid. No-op if it doesn’t exist.§fn list_blobs(&self) -> Result<Vec<BlobGuid>>
fn list_blobs(&self) -> Result<Vec<BlobGuid>>
Enumerate every blob currently stored.
§fn needs_flush(&self) -> bool
fn needs_flush(&self) -> bool
Conservative hint for callers that want to skip a no-op
flush. Stores should return
true whenever a prior
returned write, delete, or metadata update still needs
Self::flush to make it durable.Auto Trait Implementations§
impl !Freeze for FileBlobStore
impl RefUnwindSafe for FileBlobStore
impl Send for FileBlobStore
impl Sync for FileBlobStore
impl Unpin for FileBlobStore
impl UnsafeUnpin for FileBlobStore
impl UnwindSafe for FileBlobStore
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