Skip to main content

FileBlobStore

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

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.

pub fn data_dir(&self) -> &Path

Directory holding blobs.dat and manifest.bin.

pub fn len(&self) -> usize

Number of blobs in the manifest.

pub fn is_empty(&self) -> bool

True if the manifest is empty.

Trait Implementations§

§

impl BlobStore for FileBlobStore

§

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

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<()>

Read blob guid into dst. dst.len() == PAGE_SIZE.
§

fn write_blob(&self, guid: BlobGuid, src: &AlignedBlobBuf) -> Result<()>

Write src as blob guid. src.len() == PAGE_SIZE. Read more
§

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<()>

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<()>

Delete blob guid. No-op if it doesn’t exist.
§

fn list_blobs(&self) -> Result<Vec<BlobGuid>>

Enumerate every blob currently stored.
§

fn flush(&self) -> Result<()>

Wait until every previously-returned write is durable.
§

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.
§

fn has_blob(&self, guid: BlobGuid) -> Result<bool>

true iff guid exists. Default impl scans list_blobs.
§

impl Debug for FileBlobStore

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.