pub struct PrefixState {
pub prefix: String,
pub latest_event_id: AtomicI64,
pub ready: AtomicBool,
pub notify: Sender<()>,
/* private fields */
}Expand description
State for one watched prefix: the cache subtree, the watch cursor, and a notifier that wakes long-pollers whenever anything under this prefix changes.
Fields§
§prefix: String§latest_event_id: AtomicI64§ready: AtomicBool§notify: Sender<()>Sends a () whenever any item under this prefix changes (set,
delete, or snapshot replace). Long-pollers subscribe to this and
re-check after each notification.
Implementations§
Source§impl PrefixState
impl PrefixState
pub fn new(prefix: String) -> Self
pub fn get(&self, key: &str) -> Option<CacheEntry>
pub fn list(&self) -> Vec<(String, CacheEntry)>
pub fn upsert(&self, key: String, value: Value, event_id: i64)
pub fn remove(&self, key: &str, event_id: i64)
pub fn replace_snapshot( &self, items: HashMap<String, CacheEntry>, latest_event_id: i64, )
Auto Trait Implementations§
impl !Freeze for PrefixState
impl !RefUnwindSafe for PrefixState
impl !UnwindSafe for PrefixState
impl Send for PrefixState
impl Sync for PrefixState
impl Unpin for PrefixState
impl UnsafeUnpin for PrefixState
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