logo

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 the OffsetMap.

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.

Returns true if this OffsetMap does not contain any events

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

Counts the number of offsets spanned by this OffsetMap.

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

Update entry for source if the given offset is larger than the stored one and return the previous offset for this source

Trait Implementations

Performs the += operation. Read more

Performs the += operation. Read more

Performs the conversion.

The resulting type after applying the & operator.

Performs the & operation. Read more

The resulting type after applying the & operator.

Performs the & operation. Read more

Performs the &= operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

The resulting type after applying the | operator.

Performs the | operation. Read more

Performs the |= operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Decode from an impl Read. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Encodes into a impl Write. Read more

Performs the conversion.

Performs the conversion.

Creates a value from an iterator. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. 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

Blanket Implementations

Gets the TypeId of self. Read more

Casts the value.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Casts the value.

Casts the value.

Casts the value.

Compare self to key and return true if they are equal.

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Casts the value.

OverflowingCasts the value.

Scrape the references from an impl Read. Read more

Should always be Self

Casts the value.

Casts the value.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Casts the value.

UnwrappedCasts the value.

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.