#[non_exhaustive]pub struct Guard {
pub query: Query,
pub after: Option<SequencePosition>,
}Expand description
One clause of an AppendCondition: a query and the boundary it is checked
from.
#[non_exhaustive] with public fields, which is a deliberate asymmetry
rather than an oversight: a replication hub must be able to read after
on a peer-supplied condition in order to refuse it, and must not be able to
fabricate one. Downstream, Guard { query, .. } in a pattern and
guard.after as a read both compile; Guard { query, after } as an
expression is error[E0639].
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.query: QueryThe append is rejected if the store holds any event matching this.
after: Option<SequencePosition>Restricts this guard to events after this position, exclusive.
None checks the entire log. Set it to the last position the caller
observed for this query, so that events it already accounted for do
not reject its own append.
Implementations§
Source§impl Guard
impl Guard
Sourcepub fn is_violated_by(
&self,
position: SequencePosition,
event_type: &EventType,
tags: &Tags,
) -> bool
pub fn is_violated_by( &self, position: SequencePosition, event_type: &EventType, tags: &Tags, ) -> bool
Whether an event at position would violate this guard alone.