载入中...
搜索中...
未找到
eve::statepatch::Store类 参考

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()

eve::statepatch::Store::Store ( eve::PersistentId  instanceId = {})
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)

◆ dirtyKeyAt()

std::string eve::statepatch::Store::dirtyKeyAt ( int  index) const

Returns the key for a dirty query item.

在文件 StatePatch.cpp 第 341 行定义.

引用了 index , 以及 second.

◆ dirtySubjectAt()

std::string eve::statepatch::Store::dirtySubjectAt ( int  index) const

Returns the subject for a dirty query item.

在文件 StatePatch.cpp 第 336 行定义.

引用了 first , 以及 index.

◆ eventAt()

const ChangeEvent * eve::statepatch::Store::eventAt ( int  index) const

Returns a retained change event, or nullptr.

在文件 StatePatch.cpp 第 354 行定义.

引用了 index.

◆ 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

Returns canonical JSON for a value, or an empty string when absent.

在文件 StatePatch.cpp 第 296 行定义.

引用了 found, key, subject , 以及 value.

◆ 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 行定义.

引用了 found, key , 以及 subject.

被这些函数引用 eve::statepatch::StatePatchStateAdapter::apply(), commit() , 以及 eve::statepatch::StatePatchStateAdapter::hasTag().

◆ isBatchStale()

bool eve::statepatch::Store::isBatchStale ( PatchBatchHandleRef  reference) const
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 行定义.

被这些函数引用 eve::statepatch::StatePatchStateAdapter::apply().

◆ queryAt()

std::string eve::statepatch::Store::queryAt ( int  index) const

Returns an item from the latest subject or key query.

在文件 StatePatch.cpp 第 326 行定义.

引用了 index.

◆ 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)

Queries keys for a subject in lexical order.

在文件 StatePatch.cpp 第 318 行定义.

引用了 found, key, subject , 以及 value.

◆ querySubjects()

int eve::statepatch::Store::querySubjects ( )

Queries subjects in lexical order.

在文件 StatePatch.cpp 第 312 行定义.

引用了 entries , 以及 subject.

◆ releaseBatch()

eve::Result< void > eve::statepatch::Store::releaseBatch ( PatchBatchHandleRef  reference)

Releases a store-owned patch batch.

在文件 StatePatch.cpp 第 203 行定义.

引用了 reference.

被这些函数引用 eve::statepatch::StatePatchStateAdapter::apply().

◆ resolveBatch()

eve::script::Borrowed< PatchBatch > eve::statepatch::Store::resolveBatch ( PatchBatchHandleRef  reference)
noexcept

Resolves a live batch as a non-owning observation.

在文件 StatePatch.cpp 第 199 行定义.

引用了 reference.

被这些函数引用 eve::statepatch::StatePatchStateAdapter::apply().

◆ restoreJson()

eve::Result< void > eve::statepatch::Store::restoreJson ( const std::string &  json)

Transactionally restores a snapshot produced by snapshotJson().

参数
jsonSnapshot 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.

参数
snapshotSource envelope with schema statepatch:store.
hashProviderExplicit 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

Exports all persistent store state as deterministic compact JSON.

在文件 StatePatch.cpp 第 360 行定义.

引用了 entries, first, key, quote, subject , 以及 value.

◆ valueRevision()

uint64_t eve::statepatch::Store::valueRevision ( const std::string &  subject,
const std::string &  key 
) const

Returns the revision at which a value last changed, or zero when absent.

在文件 StatePatch.cpp 第 303 行定义.

引用了 found, key, subject , 以及 value.

友元及相关函数文档

◆ StoreTransactionParticipant

friend class StoreTransactionParticipant
friend

在文件 StatePatch.h 第 193 行定义.


该类的文档由以下文件生成: