Enum Op
pub enum Op {
Append {
events: Vec<Event>,
},
AppendConditional {
events: Vec<Event>,
query: Query,
anchor: Anchor,
},
#[non_exhaustive] Read {
query: Query,
from: Anchor,
to: Anchor,
backwards: bool,
limit: Option<usize>,
},
}proptest only.Expand description
One generated operation against the store under test.
The three are the whole of the port’s surface: an unconditional append, a
conditional one, and a read. There is deliberately no empty-batch variant —
ES-20’s ordering of NoEvents against ConditionViolated is pinned by two
named rules, and generating it here would re-assert a settled thing in a test
whose failures are harder to read.
Variants§
Append
Append a batch with no condition.
AppendConditional
Append a batch guarded by a condition whose boundary is symbolic.
Fields
#[non_exhaustive]Read
Read, with every read option in play.
All five, since phase 12. The doc line above said “every read option”
while the variant carried four of them, and the missing one was to —
which made the two to branches of the model’s select dead code under a
comment explaining why a model that ignores an option is worthless. A
wrong store this file could not disagree with, WHERE a OR b AND position <= ?, is registered as UnparenthesisedToPredicateStore and is what
closing this bought.
#[non_exhaustive] on the variant, so no downstream crate can build
one directly and a downstream match must carry ... It landed in the
release after to did, and deliberately not before: to’s arrival is
the evidence for it. ReadOptions upstream is #[non_exhaustive] and
grew to at phase 4 without breaking anybody; this variant mirrors that
type option-for-option, did not carry the attribute, and so took the
break ReadOptions was spared. limit’s own note below already names
the next widening (VT-28), which is the same hole staying open.
This is not the thing RS-13-5 forbids, and the distinction is the
whole reason it is here rather than on Op. That rule is about an
enum designed not to grow, and Op is exactly that — its own doc
above says the three are the whole of the port’s surface and argues a
fourth out of existence. Enum-level would cost every downstream match
a _ => arm forever, and permanently stop the compiler reporting a
variant nobody will add. Variant-level costs a .. in one arm and buys
the field additivity the variant demonstrably needs. Matching stays
legal; construction does not.
Downstream, the struct spelling is the only one that matches, the
same way it is for Query::Items — though the E0603 edge that rule
records does not arise here, because this is a struct-form variant and
has no tuple constructor to be made private.
Fields
This variant is marked as non-exhaustive
to: AnchorThe inclusive to bound — the stopping end, which is the higher
position reading forwards and the lower one reading backwards.
Generated independently of from, and the pairs where the two cross
are kept rather than filtered out. A window whose ends are the wrong
way round is an empty read, both here and in a conformant store, and
an adapter that answers it with anything else is exactly the kind of
thing this family exists to find.