pub struct SledStorage { /* private fields */ }Expand description
Sled-based persistent storage backend
Uses the sled embedded database for high-performance, persistent storage. This is recommended for:
- Large datasets
- High write throughput
- Production applications
Sled provides:
- ACID transactions
- High performance
- Automatic crash recovery
- Efficient storage format
§Thread Safety
SledStorage is thread-safe and can be shared across threads using Arc<SledStorage>.
§Example
use gun::storage::{Storage, SledStorage};
use gun::state::Node;
use std::sync::Arc;
let storage = Arc::new(SledStorage::new("./gun_data")?);
let node = Node::with_soul("user_123".to_string());
storage.put("user_123", &node).await?;Implementations§
Trait Implementations§
Source§impl Storage for SledStorage
impl Storage for SledStorage
Source§fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
soul: &'life1 str,
) -> Pin<Box<dyn Future<Output = GunResult<Option<Node>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get<'life0, 'life1, 'async_trait>(
&'life0 self,
soul: &'life1 str,
) -> Pin<Box<dyn Future<Output = GunResult<Option<Node>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieve a node by its soul (unique identifier) Read more
Source§fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
soul: &'life1 str,
node: &'life2 Node,
) -> Pin<Box<dyn Future<Output = GunResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn put<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
soul: &'life1 str,
node: &'life2 Node,
) -> Pin<Box<dyn Future<Output = GunResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Store a node by its soul (unique identifier) Read more
Auto Trait Implementations§
impl Freeze for SledStorage
impl !RefUnwindSafe for SledStorage
impl Send for SledStorage
impl Sync for SledStorage
impl Unpin for SledStorage
impl !UnwindSafe for SledStorage
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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