[−][src]Struct fluvio_controlplane_metadata::store::LocalStore
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
impl<S, C> LocalStore<S, C> where
C: MetadataItem,
S: Spec,
[src]
C: MetadataItem,
S: Spec,
pub fn bulk_new<N>(objects: Vec<N, Global>) -> LocalStore<S, C> where
N: Into<MetadataStoreObject<S, C>>,
[src]
N: Into<MetadataStoreObject<S, C>>,
initialize local stores with list of metadata objects
pub fn new_shared() -> Arc<LocalStore<S, C>>
[src]
create arc wrapper
pub async fn read<'a>(
&'_ self
) -> RwLockReadGuard<'_, DualEpochMap<<S as Spec>::IndexKey, MetadataStoreObject<S, C>>>
[src]
&'_ 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>>>
[src]
&'_ self
) -> RwLockWriteGuard<'_, DualEpochMap<<S as Spec>::IndexKey, MetadataStoreObject<S, C>>>
write guard, this is private, use sync API to make changes
pub async fn epoch(&'_ self) -> i64
[src]
current epoch
pub fn init_epoch(&self) -> DualEpochCounter<()>
[src]
initial epoch that should be used store will always have epoch greater than init_epoch if there are any changes
pub async fn value<K>(
&'_ self,
key: &'_ K
) -> Option<DualEpochCounter<MetadataStoreObject<S, C>>> where
K: Eq + Hash + ?Sized,
<S as Spec>::IndexKey: Borrow<K>,
[src]
&'_ self,
key: &'_ K
) -> Option<DualEpochCounter<MetadataStoreObject<S, C>>> where
K: Eq + Hash + ?Sized,
<S as Spec>::IndexKey: Borrow<K>,
copy of the value
pub async fn spec<K>(&'_ self, key: &'_ K) -> Option<S> where
K: Eq + Hash + ?Sized,
<S as Spec>::IndexKey: Borrow<K>,
[src]
K: Eq + Hash + ?Sized,
<S as Spec>::IndexKey: Borrow<K>,
copy spec
pub async fn find_and_do<K, F>(&'_ self, key: &'_ K, func: F) -> Option<()> where
K: Eq + Hash,
F: FnMut(&MetadataStoreObject<S, C>),
<S as Spec>::IndexKey: Borrow<K>,
[src]
K: Eq + Hash,
F: FnMut(&MetadataStoreObject<S, C>),
<S as Spec>::IndexKey: Borrow<K>,
iterate over entry
pub async fn contains_key<K>(&'_ self, key: &'_ K) -> bool where
K: Eq + Hash + ?Sized,
<S as Spec>::IndexKey: Borrow<K>,
[src]
K: Eq + Hash + ?Sized,
<S as Spec>::IndexKey: Borrow<K>,
pub async fn count(&'_ self) -> i32
[src]
pub async fn clone_specs(&'_ self) -> Vec<S, Global>
[src]
pub async fn clone_keys(&'_ self) -> Vec<<S as Spec>::IndexKey, Global>
[src]
pub async fn clone_values(&'_ self) -> Vec<MetadataStoreObject<S, C>, Global>
[src]
pub fn event_publisher(&self) -> &EventPublisher
[src]
pub fn change_listener(self: &Arc<LocalStore<S, C>>) -> ChangeListener<S, C>
[src]
create new change listener
impl<S, C> LocalStore<S, C> where
C: MetadataItem + PartialEq<C>,
S: Spec + PartialEq<S>,
<S as Spec>::Status: PartialEq<<S as Spec>::Status>,
<S as Spec>::IndexKey: Display,
[src]
C: MetadataItem + PartialEq<C>,
S: Spec + PartialEq<S>,
<S as Spec>::Status: PartialEq<<S as Spec>::Status>,
<S as Spec>::IndexKey: Display,
pub async fn sync_all(
&'_ self,
incoming_changes: Vec<MetadataStoreObject<S, C>, Global>
) -> SyncStatus
[src]
&'_ 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>
[src]
&'_ 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
C: Debug + MetadataItem,
S: Debug + Spec,
<S as Spec>::IndexKey: Debug,
[src]
C: Debug + MetadataItem,
S: Debug + Spec,
<S as Spec>::IndexKey: Debug,
impl<S, C> Default for LocalStore<S, C> where
C: MetadataItem,
S: Spec,
[src]
C: MetadataItem,
S: Spec,
pub fn default() -> LocalStore<S, C>
[src]
impl<S, C> Display for LocalStore<S, C> where
C: MetadataItem,
S: Spec,
[src]
C: MetadataItem,
S: Spec,
Auto Trait Implementations
impl<S, C> !RefUnwindSafe for LocalStore<S, C>
[src]
impl<S, C> Send for LocalStore<S, C> where
C: Send,
S: Send,
<S as Spec>::IndexKey: Send,
<S as Spec>::Status: Send,
[src]
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,
[src]
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,
[src]
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,
[src]
C: UnwindSafe,
S: UnwindSafe,
<S as Spec>::IndexKey: UnwindSafe,
<S as Spec>::Status: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,