Struct fluvio_stream_dispatcher::store::LocalStore [−][src]
pub struct LocalStore<S, C> where
S: Spec,
C: MetadataItem, { /* fields omitted */ }
Expand description
Idempotent local memory cache of meta objects.
There are only 2 write operations are permitted: sync and apply changes which are idempotent.
For read, read guards are provided which provide hash map API using deref.
Hash values are wrapped in EpochCounter. EpochCounter is also deref.
Using async lock to ensure read/write are thread safe.
Implementations
pub fn bulk_new<N>(objects: Vec<N, Global>) -> LocalStore<S, C> where
N: Into<MetadataStoreObject<S, C>>,
pub fn bulk_new<N>(objects: Vec<N, Global>) -> LocalStore<S, C> where
N: Into<MetadataStoreObject<S, C>>,
initialize local stores with list of metadata objects
create arc wrapper
pub async fn read<'a>(
&'_ self
) -> RwLockReadGuard<'_, DualEpochMap<<S as Spec>::IndexKey, MetadataStoreObject<S, C>>>
pub async fn read<'a>(
&'_ self
) -> RwLockReadGuard<'_, DualEpochMap<<S as Spec>::IndexKey, MetadataStoreObject<S, C>>>
Read guard
pub async fn write<'a>(
&'_ self
) -> RwLockWriteGuard<'_, DualEpochMap<<S as Spec>::IndexKey, MetadataStoreObject<S, C>>>
pub async fn write<'a>(
&'_ self
) -> RwLockWriteGuard<'_, DualEpochMap<<S as Spec>::IndexKey, MetadataStoreObject<S, C>>>
write guard, this is private, use sync API to make changes
initial epoch that should be used store will always have epoch greater than init_epoch if there are any changes
copy of the value
copy spec
iterate over entry
pub async fn contains_key<K>(&'_ self, key: &'_ K) -> bool where
K: Eq + Hash + ?Sized,
<S as Spec>::IndexKey: Borrow<K>,
create new change listener
pub async fn sync_all(
&'_ self,
incoming_changes: Vec<MetadataStoreObject<S, C>, Global>
) -> SyncStatus
pub async fn sync_all(
&'_ self,
incoming_changes: Vec<MetadataStoreObject<S, C>, Global>
) -> SyncStatus
sync with incoming changes as source of truth. any objects not in incoming list will be deleted after sync operation, prior history will be removed and any subsequent change query will return full list instead of changes
pub async fn apply_changes(
&'_ self,
changes: Vec<LSUpdate<S, C>, Global>
) -> Option<SyncStatus>
pub async fn apply_changes(
&'_ self,
changes: Vec<LSUpdate<S, C>, Global>
) -> Option<SyncStatus>
apply changes to this store if item doesn’t exit, it will be treated as add if item exist but different, it will be treated as updated epoch will be only incremented if there are actual changes which means this is idempotent operations. same add result in only 1 single epoch increase.
Trait Implementations
impl<S, C> Debug for LocalStore<S, C> where
S: Debug + Spec,
C: Debug + MetadataItem,
<S as Spec>::IndexKey: Debug,
impl<S, C> Debug for LocalStore<S, C> where
S: Debug + Spec,
C: Debug + MetadataItem,
<S as Spec>::IndexKey: Debug,
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl<S, C> !RefUnwindSafe for LocalStore<S, C>
impl<S, C> Send for LocalStore<S, C> where
C: Send,
S: Send,
<S as Spec>::IndexKey: Send,
<S as Spec>::Status: Send,
impl<S, C> Sync for LocalStore<S, C> where
C: Send + Sync,
S: Send + Sync,
<S as Spec>::IndexKey: Send + Sync,
<S as Spec>::Status: Send + Sync,
impl<S, C> Unpin for LocalStore<S, C> where
C: Unpin,
S: Unpin,
<S as Spec>::IndexKey: Unpin,
<S as Spec>::Status: Unpin,
impl<S, C> UnwindSafe for LocalStore<S, C> where
C: UnwindSafe,
S: UnwindSafe,
<S as Spec>::IndexKey: UnwindSafe,
<S as Spec>::Status: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more