Provider-neutral resource account contract. 更多...
#include <ResourceAccount.h>
Public 成员函数 | |
| virtual | ~IResourceAccount ()=default |
| Releases IResourceAccount resources. | |
| virtual eve::Result< Affordability > | canAfford (const CostSpec &cost) const =0 |
| Query whether a cost can be paid from currently available funds. | |
| virtual eve::Result< Reservation > | reserve (const CostSpec &cost)=0 |
| Reserve all items of a cost without changing visible balances. | |
| virtual eve::Result< Receipt > | debit (const CostSpec &cost)=0 |
| Atomically debit all items immediately. | |
| virtual eve::Result< Receipt > | credit (const CostSpec &cost)=0 |
| Atomically credit all items immediately. | |
| virtual eve::Result< Receipt > | commit (const Reservation &reservation)=0 |
| Commit one active reservation as an atomic debit. | |
| virtual eve::Result< void > | rollback (const Reservation &reservation)=0 |
| Release one active reservation without changing balances. | |
详细描述
Provider-neutral resource account contract.
Balances are authoritative in the implementation. Reservations reduce available balance without changing the observable balance; commit applies a debit and rollback only releases the reservation. Every multi-resource operation must preflight all entries and leave the provider unchanged on failure. Implementations are synchronous and must document any stronger thread-affinity rule; the protocol never retains callbacks or borrowed arguments after a call returns.
在文件 ResourceAccount.h 第 316 行定义.
构造及析构函数说明
◆ ~IResourceAccount()
|
virtualdefault |
Releases IResourceAccount resources.
成员函数说明
◆ canAfford()
|
pure virtual |
Query whether a cost can be paid from currently available funds.
- 参数
-
cost Valid canonical cost borrowed for the call.
- 返回
- Structured affordability, or a failed Result for invalid input/provider failure.
在 eve::attributes::AttributeResourceAccountAdapter, eve::attributes::AttributeSetResourceAccount, eve::economy::EconomyLedgerResourceAccount , 以及 eve::inventory::InventoryResourceAccount 内被实现.
◆ commit()
|
pure virtual |
Commit one active reservation as an atomic debit.
- 参数
-
reservation Credential borrowed for the call.
- 返回
- A debit receipt, or Conflict/NotFound without partial mutation.
在 eve::attributes::AttributeResourceAccountAdapter, eve::attributes::AttributeSetResourceAccount, eve::economy::EconomyLedgerResourceAccount , 以及 eve::inventory::InventoryResourceAccount 内被实现.
被这些函数引用 eve::transaction::ResourceDebitParticipant::commit().
◆ credit()
|
pure virtual |
Atomically credit all items immediately.
- 参数
-
cost Valid canonical positive quantities borrowed for the call.
- 返回
- A credit receipt, or a failure with no state mutation.
在 eve::attributes::AttributeResourceAccountAdapter, eve::attributes::AttributeSetResourceAccount, eve::economy::EconomyLedgerResourceAccount , 以及 eve::inventory::InventoryResourceAccount 内被实现.
被这些函数引用 eve::transaction::ResourceDebitParticipant::compensate() , 以及 eve::rts::RTS::configureScriptWorld().
◆ debit()
|
pure virtual |
Atomically debit all items immediately.
- 参数
-
cost Valid canonical cost borrowed for the call.
- 返回
- A debit receipt, or a failure with no state mutation.
在 eve::attributes::AttributeResourceAccountAdapter, eve::attributes::AttributeSetResourceAccount, eve::economy::EconomyLedgerResourceAccount , 以及 eve::inventory::InventoryResourceAccount 内被实现.
◆ reserve()
|
pure virtual |
Reserve all items of a cost without changing visible balances.
- 参数
-
cost Valid canonical cost borrowed for the call.
- 返回
- A reservation credential, or a failure with no state mutation.
在 eve::attributes::AttributeResourceAccountAdapter, eve::attributes::AttributeSetResourceAccount, eve::economy::EconomyLedgerResourceAccount , 以及 eve::inventory::InventoryResourceAccount 内被实现.
被这些函数引用 eve::transaction::ResourceDebitParticipant::prepare().
◆ rollback()
|
pure virtual |
Release one active reservation without changing balances.
- 参数
-
reservation Credential borrowed for the call.
- 返回
- Applied on the first rollback; duplicate/foreign credentials fail explicitly.
在 eve::attributes::AttributeResourceAccountAdapter, eve::attributes::AttributeSetResourceAccount, eve::economy::EconomyLedgerResourceAccount , 以及 eve::inventory::InventoryResourceAccount 内被实现.
被这些函数引用 eve::transaction::ResourceDebitParticipant::rollback().
该类的文档由以下文件生成:
- src/engine/common/ResourceAccount.h