载入中...
搜索中...
未找到
eve::policyregistry::PolicyRegistry类 参考

Deterministic registry for discoverable, non-executable policy descriptions. 更多...

#include <PolicyRegistry.h>

Public 成员函数

 PolicyRegistry (eve::PersistentId instanceId={})
 Creates an independent policy registry.
 
eve::Result< PolicyHandle > insert (const std::string &domain, const std::string &name, int version, int priority, bool enabled, const std::string &kind, const std::string &schemaId, const std::string &metadataJson)
 Inserts a descriptor through the common checked registry.
 
eve::Result< PolicyHandle > replace (const std::string &domain, const std::string &name, int version, int priority, bool enabled, const std::string &kind, const std::string &schemaId, const std::string &metadataJson)
 Replaces a descriptor and invalidates the prior generation handle.
 
eve::Result< PolicyHandle > remove (const std::string &domain, const std::string &name)
 Removes a descriptor and returns its retained tombstone handle.
 
eve::Result< PolicyHandle > enable (const std::string &domain, const std::string &name, bool enabled)
 Changes enabled state through the same replacement generation path.
 
eve::ResultRef< const PolicyDescriptor > resolve (const std::string &domain, const std::string &name) const
 Resolves a descriptor through the common checked-registry API.
 
eve::ResultRef< const PolicyDescriptor > resolveHandle (const PolicyHandle &handle) const
 Resolves a generation-qualified policy handle through Result.
 
eve::Result< PolicyHandle > handle (const std::string &domain, const std::string &name) const
 Returns the current generation-qualified handle through Result.
 
eve::Result< eve::Generation > generationOf (const std::string &domain, const std::string &name) const
 Returns the latest generation, including a retained tombstone.
 
bool isTombstone (const std::string &domain, const std::string &name) const noexcept
 Returns whether a key is retained as a removal tombstone.
 
bool isStale (const PolicyHandle &handle) const noexcept
 Returns whether a generation-qualified policy handle is stale.
 
const PolicyDescriptor * select (const std::string &domain) const
 Selects the enabled highest-priority policy, breaking ties by lexical name.
 
int size () const
 Returns total live descriptor count.
 
int countDomain (const std::string &domain) const
 Returns live descriptor count in a domain.
 
const PolicyDescriptor * at (int index) const
 Returns a live descriptor in globally sorted domain/name order.
 
const PolicyDescriptor * atDomain (const std::string &domain, int index) const
 Returns a live descriptor in lexical name order within a domain.
 
int eventCount () const
 Returns retained event count.
 
const PolicyEvent * eventAt (int index) const
 Returns a retained event by sequence order.
 
void clearEvents ()
 Clears events without resetting the sequence allocator.
 
std::string snapshotJson () const
 Exports registry state as deterministic JSON.
 
eve::Result< void > restoreJson (const std::string &json)
 Transactionally restores state from the registry snapshot.
 
eve::Result< eve::SnapshotEnvelope > snapshot (const eve::SnapshotHashProvider &hashProvider) const
 Captures this registry in the common snapshot envelope.
 
eve::Result< void > restoreSnapshot (const eve::SnapshotEnvelope &snapshot, const eve::SnapshotHashProvider &hashProvider)
 Restores a verified snapshot transactionally without per-item events.
 
eve::Result< std::string > snapshotEnvelopeJson (const eve::SnapshotHashProvider &hashProvider) const
 Serializes the common snapshot envelope as canonical JSON.
 
eve::Result< void > restoreSnapshotJson (std::string_view json, const eve::SnapshotHashProvider &hashProvider)
 Parses and transactionally restores a common snapshot envelope.
 
eve::Subscription subscribe (std::function< void(const PolicyEvent &)> callback)
 Subscribes to successful registry mutations.
 

详细描述

Deterministic registry for discoverable, non-executable policy descriptions.

在文件 PolicyRegistry.h 第 55 行定义.

构造及析构函数说明

◆ PolicyRegistry()

eve::policyregistry::PolicyRegistry::PolicyRegistry ( eve::PersistentId  instanceId = {})
explicit

Creates an independent policy registry.

参数
instanceIdIdentity carried by common snapshot envelopes.

在文件 PolicyRegistry.cpp 第 176 行定义.

引用了 generation , 以及 value.

成员函数说明

◆ at()

const PolicyDescriptor * eve::policyregistry::PolicyRegistry::at ( int  index) const

Returns a live descriptor in globally sorted domain/name order.

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

引用了 eve::VersionedRegistry< Key, Value, EventData, Compare >::at() , 以及 index.

◆ atDomain()

const PolicyDescriptor * eve::policyregistry::PolicyRegistry::atDomain ( const std::string &  domain,
int  index 
) const

Returns a live descriptor in lexical name order within a domain.

在文件 PolicyRegistry.cpp 第 359 行定义.

引用了 eve::VersionedRegistry< Key, Value, EventData, Compare >::at(), index, key, eve::VersionedRegistry< Key, Value, EventData, Compare >::keyAt() , 以及 position.

◆ clearEvents()

void eve::policyregistry::PolicyRegistry::clearEvents ( )

Clears events without resetting the sequence allocator.

在文件 PolicyRegistry.cpp 第 384 行定义.

引用了 eve::VersionedRegistry< Key, Value, EventData, Compare >::clearEvents() , 以及 eve::detail::StrongUint64< Tag >::incremented().

◆ countDomain()

int eve::policyregistry::PolicyRegistry::countDomain ( const std::string &  domain) const

Returns live descriptor count in a domain.

在文件 PolicyRegistry.cpp 第 344 行定义.

引用了 count, index, key , 以及 eve::VersionedRegistry< Key, Value, EventData, Compare >::keyAt().

◆ enable()

◆ eventAt()

const PolicyEvent * eve::policyregistry::PolicyRegistry::eventAt ( int  index) const

◆ eventCount()

int eve::policyregistry::PolicyRegistry::eventCount ( ) const

Returns retained event count.

在文件 PolicyRegistry.cpp 第 371 行定义.

引用了 eve::VersionedRegistry< Key, Value, EventData, Compare >::eventCount().

◆ generationOf()

eve::Result< eve::Generation > eve::policyregistry::PolicyRegistry::generationOf ( const std::string &  domain,
const std::string &  name 
) const

Returns the latest generation, including a retained tombstone.

在文件 PolicyRegistry.cpp 第 315 行定义.

引用了 eve::VersionedRegistry< Key, Value, EventData, Compare >::generationOf() , 以及 name.

◆ handle()

eve::Result< PolicyHandle > eve::policyregistry::PolicyRegistry::handle ( const std::string &  domain,
const std::string &  name 
) const

Returns the current generation-qualified handle through Result.

在文件 PolicyRegistry.cpp 第 309 行定义.

引用了 eve::Result< T >::failure(), eve::VersionedRegistry< Key, Value, EventData, Compare >::handle(), name , 以及 eve::Result< T >::success().

◆ insert()

eve::Result< PolicyHandle > eve::policyregistry::PolicyRegistry::insert ( const std::string &  domain,
const std::string &  name,
int  version,
int  priority,
bool  enabled,
const std::string &  kind,
const std::string &  schemaId,
const std::string &  metadataJson 
)

◆ isStale()

bool eve::policyregistry::PolicyRegistry::isStale ( const PolicyHandle &  handle) const
noexcept

Returns whether a generation-qualified policy handle is stale.

在文件 PolicyRegistry.cpp 第 323 行定义.

引用了 handle.

◆ isTombstone()

bool eve::policyregistry::PolicyRegistry::isTombstone ( const std::string &  domain,
const std::string &  name 
) const
noexcept

Returns whether a key is retained as a removal tombstone.

在文件 PolicyRegistry.cpp 第 319 行定义.

引用了 name.

◆ remove()

eve::Result< PolicyHandle > eve::policyregistry::PolicyRegistry::remove ( const std::string &  domain,
const std::string &  name 
)

◆ replace()

eve::Result< PolicyHandle > eve::policyregistry::PolicyRegistry::replace ( const std::string &  domain,
const std::string &  name,
int  version,
int  priority,
bool  enabled,
const std::string &  kind,
const std::string &  schemaId,
const std::string &  metadataJson 
)

◆ resolve()

eve::ResultRef< const PolicyDescriptor > eve::policyregistry::PolicyRegistry::resolve ( const std::string &  domain,
const std::string &  name 
) const

Resolves a descriptor through the common checked-registry API.

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

引用了 eve::Result< T >::failure(), name, eve::VersionedRegistry< Key, Value, EventData, Compare >::resolve() , 以及 eve::Result< T >::success().

◆ resolveHandle()

eve::ResultRef< const PolicyDescriptor > eve::policyregistry::PolicyRegistry::resolveHandle ( const PolicyHandle &  handle) const

Resolves a generation-qualified policy handle through Result.

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

引用了 eve::Result< T >::failure(), handle, eve::VersionedRegistry< Key, Value, EventData, Compare >::resolve() , 以及 eve::Result< T >::success().

◆ restoreJson()

◆ restoreSnapshot()

eve::Result< void > eve::policyregistry::PolicyRegistry::restoreSnapshot ( const eve::SnapshotEnvelope &  snapshot,
const eve::SnapshotHashProvider &  hashProvider 
)

Restores a verified snapshot transactionally without per-item events.

在文件 PolicyRegistry.cpp 第 603 行定义.

引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::detail::Id128< Tag >::isNil(), payload, restoreJson(), source , 以及 eve::Result< T >::success().

被这些函数引用 restoreSnapshotJson().

◆ restoreSnapshotJson()

eve::Result< void > eve::policyregistry::PolicyRegistry::restoreSnapshotJson ( std::string_view  json,
const eve::SnapshotHashProvider &  hashProvider 
)

Parses and transactionally restores a common snapshot envelope.

在文件 PolicyRegistry.cpp 第 631 行定义.

引用了 eve::Result< T >::failure(), eve::parseSnapshotEnvelope(), restoreSnapshot() , 以及 source.

◆ select()

const PolicyDescriptor * eve::policyregistry::PolicyRegistry::select ( const std::string &  domain) const

◆ size()

int eve::policyregistry::PolicyRegistry::size ( ) const

Returns total live descriptor count.

在文件 PolicyRegistry.cpp 第 342 行定义.

引用了 eve::VersionedRegistry< Key, Value, EventData, Compare >::size().

◆ snapshot()

eve::Result< eve::SnapshotEnvelope > eve::policyregistry::PolicyRegistry::snapshot ( const eve::SnapshotHashProvider &  hashProvider) const

Captures this registry in the common snapshot envelope.

在文件 PolicyRegistry.cpp 第 596 行定义.

引用了 eve::Result< T >::failure(), eve::Value::fromJson(), eve::makeSnapshotEnvelope(), payload , 以及 snapshotJson().

被这些函数引用 snapshotEnvelopeJson().

◆ snapshotEnvelopeJson()

eve::Result< std::string > eve::policyregistry::PolicyRegistry::snapshotEnvelopeJson ( const eve::SnapshotHashProvider &  hashProvider) const

Serializes the common snapshot envelope as canonical JSON.

在文件 PolicyRegistry.cpp 第 624 行定义.

引用了 eve::Result< T >::failure(), eve::serializeSnapshotEnvelope(), snapshot() , 以及 value.

◆ snapshotJson()

◆ subscribe()

eve::Subscription eve::policyregistry::PolicyRegistry::subscribe ( std::function< void(const PolicyEvent &)>  callback)

Subscribes to successful registry mutations.

返回
Owner-thread-affine RAII cancellation token.

在文件 PolicyRegistry.cpp 第 638 行定义.

引用了 callback , 以及 eve::VersionedRegistry< Key, Value, EventData, Compare >::subscribe().


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