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()
|
explicit |
Creates an independent policy registry.
- 参数
-
instanceId Identity 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()
| eve::Result< PolicyHandle > eve::policyregistry::PolicyRegistry::enable | ( | const std::string & | domain, |
| const std::string & | name, | ||
| bool | enabled | ||
| ) |
Changes enabled state through the same replacement generation path.
在文件 PolicyRegistry.cpp 第 268 行定义.
引用了 current, enabled, eve::Result< T >::failure(), eve::VersionedRegistry< Key, Value, EventData, Compare >::handle(), handle, eve::detail::StrongUint64< Tag >::incremented(), key, name, eve::NoOp, eve::VersionedRegistry< Key, Value, EventData, Compare >::replace(), eve::VersionedRegistry< Key, Value, EventData, Compare >::resolve(), eve::Status::success(), eve::Result< T >::success() , 以及 value.
◆ eventAt()
| const PolicyEvent * eve::policyregistry::PolicyRegistry::eventAt | ( | int | index | ) | const |
Returns a retained event by sequence order.
在文件 PolicyRegistry.cpp 第 373 行定义.
引用了 eve::VersionedRegistry< Key, Value, EventData, Compare >::eventAt(), eve::VersionedRegistry< Key, Value, EventData, Compare >::eventCount() , 以及 index.
◆ 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 | ||
| ) |
Inserts a descriptor through the common checked registry.
在文件 PolicyRegistry.cpp 第 209 行定义.
引用了 descriptor, enabled, eve::Result< T >::failure(), handle, eve::detail::StrongUint64< Tag >::incremented(), eve::VersionedRegistry< Key, Value, EventData, Compare >::insert(), kind, name, priority, eve::Result< T >::success() , 以及 value.
◆ isStale()
|
noexcept |
Returns whether a generation-qualified policy handle is stale.
在文件 PolicyRegistry.cpp 第 323 行定义.
引用了 handle.
◆ isTombstone()
|
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 | ||
| ) |
Removes a descriptor and returns its retained tombstone handle.
在文件 PolicyRegistry.cpp 第 249 行定义.
引用了 current, descriptor, eve::Result< T >::failure(), handle, eve::detail::StrongUint64< Tag >::incremented(), key, name, eve::VersionedRegistry< Key, Value, EventData, Compare >::remove(), eve::VersionedRegistry< Key, Value, EventData, Compare >::resolve() , 以及 eve::Result< T >::success().
◆ 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 | ||
| ) |
Replaces a descriptor and invalidates the prior generation handle.
在文件 PolicyRegistry.cpp 第 229 行定义.
引用了 descriptor, enabled, eve::Result< T >::failure(), handle, eve::detail::StrongUint64< Tag >::incremented(), kind, name, priority, eve::VersionedRegistry< Key, Value, EventData, Compare >::replace(), eve::Result< T >::success() , 以及 value.
◆ 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()
| eve::Result< void > eve::policyregistry::PolicyRegistry::restoreJson | ( | const std::string & | json | ) |
Transactionally restores state from the registry snapshot.
在文件 PolicyRegistry.cpp 第 445 行定义.
引用了 eve::Applied, eve::policyregistry::Builtin, descriptor, eve::policyregistry::PolicyDescriptor::domain, enabled, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Value::fromJson(), generation, eve::Value::getIf(), index, eve::Insert, eve::InvariantViolation, eve::detail::StrongUint64< Tag >::isZero(), kind, name, eve::ParseError, eve::policyregistry::parseImplementationKind(), priority, eve::Remove, eve::Replace, eve::VersionedRegistry< Key, Value, EventData, Compare >::restoreState(), root, sequence, eve::Status::success(), eve::Result< T >::success(), eve::detail::StrongUint64< Tag >::value() , 以及 value.
被这些函数引用 restoreSnapshot().
◆ 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 |
Selects the enabled highest-priority policy, breaking ties by lexical name.
在文件 PolicyRegistry.cpp 第 327 行定义.
引用了 eve::VersionedRegistry< Key, Value, EventData, Compare >::at(), index, key, eve::VersionedRegistry< Key, Value, EventData, Compare >::keyAt(), eve::policyregistry::PolicyDescriptor::name , 以及 eve::policyregistry::PolicyDescriptor::priority.
◆ 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()
| std::string eve::policyregistry::PolicyRegistry::snapshotJson | ( | ) | const |
Exports registry state as deterministic JSON.
在文件 PolicyRegistry.cpp 第 390 行定义.
引用了 descriptor, eve::VersionedRegistry< Key, Value, EventData, Compare >::eventCount(), events, generation, generations, eve::policyregistry::implementationKindName(), key, root, eve::VersionedRegistry< Key, Value, EventData, Compare >::size(), eve::VersionedRegistry< Key, Value, EventData, Compare >::snapshotState(), state , 以及 eve::Value::toJson().
被这些函数引用 snapshot().
◆ 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().
该类的文档由以下文件生成:
- src/modules/policyregistry/PolicyRegistry.h
- src/modules/policyregistry/PolicyRegistry.cpp