dxFeed Graal CXX API v4.2.0
|
#include <EventFlag.hpp>
Public Member Functions | |
EventFlag () noexcept | |
Creates the invalid event flag. | |
std::uint32_t | getFlag () const noexcept |
bool | in (std::uint32_t eventFlagsMask) const noexcept |
Determines if the given flag is in the mask. | |
template<typename EventFlagsMask> | |
bool | in (const EventFlagsMask &eventFlagsMask) const noexcept |
Determines if the given flag is in the mask. | |
Static Public Member Functions | |
template<typename Event> | |
static bool | isSnapshotBegin (const std::shared_ptr< Event > &event) |
Determines if the given event marks the beginning of a snapshot. | |
template<typename Event> | |
static bool | isSnapshotEnd (const std::shared_ptr< Event > &event) |
Determines if the given event marks the end of a snapshot. | |
template<typename Event> | |
static bool | isSnapshotSnip (const std::shared_ptr< Event > &event) |
Determines if the given event is marked as a snapshot snip. | |
template<typename Event> | |
static bool | isSnapshotEndOrSnip (const std::shared_ptr< Event > &event) |
Determines if the given event marks the end of a snapshot or a snapshot snip. | |
template<typename Event> | |
static bool | isPending (const std::shared_ptr< Event > &event) |
Determines if the given event is in a pending state. | |
template<typename Event> | |
static bool | isRemove (const std::shared_ptr< Event > &event) |
Determines if the given event is marked for removal. | |
Static Public Attributes | |
static const EventFlag | TX_PENDING {0x01u, "TX_PENDING"} |
0x01 - A bitmask to get transaction pending indicator from the value of eventFlags property. | |
static const EventFlag | REMOVE_EVENT {0x02u, "REMOVE_EVENT"} |
0x02 - A bitmask to get removal indicator from the value of eventFlags property. | |
static const EventFlag | SNAPSHOT_BEGIN {0x04u, "SNAPSHOT_BEGIN"} |
0x04 - A bitmask to get snapshot begin indicator from the value of eventFlags property. | |
static const EventFlag | SNAPSHOT_END {0x08u, "SNAPSHOT_END"} |
0x08 - A bitmask to get snapshot end indicator from the value of eventFlags property. | |
static const EventFlag | SNAPSHOT_SNIP {0x10u, "SNAPSHOT_SNIP"} |
0x10 - A bitmask to get snapshot snip indicator from the value of eventFlags property. | |
static const EventFlag | SNAPSHOT_MODE {0x40u, "SNAPSHOT_MODE"} |
0x40 - A bitmask to set snapshot mode indicator into the value of eventFlags property. | |
static const EventFlag | REMOVE_SYMBOL {0x80u, "REMOVE_SYMBOL"} |
0x80 - For internal use. | |
Friends | |
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. | |
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:
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.
SB
(bit 2) — SNAPSHOT_BEGIN is used to indicate when the loading of a snapshot starts.
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.
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
.
|
inlinenoexcept |
Referenced by EventFlagsMask::contains(), EventFlagsMask::EventFlagsMask(), operator&, operator&, operator&, operator&, EventFlagsMask::operator&, operator|, operator|, operator|, operator|, and EventFlagsMask::operator|.
|
inlinenoexcept |
Determines if the given flag is in the mask.
EventFlagsMask | An event flags mask type that satisfies the condition: there is a getMask method that returns std::uint32_t |
eventFlagsMask | The event flags mask. |
true
the given flag is in the mask. References in().
Referenced by in().
|
inlinenoexcept |
Determines if the given flag is in the mask.
eventFlagsMask | The event flags mask |
true
the given flag is in the mask.
|
inlinestatic |
Determines if the given event is in a pending state.
Event | The event's type. |
event | The event to be checked. |
true
if the event flags indicate a pending transaction, false
otherwise. References TX_PENDING.
|
inlinestatic |
Determines if the given event is marked for removal.
Event | The event's type. |
event | The event to be checked. |
true
if the event flags indicate a remove action, false
otherwise. References REMOVE_EVENT.
|
inlinestatic |
Determines if the given event marks the beginning of a snapshot.
Event | The event's type. |
event | The event to be checked. |
true
if the event flags indicate the beginning of a snapshot, false
otherwise. References SNAPSHOT_BEGIN.
|
inlinestatic |
Determines if the given event marks the end of a snapshot.
Event | The event's type. |
event | The event to be checked. |
true
if the event flags indicate the end of a snapshot, false
otherwise. References SNAPSHOT_END.
|
inlinestatic |
Determines if the given event marks the end of a snapshot or a snapshot snip.
Event | The event's type. |
event | The event to be checked. |
true
if the event flags indicate the end or snip of a snapshot, false
otherwise.
|
inlinestatic |
Determines if the given event is marked as a snapshot snip.
Event | The event's type. |
event | The event to be checked. |
true
if the event flags indicate a snapshot snip, false
otherwise. References SNAPSHOT_SNIP.
|
friend |
Performs a bit and
operation with two event flags.
eventFlag1 | The first event flag |
eventFlag2 | The second event flag (std::int32_t) |
References getFlag().
|
friend |
Performs a bit and
operation with two event flags.
eventFlag1 | The first event flag |
eventFlag2 | The second event flag (std::uint32_t) |
References getFlag().
|
friend |
Performs a bit and
operation with two event flags.
eventFlag1 | The first event flag (std::int32_t) |
eventFlag2 | The second event flag |
References getFlag().
|
friend |
Performs a bit and
operation with two event flags.
eventFlag1 | The first event flag (std::uint32_t) |
eventFlag2 | The second event flag |
References getFlag().
|
friend |
Performs a bit or
operation with two event flags.
eventFlag1 | The first event flag |
eventFlag2 | The second event flag (std::int32_t) |
References getFlag().
|
friend |
Performs a bit or
operation with two event flags.
eventFlag1 | The first event flag |
eventFlag2 | The second event flag (std::uint32_t) |
References getFlag().
|
friend |
Performs a bit or
operation with two event flags.
eventFlag1 | The first event flag (std::int32_t) |
eventFlag2 | The second event flag |
References getFlag().
|
friend |
Performs a bit or
operation with two event flags.
eventFlag1 | The first event flag (std::uint32_t) |
eventFlag2 | The second event flag |
References getFlag().
|
static |
0x02
- A bitmask to get removal indicator from the value of eventFlags property.
Referenced by isRemove().
|
static |
0x80
- For internal use.
Marks a subscription for deletion.
|
static |
0x04
- A bitmask to get snapshot begin indicator from the value of eventFlags property.
Referenced by isSnapshotBegin().
|
static |
0x08
- A bitmask to get snapshot end indicator from the value of eventFlags property.
Referenced by isSnapshotEnd().
|
static |
0x40
- A bitmask to set snapshot mode indicator into the value of eventFlags property.
This flag is intended for publishing only.
|
static |
0x10
- A bitmask to get snapshot snip indicator from the value of eventFlags property.
Referenced by isSnapshotSnip().
|
static |
0x01
- A bitmask to get transaction pending indicator from the value of eventFlags property.
Referenced by isPending().