Deterministic in-memory stream of topic-neutral event envelopes. 更多...
#include <GameEvent.h>
Public 成员函数 | |
| GameEventLog (const GameEventLog &)=delete | |
| GameEventLog & | operator= (const GameEventLog &)=delete |
| GameEventLog (GameEventLog &&)=default | |
| Game event log. | |
| GameEventLog & | operator= (GameEventLog &&)=default |
| Operator =. | |
| GameEventLog ()=default | |
| Creates a stream without an implicit entropy source. | |
| GameEventLog (eve::PersistentId instanceId) | |
| Creates a stream with a persistent snapshot identity. | |
| GameEventLog (eve::UuidEntropySource entropy, eve::UuidClock clock={}) | |
| Creates a stream with an injected UUIDv7 event identity source. | |
| eve::Result< EventSequence > | append (GameEvent envelope) |
| Appends a typed-metadata envelope and assigns stream-local order. | |
| template<class Payload > | |
| eve::Result< EventSequence > | appendTyped (GameEvent envelope, const Payload &payload, const std::function< eve::Result< std::string >(const Payload &)> &encode) |
| Encodes a strongly typed domain payload and appends its envelope. | |
| const GameEvent * | find (EventSequence sequence) const |
| Returns an event by exact sequence, or nullptr. @ownership Borrowed from this stream; callers must not delete or retain it. @nullable Null when the sequence is not retained. @lifetime Until stream clear/reset/restore removes the event; a query does not invalidate this exact-sequence view. @thread GameEventLog-owner thread unless externally synchronized. @reentrancy No callbacks are made. | |
| const GameEvent * | find (uint64_t sequence) const |
Compatibility facade accepting the old untyped sequence value. @ownership Borrowed view with the same lifetime as the typed find overload. @nullable Null when the sequence is not retained. @lifetime Until stream clear/reset/restore removes the event. @thread GameEventLog-owner thread; no callback or re-entry is performed. | |
| int | queryType (const std::string &type) |
| Queries all retained events of a type in sequence order. | |
| int | querySource (const std::string &source) |
| Queries all retained events from a source in sequence order. | |
| int | querySubject (const std::string &subject) |
| Queries all retained events concerning a subject in sequence order. | |
| int | querySequence (EventSequence firstSequence) |
| Queries retained events whose sequence is at least firstSequence. | |
| int | querySequence (uint64_t firstSequence) |
| Compatibility facade accepting the old untyped sequence value. | |
| const GameEvent * | queryAt (int index) const |
| Returns one result from the latest query, or nullptr. | |
| int | size () const |
| Returns the number of retained events. | |
| const GameEvent * | at (int index) const |
| Returns a retained event by stream order, or nullptr. | |
| EventConsumer * | newConsumer (EventSequence firstSequence=EventSequence(1)) |
| Creates an independently positioned consumer cursor. | |
| EventConsumer * | newConsumer (uint64_t firstSequence) |
| Compatibility facade accepting the old untyped sequence value. | |
| void | clearBefore (EventSequence firstSequence) |
| Removes retained events with sequence lower than firstSequence. | |
| void | clearBefore (uint64_t firstSequence) |
| Compatibility facade accepting the old untyped sequence value. | |
| void | clear () |
| Removes retained events while preserving the next sequence number. | |
| void | reset () |
| Removes all state and restarts sequence allocation at one. | |
| std::string | snapshotJson () const |
| Exports stream state as deterministic compact JSON. | |
| eve::Result< void > | restore (std::string_view json) |
| Transactionally restores stream state from a snapshot. | |
| eve::Result< eve::SnapshotEnvelope > | snapshot (const eve::SnapshotHashProvider &hashProvider) const |
| Captures the stream payload in the common snapshot envelope. | |
| eve::Result< void > | restoreSnapshot (const eve::SnapshotEnvelope &snapshot, const eve::SnapshotHashProvider &hashProvider) |
| Restores a verified or migrated stream envelope atomically. | |
| eve::Result< std::string > | snapshotEnvelopeJson (const eve::SnapshotHashProvider &hashProvider) const |
| Serializes the common event-stream snapshot envelope. | |
| eve::Result< void > | restoreSnapshotJson (std::string_view json, const eve::SnapshotHashProvider &hashProvider) |
| Parses and transactionally restores a common event-stream envelope. | |
友元 | |
| class | EventConsumer |
详细描述
Deterministic in-memory stream of topic-neutral event envelopes.
Borrowed event views remain valid until the pointed event is removed by a clear, clear-before, reset, or restore operation. Query results remain available until the next query on the same stream.
在文件 GameEvent.h 第 261 行定义.
构造及析构函数说明
◆ GameEventLog() [1/5]
|
delete |
◆ GameEventLog() [2/5]
|
default |
Game event log.
◆ GameEventLog() [3/5]
|
default |
Creates a stream without an implicit entropy source.
◆ GameEventLog() [4/5]
|
inlineexplicit |
Creates a stream with a persistent snapshot identity.
在文件 GameEvent.h 第 278 行定义.
◆ GameEventLog() [5/5]
|
explicit |
Creates a stream with an injected UUIDv7 event identity source.
- 参数
-
entropy Entropy callback used only when an appended envelope has a nil ID. clock Optional clock for UUIDv7 timestamps.
在文件 GameEvent.cpp 第 252 行定义.
成员函数说明
◆ append()
| eve::Result< EventSequence > eve::game_event::GameEventLog::append | ( | GameEvent | envelope | ) |
Appends a typed-metadata envelope and assigns stream-local order.
- 参数
-
envelope Envelope metadata and canonical serialized payload.
- 返回
- The assigned stream-local sequence, or structured validation failure.
- 备注
- A non-nil EventId and valid schema id/version are required. If EventId is nil and this stream has an injected generator, it is generated before the event becomes observable.
在文件 GameEvent.cpp 第 255 行定义.
引用了 code, eve::Conflict, eve::Diagnostic::error(), eve::game_event::GameEvent::eventId, eve::Failed, eve::Result< T >::failure(), eve::detail::Id128< Tag >::fromUuid(), eve::detail::StrongUint64< Tag >::incremented(), eve::InvalidArgument, eve::detail::Id128< Tag >::isNil(), eve::LogicalId::isValid(), eve::detail::StrongUint64< Tag >::isZero(), message, eve::json::Document::parse(), eve::ParseError, eve::game_event::GameEvent::payload, eve::game_event::GameEvent::schemaId, eve::game_event::GameEvent::schemaVersion, eve::game_event::GameEvent::sequence, eve::Result< T >::success() , 以及 eve::game_event::GameEvent::type.
被这些函数引用 eve::action::game_event_adapter::ActionGameEventSink::emit().
◆ appendTyped()
|
inline |
Encodes a strongly typed domain payload and appends its envelope.
- 模板参数
-
Payload Domain payload type owned by the caller/domain module.
- 参数
-
envelope Envelope metadata; its payload field is replaced by the codec output. payload Strongly typed domain payload; the stream does not inspect its fields. encode Caller-owned canonical wire encoder returning valid JSON for stream snapshots.
- 返回
- The assigned stream-local sequence, or the encoder/append failure.
Append typed.
Failure.
Append.
在文件 GameEvent.h 第 307 行定义.
引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, payload , 以及 eve::game_event::GameEvent::payload.
◆ at()
| const GameEvent * eve::game_event::GameEventLog::at | ( | int | index | ) | const |
◆ clear()
| void eve::game_event::GameEventLog::clear | ( | ) |
Removes retained events while preserving the next sequence number.
在文件 GameEvent.cpp 第 360 行定义.
被这些函数引用 reset().
◆ clearBefore() [1/2]
| void eve::game_event::GameEventLog::clearBefore | ( | EventSequence | firstSequence | ) |
Removes retained events with sequence lower than firstSequence.
在文件 GameEvent.cpp 第 352 行定义.
引用了 eve::detail::StrongUint64< Tag >::value().
被这些函数引用 clearBefore().
◆ clearBefore() [2/2]
| void eve::game_event::GameEventLog::clearBefore | ( | uint64_t | firstSequence | ) |
Compatibility facade accepting the old untyped sequence value.
在文件 GameEvent.cpp 第 358 行定义.
引用了 clearBefore().
◆ find() [1/2]
| const GameEvent * eve::game_event::GameEventLog::find | ( | EventSequence | sequence | ) | const |
Returns an event by exact sequence, or nullptr. @ownership Borrowed from this stream; callers must not delete or retain it. @nullable Null when the sequence is not retained. @lifetime Until stream clear/reset/restore removes the event; a query does not invalidate this exact-sequence view. @thread GameEventLog-owner thread unless externally synchronized. @reentrancy No callbacks are made.
在文件 GameEvent.cpp 第 296 行定义.
被这些函数引用 find().
◆ find() [2/2]
| const GameEvent * eve::game_event::GameEventLog::find | ( | uint64_t | sequence | ) | const |
Compatibility facade accepting the old untyped sequence value. @ownership Borrowed view with the same lifetime as the typed find overload. @nullable Null when the sequence is not retained. @lifetime Until stream clear/reset/restore removes the event. @thread GameEventLog-owner thread; no callback or re-entry is performed.
在文件 GameEvent.cpp 第 303 行定义.
◆ newConsumer() [1/2]
| EventConsumer * eve::game_event::GameEventLog::newConsumer | ( | EventSequence | firstSequence = EventSequence(1) | ) |
Creates an independently positioned consumer cursor.
在文件 GameEvent.cpp 第 345 行定义.
引用了 EventConsumer.
被这些函数引用 newConsumer().
◆ newConsumer() [2/2]
| EventConsumer * eve::game_event::GameEventLog::newConsumer | ( | uint64_t | firstSequence | ) |
Compatibility facade accepting the old untyped sequence value.
在文件 GameEvent.cpp 第 350 行定义.
引用了 newConsumer().
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
default |
Operator =.
◆ queryAt()
| const GameEvent * eve::game_event::GameEventLog::queryAt | ( | int | index | ) | const |
◆ querySequence() [1/2]
| int eve::game_event::GameEventLog::querySequence | ( | EventSequence | firstSequence | ) |
Queries retained events whose sequence is at least firstSequence.
在文件 GameEvent.cpp 第 326 行定义.
引用了 eve::detail::StrongUint64< Tag >::value().
被这些函数引用 querySequence().
◆ querySequence() [2/2]
| int eve::game_event::GameEventLog::querySequence | ( | uint64_t | firstSequence | ) |
Compatibility facade accepting the old untyped sequence value.
在文件 GameEvent.cpp 第 333 行定义.
引用了 querySequence().
◆ querySource()
| int eve::game_event::GameEventLog::querySource | ( | const std::string & | source | ) |
Queries all retained events from a source in sequence order.
在文件 GameEvent.cpp 第 312 行定义.
引用了 source.
◆ querySubject()
| int eve::game_event::GameEventLog::querySubject | ( | const std::string & | subject | ) |
Queries all retained events concerning a subject in sequence order.
在文件 GameEvent.cpp 第 319 行定义.
引用了 subject.
◆ queryType()
| int eve::game_event::GameEventLog::queryType | ( | const std::string & | type | ) |
◆ reset()
| void eve::game_event::GameEventLog::reset | ( | ) |
Removes all state and restarts sequence allocation at one.
在文件 GameEvent.cpp 第 366 行定义.
引用了 clear(), eve::detail::StrongUint64< detail::SimulationTickTag >::zero() , 以及 eve::detail::StrongUint64< detail::RevisionTag >::zero().
◆ restore()
| eve::Result< void > eve::game_event::GameEventLog::restore | ( | std::string_view | json | ) |
Transactionally restores stream state from a snapshot.
- 参数
-
json Snapshot produced by snapshotJson().
- 返回
- Success, or structured parse/validation failure; failure leaves all retained events, consumers and sequence allocation unchanged.
在文件 GameEvent.cpp 第 397 行定义.
引用了 eve::game_event::GameEvent::causation, code, eve::Conflict, eve::game_event::GameEvent::correlation, error, eve::Diagnostic::error(), eve::game_event::GameEvent::eventId, eve::Result< T >::failure(), eve::LogicalId::fromParts(), eve::detail::Id128< Tag >::isNil(), eve::game_event::CorrelationId::kind(), eve::game_event::CausationRef::kind(), message, eve::detail::Id128< Tag >::nil(), eve::game_event::CorrelationId::None, eve::game_event::CausationRef::None, eve::json::Document::parse(), eve::LogicalId::parse(), eve::detail::Id128< Tag >::parse(), eve::ParseError, previous, root, eve::Result< T >::success(), eve::game_event::GameEvent::type, value, values , 以及 eve::detail::StrongUint64< detail::SimulationTickTag >::zero().
被这些函数引用 restoreSnapshot().
◆ restoreSnapshot()
| eve::Result< void > eve::game_event::GameEventLog::restoreSnapshot | ( | const eve::SnapshotEnvelope & | snapshot, |
| const eve::SnapshotHashProvider & | hashProvider | ||
| ) |
Restores a verified or migrated stream envelope atomically.
- 参数
-
snapshot Source envelope with schema game_event:stream.hashProvider Explicit content-digest provider.
- 返回
- Success, or a failure leaving retained events and cursors intact.
在文件 GameEvent.cpp 第 530 行定义.
引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::detail::Id128< Tag >::isNil(), payload, restore(), source, eve::Result< T >::success(), eve::validateSnapshotPayloadMetadata() , 以及 eve::detail::StrongUint64< Tag >::value().
被这些函数引用 restoreSnapshotJson().
◆ restoreSnapshotJson()
| eve::Result< void > eve::game_event::GameEventLog::restoreSnapshotJson | ( | std::string_view | json, |
| const eve::SnapshotHashProvider & | hashProvider | ||
| ) |
Parses and transactionally restores a common event-stream envelope.
在文件 GameEvent.cpp 第 576 行定义.
引用了 eve::Result< T >::failure(), eve::parseSnapshotEnvelope(), restoreSnapshot() , 以及 source.
◆ size()
| int eve::game_event::GameEventLog::size | ( | ) | const |
Returns the number of retained events.
在文件 GameEvent.cpp 第 339 行定义.
◆ snapshot()
| eve::Result< eve::SnapshotEnvelope > eve::game_event::GameEventLog::snapshot | ( | const eve::SnapshotHashProvider & | hashProvider | ) | const |
Captures the stream payload in the common snapshot envelope.
在文件 GameEvent.cpp 第 523 行定义.
引用了 eve::Result< T >::failure(), eve::Value::fromJson(), eve::makeSnapshotEnvelope(), payload , 以及 snapshotJson().
被这些函数引用 snapshotEnvelopeJson().
◆ snapshotEnvelopeJson()
| eve::Result< std::string > eve::game_event::GameEventLog::snapshotEnvelopeJson | ( | const eve::SnapshotHashProvider & | hashProvider | ) | const |
Serializes the common event-stream snapshot envelope.
在文件 GameEvent.cpp 第 569 行定义.
引用了 eve::Result< T >::failure(), eve::serializeSnapshotEnvelope(), snapshot() , 以及 value.
◆ snapshotJson()
| std::string eve::game_event::GameEventLog::snapshotJson | ( | ) | const |
Exports stream state as deterministic compact JSON.
在文件 GameEvent.cpp 第 374 行定义.
引用了 first, quote , 以及 eve::detail::StrongUint64< Tag >::value().
被这些函数引用 snapshot().
友元及相关函数文档
◆ EventConsumer
|
friend |
在文件 GameEvent.h 第 395 行定义.
被这些函数引用 newConsumer().
该类的文档由以下文件生成:
- src/modules/game_event/GameEvent.h
- src/modules/game_event/GameEvent.cpp