pub struct EventCursor { /* private fields */ }Expand description
A consumer’s durable position in the event feed.
VaultEventEnvelope::sequence restarts at zero every time the host
starts, so a bare sequence number persisted across a restart is worse than
keeping no record at all: it looks comparable to the new run’s numbering and
is not. Pairing the sequence with the epoch that issued it turns that silent
mis-resume into a question a plugin can answer — Self::resumes_on.
Serializable, so it stores directly through crate::PluginStorage.
Implementations§
Source§impl EventCursor
impl EventCursor
Sourcepub fn after(envelope: &VaultEventEnvelope) -> Self
pub fn after(envelope: &VaultEventEnvelope) -> Self
The position immediately after envelope has been applied.
Sourcepub fn epoch(&self) -> &str
pub fn epoch(&self) -> &str
The bus run that issued Self::sequence.
Sourcepub fn sequence(&self) -> u64
pub fn sequence(&self) -> u64
The last applied sequence within Self::epoch.
Sourcepub fn resumes_on(&self, bus: &HookBus) -> bool
pub fn resumes_on(&self, bus: &HookBus) -> bool
Whether this position still means something on bus.
false after a host restart, which is the case worth handling: the
plugin cannot know what changed while it was down, so it must reconcile
from crate::VaultApi::list_notes_detailed before trusting the feed.
true is not a promise that nothing was missed — a subscriber can still
fall behind within a run, which arrives separately as
HookRecvError::Lagged.
Trait Implementations§
Source§impl Clone for EventCursor
impl Clone for EventCursor
Source§fn clone(&self) -> EventCursor
fn clone(&self) -> EventCursor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventCursor
impl Debug for EventCursor
Source§impl<'de> Deserialize<'de> for EventCursor
impl<'de> Deserialize<'de> for EventCursor
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for EventCursor
Source§impl PartialEq for EventCursor
impl PartialEq for EventCursor
Source§impl Serialize for EventCursor
impl Serialize for EventCursor
impl StructuralPartialEq for EventCursor
Auto Trait Implementations§
impl Freeze for EventCursor
impl RefUnwindSafe for EventCursor
impl Send for EventCursor
impl Sync for EventCursor
impl Unpin for EventCursor
impl UnsafeUnpin for EventCursor
impl UnwindSafe for EventCursor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.