pub struct Storage { /* private fields */ }Implementations§
Source§impl Storage
impl Storage
Sourcepub fn open_with_config(config: Arc<Config>) -> Self
pub fn open_with_config(config: Arc<Config>) -> Self
Opens a storage with specified configuration and loads persisted data
pub fn sync()
Sourcepub fn lock(&self) -> MutexGuard<'_, HashMap<String, StorageItem>>
pub fn lock(&self) -> MutexGuard<'_, HashMap<String, StorageItem>>
Returns a guarded lock to access to the storage operations
Sourcepub fn global_lock(&self) -> GlobalLock<'_>
pub fn global_lock(&self) -> GlobalLock<'_>
Returns a global lock to exclusive thread access to the storage operations
Sourcepub fn insert(&self, storage_item: StorageItem)
pub fn insert(&self, storage_item: StorageItem)
Inserts an item into the storage If the storage has an item with the key present, the item will be updated
Sourcepub fn update(&self, storage_item: StorageItem)
pub fn update(&self, storage_item: StorageItem)
Updates an item into the storage The item will be inserted if the storage does not have an item with the key present
Sourcepub fn get(&self, key: &str) -> Option<StorageItem>
pub fn get(&self, key: &str) -> Option<StorageItem>
Gets an item from the storage corresponding to the key
Sourcepub fn get_inner_object<T: Decode>(&self, key: &str) -> Option<T>
pub fn get_inner_object<T: Decode>(&self, key: &str) -> Option<T>
Returns the inner object of the item corresponding to the key
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Storage
impl RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnwindSafe for Storage
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