SingleNodeEngine

Struct SingleNodeEngine 

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

Single-node key-value engine with worker threads and automatic compaction.

Implementations§

Source§

impl SingleNodeEngine

Source

pub fn new() -> Result<Self>

Creates a new engine with default configuration.

Source

pub fn with_config(config: StoreConfig) -> Result<Self>

Creates a new engine with the specified configuration.

Source

pub fn put(&self, key: Vec<u8>, value: Vec<u8>) -> Result<ApplyOutcome>

Inserts or updates a key-value pair.

Source

pub fn delete(&self, key: Vec<u8>) -> Result<ApplyOutcome>

Deletes a key from the store.

Source

pub fn len(&self) -> usize

Returns the number of keys in the store.

Source

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

Flushes pending writes to disk.

Source

pub fn submit_batch<I>(&self, commands: I) -> Result<Vec<ApplyOutcome>>
where I: IntoIterator<Item = Command>,

Submits a batch of commands for execution.

Source

pub fn read_with<F, R>(&self, reader: F) -> R
where F: FnOnce(&KvState) -> R,

Executes a read operation with a consistent snapshot of the state.

Source

pub fn run_compaction_now(&self) -> Result<()>

Triggers an immediate compaction run.

Source

pub fn get_prefix(&self, prefix: &[u8]) -> Result<Vec<(Vec<u8>, Vec<u8>)>>

Retrieves all key-value pairs with the given prefix.

Source

pub fn into_argon2_hasher_aes_gcm_auth_service( self, master_key: [u8; 32], ) -> (Arc<SingleNodeEngine>, AuthService<Arc<SingleNodeEngine>, Argon2SecretHasher, AesGcmEncryptor>)

Wraps the engine in an Arc and constructs an AuthService configured with Argon2 hashing and AES-GCM encryption.

Trait Implementations§

Source§

impl Debug for SingleNodeEngine

Source§

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

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

impl Drop for SingleNodeEngine

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl KvEngine for SingleNodeEngine

Source§

fn submit(&self, command: Command) -> Result<ApplyOutcome>

Submits a single command for execution.
Source§

fn submit_batch<I>(&self, commands: I) -> Result<Vec<ApplyOutcome>>
where I: IntoIterator<Item = Command>,

Submits a batch of commands for execution.
Source§

fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>>

Retrieves the value for a key if it exists.
Source§

fn get_prefix(&self, prefix: &[u8]) -> Result<Vec<(Vec<u8>, Vec<u8>)>>

Retrieves all key-value pairs with the given prefix.
Source§

impl SnapshotEngine for SingleNodeEngine

Source§

fn snapshot_state(&self) -> KvState

Returns a snapshot of the current key-value state.
Source§

fn latest_version(&self) -> u64

Returns the latest version number in the store.

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> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V