Transactional adapter over one placed building's authoritative garrison. 更多...
#include <ContainerAdapters.h>
类 | |
| class | PreparedState |
详细描述
Transactional adapter over one placed building's authoritative garrison.
The PlacementWorld and building instance are borrowed; neither is deleted by this adapter. Membership is stored in PlacedBuilding::garrison, so a second adapter observes the same state and a rebuilt adapter does not lose members. The building must remain present until a prepared state is committed or rolled back. Removal/replacement is stale-safe at prepare time; violating the lifetime contract before noexcept commit terminates.
Garrison members are insertion-ordered and use contiguous slots. Capacity and the side-effect-free accepted condition are supplied by the caller, because building definitions do not own a universal population policy.
在文件 ContainerAdapters.h 第 36 行定义.
构造及析构函数说明
◆ BuildingGarrisonContainerAdapter()
| eve::building::BuildingGarrisonContainerAdapter::BuildingGarrisonContainerAdapter | ( | eve::container::ContainerId | id, |
| PlacementWorld * | world, | ||
| int | instanceId, | ||
| eve::container::Capacity | capacity = eve::container::Capacity::unlimited(), |
||
| eve::container::AcceptedCondition | accepted = {} |
||
| ) |
Binds an adapter to a placed building.
- 参数
-
id Stable identity, normally building:garrison:<world>:<instance>.world Borrowed placement world. instanceId Existing placed-building instance identity. capacity Maximum member count. accepted Side-effect-free condition applied before entry.
在文件 ContainerAdapters.cpp 第 159 行定义.
成员函数说明
◆ descriptor()
|
inlineoverridevirtualnoexcept |
◆ enter()
| eve::Result< eve::container::MembershipId > eve::building::BuildingGarrisonContainerAdapter::enter | ( | std::string | memberId, |
| std::string | type = "building.garrison.member", |
||
| std::vector< std::string > | tags = {}, |
||
| eve::container::GameEventSink | sink = {}, |
||
| eve::SimulationTick | tick = eve::SimulationTick::zero() |
||
| ) |
Stage and publish a new garrison member.
- 参数
-
memberId Stable member identity; it must be non-empty. type Domain type spelling retained in snapshots. tags Member tags used by accepted conditions and consumers. sink Optional synchronous canonical GameEvent observer. tick Injected simulation tick for emitted envelopes.
- 返回
- The member identity, or a rejection with no membership mutation.
在文件 ContainerAdapters.cpp 第 314 行定义.
引用了 eve::container::Accepted, current, eve::container::Enter, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Status::failure(), eve::container::ContainerObject::id, eve::container::ContainerDescriptor::id, eve::container::SlotIndex::invalid(), eve::InvariantViolation, object, prepare(), eve::container::Rejected, revision(), serial, snapshot(), status, eve::Result< T >::success(), tick, type, validateInsert() , 以及 eve::container::SlotIndex::value().
◆ exit()
| eve::Result< eve::container::MembershipId > eve::building::BuildingGarrisonContainerAdapter::exit | ( | eve::container::MembershipId | memberId, |
| eve::container::GameEventSink | sink = {}, |
||
| eve::SimulationTick | tick = eve::SimulationTick::zero() |
||
| ) |
Stage and publish removal of one member.
- 参数
-
memberId Stable member identity. sink Optional synchronous canonical GameEvent observer. tick Injected simulation tick for emitted envelopes.
- 返回
- The removed identity, or a rejection with no mutation.
在文件 ContainerAdapters.cpp 第 382 行定义.
引用了 eve::container::Accepted, current, eve::Diagnostic::error(), eve::container::Exit, eve::Result< T >::failure(), eve::Status::failure(), eve::container::ContainerDescriptor::id, index, eve::container::SlotIndex::invalid(), eve::InvariantViolation, eve::container::SlotIndex::isValid(), eve::NotFound, prepare(), eve::container::Rejected, revision(), serial, snapshot(), status, eve::Result< T >::success(), tick , 以及 eve::container::SlotIndex::value().
◆ prepare()
|
overridevirtual |
Prepare an exact replacement from expected to candidate.
- 参数
-
expected Snapshot observed during transfer preflight. candidate Fully constructed post-transfer snapshot.
- 返回
- A detached state whose commit and rollback operations cannot fail; no observable state may change before commit.
- 备注
- The adapter must reject a stale
expectedsnapshot. The adapter is borrowed and must outlive the returned state; the caller must externally serialize access to the adapter.
Prepare.
实现了 eve::container::IContainer.
在文件 ContainerAdapters.cpp 第 266 行定义.
引用了 eve::container::ContainerDescriptor::capacity, eve::Conflict, current, eve::container::ContainerSnapshot::entries, eve::Diagnostic::error(), eve::container::ContainerSnapshot::id, eve::container::ContainerDescriptor::id, eve::detail::StrongUint64< Tag >::incremented(), index, eve::InvalidArgument, eve::InvariantViolation, eve::container::Capacity::isUnlimited(), eve::container::ContainerId::isValid(), member, eve::container::ContainerSnapshot::revision, snapshot(), eve::StaleHandle, eve::container::Capacity::value() , 以及 value.
◆ revision()
|
noexcept |
Return the authoritative garrison revision, or zero when stale.
在文件 ContainerAdapters.cpp 第 181 行定义.
引用了 value , 以及 eve::detail::StrongUint64< detail::RevisionTag >::zero().
◆ snapshot()
|
overridevirtual |
Snapshot.
实现了 eve::container::IContainer.
在文件 ContainerAdapters.cpp 第 203 行定义.
引用了 eve::container::ContainerDescriptor::capacity, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::container::MembershipId::from(), eve::container::ContainerDescriptor::id, id, index, eve::InvariantViolation, eve::container::Capacity::isUnlimited(), eve::container::ContainerId::isValid(), member, eve::StaleHandle, eve::Result< T >::success(), eve::container::Capacity::value() , 以及 value.
◆ validateInsert()
|
overridevirtual |
Validate insert.
实现了 eve::container::IContainer.
在文件 ContainerAdapters.cpp 第 230 行定义.
引用了 eve::container::ContainerDescriptor::capacity, eve::Conflict, eve::Diagnostic::error(), eve::container::Filter::evaluate(), eve::Result< T >::failure(), eve::container::ContainerDescriptor::filter, eve::container::ContainerDescriptor::id, eve::InvalidArgument, eve::container::Capacity::isUnlimited(), eve::container::ContainerId::isValid(), member, eve::StaleHandle, eve::Result< T >::success(), type, u, eve::container::Capacity::value() , 以及 value.
被这些函数引用 enter().
该类的文档由以下文件生成:
- src/modules/building/ContainerAdapters.h
- src/modules/building/ContainerAdapters.cpp
Public 成员函数 继承自