Instance-owned publication mechanism shared by capability and domain registries. @ownership The registry and acquired records share provider ownership. Metadata is an owning value. @lifetime Withdrawal prevents new acquisitions; existing records retain the old generation. Registry destruction releases its publications; previously acquired records remain alive. @thread Publication, acquisition, withdrawal and snapshots are synchronized. Provider callbacks are never invoked under the registry mutex; their affinity remains the domain owner's contract. @reentrancy Records may invoke callbacks which mutate this registry after acquisition returns. @cost Publication copies an id and allocates a slot; snapshot copies all live records. Bind or acquire outside per-frame inner loops and reuse the resulting owning record. 更多...
#include <ProviderRegistry.h>
类 | |
| struct | Record |
| Owning lease and immutable-at-publication metadata for a generation. 更多... | |
Public 成员函数 | |
| ProviderRegistry ()=default | |
| Construct an empty registry with its own generation namespace. | |
| ProviderRegistry (const ProviderRegistry &)=delete | |
| ProviderRegistry & | operator= (const ProviderRegistry &)=delete |
| ~ProviderRegistry () | |
| Unpublish before releasing implementations; destructor reentry sees an empty, closing registry. | |
| Result< OwnedProviderHandle > | publish (std::string id, std::shared_ptr< I > provider, Metadata metadata={}) |
| Publish a unique id. | |
| Result< Record > | acquire (const OwnedProviderHandle &handle) const |
| Acquire an exact generation. | |
| Result< Record > | acquire (std::string_view id) const |
| Acquire the current id. | |
| Result< Record > | withdraw (const OwnedProviderHandle &handle) |
| Withdraw an exact generation; retained leases stay valid. | |
| std::vector< Record > | snapshot () const |
| Copy owning dispatch records in id order; later mutations affect the next snapshot. @cost Copies all live providers and metadata and sorts by id (O(n log n), O(n) memory); amortize once over a complete dispatch, rather than once per provider callback. | |
详细描述
class eve::cap::ProviderRegistry< I, Metadata >
Instance-owned publication mechanism shared by capability and domain registries. @ownership The registry and acquired records share provider ownership. Metadata is an owning value. @lifetime Withdrawal prevents new acquisitions; existing records retain the old generation. Registry destruction releases its publications; previously acquired records remain alive. @thread Publication, acquisition, withdrawal and snapshots are synchronized. Provider callbacks are never invoked under the registry mutex; their affinity remains the domain owner's contract. @reentrancy Records may invoke callbacks which mutate this registry after acquisition returns. @cost Publication copies an id and allocates a slot; snapshot copies all live records. Bind or acquire outside per-frame inner loops and reuse the resulting owning record.
在文件 ProviderRegistry.h 第 38 行定义.
构造及析构函数说明
◆ ProviderRegistry() [1/2]
|
default |
Construct an empty registry with its own generation namespace.
◆ ProviderRegistry() [2/2]
|
delete |
◆ ~ProviderRegistry()
|
inline |
Unpublish before releasing implementations; destructor reentry sees an empty, closing registry.
在文件 ProviderRegistry.h 第 52 行定义.
引用了 retired.
成员函数说明
◆ acquire() [1/2]
|
inline |
Acquire an exact generation.
- 返回
- Unsupported when never seen, Conflict when stale.
在文件 ProviderRegistry.h 第 85 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), found, handle, eve::Status::success(), eve::Result< T >::success() , 以及 eve::Unsupported.
◆ acquire() [2/2]
|
inline |
Acquire the current id.
- 返回
- Unsupported when absent, without creating a slot.
在文件 ProviderRegistry.h 第 96 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), found, eve::Status::success(), eve::Result< T >::success() , 以及 eve::Unsupported.
◆ operator=()
|
delete |
◆ publish()
|
inline |
Publish a unique id.
- 返回
- InvalidArgument or Conflict without changing live state.
在文件 ProviderRegistry.h 第 62 行定义.
◆ snapshot()
|
inline |
Copy owning dispatch records in id order; later mutations affect the next snapshot. @cost Copies all live providers and metadata and sorts by id (O(n log n), O(n) memory); amortize once over a complete dispatch, rather than once per provider callback.
在文件 ProviderRegistry.h 第 125 行定义.
◆ withdraw()
|
inline |
Withdraw an exact generation; retained leases stay valid.
- 返回
- Removed owning record or Conflict.
在文件 ProviderRegistry.h 第 106 行定义.
引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), found, handle, removed, eve::Status::success() , 以及 eve::Result< T >::success().
该类的文档由以下文件生成:
- src/engine/common/ProviderRegistry.h