Deterministic subject-and-key JSON value store with atomic patching. 更多...
#include <StatePatch.h>
Public 成员函数 | |
| Store (eve::PersistentId instanceId={}) | |
| Creates an empty store with an optional persistent identity. | |
| eve::Result< PatchBatchHandleRef > | newBatch () |
| Allocates a store-owned empty patch batch and returns its handle. | |
| eve::script::Borrowed< PatchBatch > | resolveBatch (PatchBatchHandleRef reference) noexcept |
| Resolves a live batch as a non-owning observation. | |
| eve::Result< void > | releaseBatch (PatchBatchHandleRef reference) |
| Releases a store-owned patch batch. | |
| bool | isBatchStale (PatchBatchHandleRef reference) const noexcept |
| Reports whether a batch reference is stale for this Store. | |
| bool | commit (PatchBatch *batch) |
| Validates and atomically commits a batch. | |
| bool | has (const std::string &subject, const std::string &key) const |
| Returns whether a subject and key currently exist. | |
| std::string | get (const std::string &subject, const std::string &key) const |
| Returns canonical JSON for a value, or an empty string when absent. | |
| uint64_t | valueRevision (const std::string &subject, const std::string &key) const |
| Returns the revision at which a value last changed, or zero when absent. | |
| uint64_t | revision () const |
| Returns the current global store revision. | |
| int | querySubjects () |
| Queries subjects in lexical order. | |
| int | queryKeys (const std::string &subject) |
| Queries keys for a subject in lexical order. | |
| std::string | queryAt (int index) const |
| Returns an item from the latest subject or key query. | |
| int | queryDirty () |
| Queries dirty subject-key pairs in lexical order. | |
| std::string | dirtySubjectAt (int index) const |
| Returns the subject for a dirty query item. | |
| std::string | dirtyKeyAt (int index) const |
| Returns the key for a dirty query item. | |
| void | clearDirty () |
| Clears all dirty-key markers without changing values. | |
| int | eventCount () const |
| Returns the number of retained change events. | |
| const ChangeEvent * | eventAt (int index) const |
| Returns a retained change event, or nullptr. | |
| void | clearEvents () |
| Removes retained change events without resetting sequence allocation. | |
| std::string | snapshotJson () const |
| Exports all persistent store state as deterministic compact JSON. | |
| eve::Result< void > | restoreJson (const std::string &json) |
| Transactionally restores a snapshot produced by snapshotJson(). | |
| eve::Result< eve::SnapshotEnvelope > | snapshot (const eve::SnapshotHashProvider &hashProvider) const |
| Captures the state-patch payload in the common snapshot envelope. | |
| eve::Result< void > | restoreSnapshot (const eve::SnapshotEnvelope &snapshot, const eve::SnapshotHashProvider &hashProvider) |
| Restores a verified or migrated state-patch envelope atomically. | |
| eve::Result< std::string > | snapshotEnvelopeJson (const eve::SnapshotHashProvider &hashProvider) const |
| Serializes the common state-patch snapshot envelope. | |
| eve::Result< void > | restoreSnapshotJson (std::string_view json, const eve::SnapshotHashProvider &hashProvider) |
| Parses and transactionally restores a common state-patch envelope. | |
友元 | |
| class | StoreTransactionParticipant |
详细描述
Deterministic subject-and-key JSON value store with atomic patching.
在文件 StatePatch.h 第 119 行定义.
构造及析构函数说明
◆ Store()
|
explicit |
Creates an empty store with an optional persistent identity.
在文件 StatePatch.cpp 第 153 行定义.
成员函数说明
◆ clearDirty()
| void eve::statepatch::Store::clearDirty | ( | ) |
Clears all dirty-key markers without changing values.
在文件 StatePatch.cpp 第 347 行定义.
◆ clearEvents()
| void eve::statepatch::Store::clearEvents | ( | ) |
Removes retained change events without resetting sequence allocation.
在文件 StatePatch.cpp 第 358 行定义.
◆ commit()
| bool eve::statepatch::Store::commit | ( | PatchBatch * | batch | ) |
Validates and atomically commits a batch.
在文件 StatePatch.cpp 第 210 行定义.
引用了 code, entries, eve::statepatch::PatchResult::errors, exists, has(), key, message, operation, eve::Pending, removed, eve::statepatch::PatchResult::revisionAfter, eve::statepatch::PatchResult::revisionBefore, subject , 以及 value.
◆ dirtyKeyAt()
| std::string eve::statepatch::Store::dirtyKeyAt | ( | int | index | ) | const |
◆ dirtySubjectAt()
| std::string eve::statepatch::Store::dirtySubjectAt | ( | int | index | ) | const |
◆ eventAt()
| const ChangeEvent * eve::statepatch::Store::eventAt | ( | int | index | ) | const |
◆ eventCount()
| int eve::statepatch::Store::eventCount | ( | ) | const |
Returns the number of retained change events.
在文件 StatePatch.cpp 第 352 行定义.
◆ get()
| std::string eve::statepatch::Store::get | ( | const std::string & | subject, |
| const std::string & | key | ||
| ) | const |
◆ has()
| bool eve::statepatch::Store::has | ( | const std::string & | subject, |
| const std::string & | key | ||
| ) | const |
Returns whether a subject and key currently exist.
在文件 StatePatch.cpp 第 291 行定义.
被这些函数引用 eve::statepatch::StatePatchStateAdapter::apply(), commit() , 以及 eve::statepatch::StatePatchStateAdapter::hasTag().
◆ isBatchStale()
|
noexcept |
Reports whether a batch reference is stale for this Store.
在文件 StatePatch.cpp 第 205 行定义.
引用了 reference.
◆ newBatch()
| eve::Result< PatchBatchHandleRef > eve::statepatch::Store::newBatch | ( | ) |
Allocates a store-owned empty patch batch and returns its handle.
- 返回
- A generation-qualified batch reference local to this Store.
- 备注
- The reference becomes stale after release, restore, Store destruction, or module unload/reload. Resolve is borrowed.
在文件 StatePatch.cpp 第 197 行定义.
◆ queryAt()
| std::string eve::statepatch::Store::queryAt | ( | int | index | ) | const |
◆ queryDirty()
| int eve::statepatch::Store::queryDirty | ( | ) |
Queries dirty subject-key pairs in lexical order.
在文件 StatePatch.cpp 第 331 行定义.
◆ queryKeys()
| int eve::statepatch::Store::queryKeys | ( | const std::string & | subject | ) |
◆ querySubjects()
| int eve::statepatch::Store::querySubjects | ( | ) |
◆ releaseBatch()
| eve::Result< void > eve::statepatch::Store::releaseBatch | ( | PatchBatchHandleRef | reference | ) |
◆ resolveBatch()
|
noexcept |
◆ restoreJson()
| eve::Result< void > eve::statepatch::Store::restoreJson | ( | const std::string & | json | ) |
Transactionally restores a snapshot produced by snapshotJson().
- 参数
-
json Snapshot JSON to parse and validate.
- 返回
- Success, or a parse/validation diagnostic; on failure the Store remains unchanged.
在文件 StatePatch.cpp 第 382 行定义.
引用了 dirty, eve::Diagnostic::error(), eve::Result< T >::failure(), key, eve::json::Document::parse(), eve::ParseError, root, subject, eve::Result< T >::success() , 以及 values.
被这些函数引用 restoreSnapshot().
◆ restoreSnapshot()
| eve::Result< void > eve::statepatch::Store::restoreSnapshot | ( | const eve::SnapshotEnvelope & | snapshot, |
| const eve::SnapshotHashProvider & | hashProvider | ||
| ) |
Restores a verified or migrated state-patch envelope atomically.
- 参数
-
snapshot Source envelope with schema statepatch:store.hashProvider Explicit content-digest provider.
- 返回
- Success, or a failure leaving all values and metadata unchanged.
在文件 StatePatch.cpp 第 455 行定义.
引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, payload, restoreJson(), source, eve::Result< T >::success() , 以及 eve::validateSnapshotPayloadMetadata().
◆ restoreSnapshotJson()
| eve::Result< void > eve::statepatch::Store::restoreSnapshotJson | ( | std::string_view | json, |
| const eve::SnapshotHashProvider & | hashProvider | ||
| ) |
Parses and transactionally restores a common state-patch envelope.
在文件 StatePatch.cpp 第 491 行定义.
引用了 eve::Result< T >::failure(), eve::parseSnapshotEnvelope() , 以及 source.
◆ revision()
| uint64_t eve::statepatch::Store::revision | ( | ) | const |
Returns the current global store revision.
在文件 StatePatch.cpp 第 310 行定义.
◆ snapshot()
| eve::Result< eve::SnapshotEnvelope > eve::statepatch::Store::snapshot | ( | const eve::SnapshotHashProvider & | hashProvider | ) | const |
Captures the state-patch payload in the common snapshot envelope.
在文件 StatePatch.cpp 第 448 行定义.
引用了 eve::Result< T >::failure(), eve::Value::fromJson(), eve::makeSnapshotEnvelope() , 以及 payload.
◆ snapshotEnvelopeJson()
| eve::Result< std::string > eve::statepatch::Store::snapshotEnvelopeJson | ( | const eve::SnapshotHashProvider & | hashProvider | ) | const |
Serializes the common state-patch snapshot envelope.
在文件 StatePatch.cpp 第 484 行定义.
引用了 eve::Result< T >::failure(), eve::serializeSnapshotEnvelope() , 以及 value.
◆ snapshotJson()
| std::string eve::statepatch::Store::snapshotJson | ( | ) | const |
◆ valueRevision()
| uint64_t eve::statepatch::Store::valueRevision | ( | const std::string & | subject, |
| const std::string & | key | ||
| ) | const |
友元及相关函数文档
◆ StoreTransactionParticipant
|
friend |
在文件 StatePatch.h 第 193 行定义.
该类的文档由以下文件生成:
- src/modules/statepatch/StatePatch.h
- src/modules/statepatch/StatePatch.cpp