Skip to main content

FileStore

Struct FileStore 

Source
pub struct FileStore { /* private fields */ }
Expand description

A file-based storage implementation that stores each key-value pair as a separate file.

Uses CSV serialization with URL-encoded filenames for human-readable storage. Each record is stored in a .dat file within the configured directory.

Implementations§

Source§

impl FileStore

Source

pub fn new(data_dir: impl Into<PathBuf>) -> Result<Self>

Creates a new FileStore instance at the specified directory.

Creates the directory if it doesn’t exist.

§Errors

Returns an error if the directory cannot be created.

Trait Implementations§

Source§

impl Debug for FileStore

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Repository for FileStore

Source§

type K = String

Key type for the repository (the buffer type, e.g., Vec or String).
Source§

type V = String

Value type for the repository (the buffer type, e.g., Vec or String).
Source§

type Error = FileStoreError

Error type returned by repository operations.
Source§

fn insert_entry(&mut self, key: &str, value: &str) -> Result<(), Self::Error>

Insert a key-value pair into the repository. Read more
Source§

fn get_entry(&self, key: &str) -> Result<Option<Self::V>, Self::Error>

Retrieve the value associated with the given key from the repository. Read more
Source§

fn remove_entry(&mut self, key: &str) -> Result<Option<Self::V>, Self::Error>

Remove the value associated with the given key from the repository. Read more
Source§

fn scan_range( &self, range: Range<Self::K>, ) -> Result<impl Iterator<Item = Result<Self::K, Self::Error>>, Self::Error>

Iterate over the keys in the repository that are in range. Read more
Source§

fn apply<'a>( &mut self, operations: impl Iterator<Item = BatchOp<'a, Self::K, Self::V>>, ) -> Result<(), Self::Error>

Execute mixed insert and delete operations. Read more
Source§

impl Storage for FileStore

Source§

type Repo = FileStore

The repository type that this storage uses for low-level key-value operations.
Source§

type KeyUnifier = CsvSerializer

Unifier type used to serialize/deserialize keys.
Source§

type ValueUnifier = CsvSerializer

Unifier type used to serialize/deserialize values.
Source§

type Container = Vec<BufferOp>

Container for buffer operations that can be applied to the repository.
Source§

fn repository(&self) -> &Self::Repo

Returns a reference to the underlying repository.
Source§

fn repository_mut(&mut self) -> &mut Self::Repo

Returns a mutable reference to the underlying repository.

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.