Struct actyx_sdk::OffsetMap [−][src]
pub struct OffsetMap(_);
Expand description
Multi-dimensional cursor for event streams: an OffsetMap
describes the set of events
given by the event streams of each included source up to the associated Offset
.
All stream delivery modes supported by the Event Service respect the order of offsets of the events published by each single Actyx node. This order is consistent with the Lamport timestamp order because both numbers are assigned to published events in strictly monotonically increasing fashion, i.e. greater offset implies greater Lamport timestamp and vice versa.
Note that if the
OffsetMap
contains offset 42 for StreamId"abc.0"
it denotes that events with offsets 0 through 42 (inclusive) are included within theOffsetMap
.
A common usage pattern is to store the OffsetMap
describing the events already consumed
from an event stream together with the computation results from processing those events
(preferably within the same database transaction, if applicable). When restarting the
process, this OffsetMap
can be read and the stream can be resumed from where the process
left off previously.
Arithmetics
OffsetMap
has a partial order: when the set of events described by one is a strict
subset of the set of events described by another, then one is said to be smaller than
the other. It may be that one OffsetMap
contains events that the other does not and vice
versa, in which case they are incomparable (partial_cmp
will return None
).
An event may be added into an OffsetMap
to denote that from the event’s stream all events
up to this one shall be included in the OffsetMap
.
The difference of two offset maps yields the number of events contained within the first but not within the second one (i.e. it counts the size of the difference set).
Deserialization
An OffsetMap
only contains valid offsets (non-negative numbers), but during deserialization
negative values are tolerated and ignored. This is to keep compatibility with previously
documented API endpoints.
Implementations
The empty OffsetMap
is equivalent to the beginning of time, it does not contain any
event.
Check whether the given Event’s offset and source ID are contained within this OffsetMap
.
Check whether the given stream contributes to the set of events in this OffsetMap
Retrieve the offset stored for the given source
The returned value is OffsetOrMin::MIN
if nothing is stored for the given source.
Retrieves the offset stored for the given source
Merge the other OffsetMap into this one, taking the union of their event sets.
Compute the union of two sets of events described by OffsetMaps
Compute the intersection of two sets of events described by OffsetMaps
Compute the intersection of two sets of events described by OffsetMaps
An iterator over all streams that contribute events to this OffsetMap
An iterator over all streams that contribute events to this OffsetMap including their offset
Trait Implementations
Performs the +=
operation. Read more
Performs the +=
operation. Read more
Performs the &=
operation. Read more
Performs the |=
operation. Read more
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>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Ensure that the given event is no longer contained within this OffsetMap.
Ensure that the given event is no longer contained within this OffsetMap.
Auto Trait Implementations
impl RefUnwindSafe for OffsetMap
impl UnwindSafe for OffsetMap
Blanket Implementations
Mutably borrows from an owned value. Read more
Casts the value.
Casts the value.
Compare self to key
and return true
if they are equal.
Performs the conversion.
Performs the conversion.
Casts the value.
OverflowingCasts the value.
Casts the value.
Casts the value.
Casts the value.
UnwrappedCasts the value.
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Casts the value.
WrappingCasts the value.