pub struct Engine { /* private fields */ }
Expand description
Main engine that combines maplet with storage
Implementations§
Source§impl Engine
impl Engine
Sourcepub async fn new(config: EngineConfig) -> Result<Engine, MapletError>
pub async fn new(config: EngineConfig) -> Result<Engine, MapletError>
Create a new engine with the given configuration
Sourcepub async fn set(&self, key: String, value: Vec<u8>) -> Result<(), MapletError>
pub async fn set(&self, key: String, value: Vec<u8>) -> Result<(), MapletError>
Set a key-value pair
Sourcepub async fn clear(&self) -> Result<(), MapletError>
pub async fn clear(&self) -> Result<(), MapletError>
Clear all data
Sourcepub async fn flush(&self) -> Result<(), MapletError>
pub async fn flush(&self) -> Result<(), MapletError>
Flush data to persistent storage
Sourcepub async fn close(&self) -> Result<(), MapletError>
pub async fn close(&self) -> Result<(), MapletError>
Close the engine and cleanup resources
Sourcepub async fn stats(&self) -> Result<EngineStats, MapletError>
pub async fn stats(&self) -> Result<EngineStats, MapletError>
Get engine statistics
Sourcepub async fn memory_usage(&self) -> Result<u64, MapletError>
pub async fn memory_usage(&self) -> Result<u64, MapletError>
Get memory usage in bytes
Sourcepub fn persistence_mode(&self) -> PersistenceMode
pub fn persistence_mode(&self) -> PersistenceMode
Get the persistence mode
Sourcepub fn config(&self) -> &EngineConfig
pub fn config(&self) -> &EngineConfig
Get the engine configuration
Sourcepub async fn expire(
&self,
key: &str,
ttl_seconds: u64,
) -> Result<bool, MapletError>
pub async fn expire( &self, key: &str, ttl_seconds: u64, ) -> Result<bool, MapletError>
Set TTL for a key
Auto Trait Implementations§
impl Freeze for Engine
impl !RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl !UnwindSafe for Engine
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