pub struct MemoryStore { /* private fields */ }
Expand description
In-memory implementation of a RecordStore
.
Implementations
sourceimpl MemoryStore
impl MemoryStore
sourcepub fn new(local_id: PeerId) -> MemoryStore
pub fn new(local_id: PeerId) -> MemoryStore
Creates a new MemoryRecordStore
with a default configuration.
sourcepub fn with_config(local_id: PeerId, config: MemoryStoreConfig) -> MemoryStore
pub fn with_config(local_id: PeerId, config: MemoryStoreConfig) -> MemoryStore
Creates a new MemoryRecordStore
with the given configuration.
Trait Implementations
sourceimpl<'a> RecordStore<'a> for MemoryStore
impl<'a> RecordStore<'a> for MemoryStore
type RecordsIter = Map<Values<'a, Key, Record>, fn(&'a Record) -> Cow<'a, Record>>
type ProvidedIter = Map<Iter<'a, ProviderRecord>, fn(&'a ProviderRecord) -> Cow<'a, ProviderRecord>>
sourcepub fn get(&'a self, k: &Key) -> Option<Cow<'a, Record>>
pub fn get(&'a self, k: &Key) -> Option<Cow<'a, Record>>
Gets a record from the store, given its key.
sourcepub fn records(&'a self) -> <MemoryStore as RecordStore<'a>>::RecordsIter
pub fn records(&'a self) -> <MemoryStore as RecordStore<'a>>::RecordsIter
Gets an iterator over all (value-) records currently stored.
sourcepub fn add_provider(&'a mut self, record: ProviderRecord) -> Result<(), Error>
pub fn add_provider(&'a mut self, record: ProviderRecord) -> Result<(), Error>
Adds a provider record to the store. Read more
sourcepub fn providers(&'a self, key: &Key) -> Vec<ProviderRecord, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn providers(&'a self, key: &Key) -> Vec<ProviderRecord, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Gets a copy of the stored provider records for the given key.
sourcepub fn provided(&'a self) -> <MemoryStore as RecordStore<'a>>::ProvidedIter
pub fn provided(&'a self) -> <MemoryStore as RecordStore<'a>>::ProvidedIter
Gets an iterator over all stored provider records for which the node owning the store is itself the provider. Read more
sourcepub fn remove_provider(&'a mut self, key: &Key, provider: &PeerId)
pub fn remove_provider(&'a mut self, key: &Key, provider: &PeerId)
Removes a provider record from the store.
Auto Trait Implementations
impl RefUnwindSafe for MemoryStore
impl Send for MemoryStore
impl Sync for MemoryStore
impl Unpin for MemoryStore
impl UnwindSafe for MemoryStore
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more