|
std::int32_t | operator| (const EventFlag &eventFlag1, std::int32_t eventFlag2) noexcept |
| Performs a bit or operation with two event flags.
|
|
std::int32_t | operator| (std::int32_t eventFlag1, const EventFlag &eventFlag2) noexcept |
| Performs a bit or operation with two event flags.
|
|
std::int32_t | operator& (const EventFlag &eventFlag1, std::int32_t eventFlag2) noexcept |
| Performs a bit and operation with two event flags.
|
|
std::int32_t | operator& (std::int32_t eventFlag1, const EventFlag &eventFlag2) noexcept |
| Performs a bit and operation with two event flags.
|
|
std::uint32_t | operator| (const EventFlag &eventFlag1, std::uint32_t eventFlag2) noexcept |
| Performs a bit or operation with two event flags.
|
|
std::uint32_t | operator| (std::uint32_t eventFlag1, const EventFlag &eventFlag2) noexcept |
| Performs a bit or operation with two event flags.
|
|
std::uint32_t | operator& (const EventFlag &eventFlag1, std::uint32_t eventFlag2) noexcept |
| Performs a bit and operation with two event flags.
|
|
std::uint32_t | operator& (std::uint32_t eventFlag1, const EventFlag &eventFlag2) noexcept |
| Performs a bit and operation with two event flags.
|
|
Event flags, transactions and snapshots
Some indexed event sources provide a consistent view of a set of events for a given symbol. Their updates may incorporate multiple changes that have to be processed at the same time. The corresponding information is carried in eventFlags property.
The value of eventFlags property has several significant bits that are packed into an integer in the following way:
31..7 6 5 4 3 2 1 0
+---------+----+----+----+----+----+----+----+
| | SM | | SS | SE | SB | RE | TX |
+---------+----+----+----+----+----+----+----+
Each source updates its transactional state using these bits separately. The state of each source has to be tracked separately in a map for each source. However, event index is unique across the sources. This is achieved by allocating an event-specific number of most significant bits of index for use as a source id.
TX
(bit 0) — TX_PENDING is an indicator of pending transactional update. It can be retrieved from eventFlags
with the following piece of code:
static const EventFlag TX_PENDING
0x01 - A bitmask to get transaction pending indicator from the value of eventFlags property.
Definition IndexedEvent.hpp:44
When txPending
is true
it means, that an ongoing transaction update that spans multiple events is in process. All events with txPending
true
shall be put into a separate pending list for each source id and should be processed later when an event for this source id with txPending
false
comes.
RE
(bit 1) — REMOVE_EVENT is used to indicate that that the event with the corresponding index has to be removed.
static const EventFlag REMOVE_EVENT
0x02 - A bitmask to get removal indicator from the value of eventFlags property.
Definition IndexedEvent.hpp:47
SB
(bit 2) — SNAPSHOT_BEGIN is used to indicate when the loading of a snapshot starts.
static const EventFlag SNAPSHOT_BEGIN
0x04 - A bitmask to get snapshot begin indicator from the value of eventFlags property.
Definition IndexedEvent.hpp:50
Snapshot load starts on new subscription and the first indexed event that arrives for each non-zero source id on new subscription may have snapshotBegin
set to true
. It means, that an ongoing snapshot consisting of multiple events is incoming. All events for this source id shall be put into a separate pending list for each source id.
SE
(bit 3) — SNAPSHOT_END or SS
(bit 4) — SNAPSHOT_SNIP are used to indicate the end of a snapshot.
static const EventFlag SNAPSHOT_SNIP
0x10 - A bitmask to get snapshot snip indicator from the value of eventFlags property.
Definition IndexedEvent.hpp:56
static const EventFlag SNAPSHOT_END
0x08 - A bitmask to get snapshot end indicator from the value of eventFlags property.
Definition IndexedEvent.hpp:53
The last event of a snapshot is marked with either snapshotEnd
or snapshotSnip
. At this time, all events from a pending list for the corresponding source can be processed, unless txPending
is also set to true
. In the later case, the processing shall be further delayed due to ongoing transaction.
The difference between snapshotEnd
and snapshotSnip
is the following. snapshotEnd
indicates that the data source had sent all the data pertaining to the subscription for the corresponding indexed event, while snapshotSnip
indicates that some limit on the amount of data was reached and while there still might be more data available, it will not be provided.
SM
(bit 6) — SNAPSHOT_MODE is used to instruct dxFeed to use snapshot mode. It is intended to be used only for publishing to activate (if not yet activated) snapshot mode. The difference from SNAPSHOT_BEGIN flag is that SNAPSHOT_MODE only switches on snapshot mode without starting snapshot synchronization protocol.
When a snapshot is empty or consists of a single event, then the event can have both snapshotBegin
and snapshotEnd
or snapshotSnip
flags. In case of an empty snapshot, removeEvent
on this event is also set to true
.