载入中...
搜索中...
未找到
eve::inventory::InventoryResourceAccount类 参考final

Adapts one Bag's item quantities to the common resource protocol. 更多...

#include <InventoryResourceAccount.h>

类 eve::inventory::InventoryResourceAccount 继承关系图:
eve::resource::IResourceAccount

Public 成员函数

 InventoryResourceAccount (Bag &bag)
 Bind the adapter to one caller-owned inventory bag.
 
 InventoryResourceAccount (const InventoryResourceAccount &)=delete
 
InventoryResourceAccount & operator= (const InventoryResourceAccount &)=delete
 
 InventoryResourceAccount (InventoryResourceAccount &&)=delete
 
InventoryResourceAccount & operator= (InventoryResourceAccount &&)=delete
 
 ~InventoryResourceAccount () override=default
 Inventory resource account.
 
eve::Result< eve::resource::Affordability > canAfford (const eve::resource::CostSpec &cost) const override
 Query whether a cost can be paid from currently available funds.
 
eve::Result< eve::resource::Reservation > reserve (const eve::resource::CostSpec &cost) override
 Reserve all items of a cost without changing visible balances.
 
eve::Result< eve::resource::Receipt > debit (const eve::resource::CostSpec &cost) override
 Atomically debit all items immediately.
 
eve::Result< eve::resource::Receipt > credit (const eve::resource::CostSpec &cost) override
 Atomically credit all items immediately.
 
eve::Result< eve::resource::Receipt > commit (const eve::resource::Reservation &reservation) override
 Commit one active reservation as an atomic debit.
 
eve::Result< void > rollback (const eve::resource::Reservation &reservation) override
 Release one active reservation without changing balances.
 
- Public 成员函数 继承自 eve::resource::IResourceAccount
virtual ~IResourceAccount ()=default
 Releases IResourceAccount resources.
 

详细描述

Adapts one Bag's item quantities to the common resource protocol.

Each ResourceId is the canonical ItemDefinition id. The bag's slot vector remains the only balance store; this adapter owns only reservation records and an opaque AccountNonce. It therefore works for both item prices and weapon ammunition without creating a second resource map. The Bag is borrowed and must outlive this adapter. Calls are synchronous on the Bag owner thread. Failed multi-item mutations restore slots, generated instance ids and queued inventory events before returning.

在文件 InventoryResourceAccount.h 第 30 行定义.

构造及析构函数说明

◆ InventoryResourceAccount() [1/3]

eve::inventory::InventoryResourceAccount::InventoryResourceAccount ( Bag &  bag)
explicit

Bind the adapter to one caller-owned inventory bag.

在文件 InventoryResourceAccount.cpp 第 81 行定义.

引用了 eve::resource::allocateAccountNonce().

◆ InventoryResourceAccount() [2/3]

eve::inventory::InventoryResourceAccount::InventoryResourceAccount ( const InventoryResourceAccount &  )
delete

◆ InventoryResourceAccount() [3/3]

eve::inventory::InventoryResourceAccount::InventoryResourceAccount ( InventoryResourceAccount &&  )
delete

◆ ~InventoryResourceAccount()

eve::inventory::InventoryResourceAccount::~InventoryResourceAccount ( )
overridedefault

Inventory resource account.

成员函数说明

◆ canAfford()

eve::Result< Affordability > eve::inventory::InventoryResourceAccount::canAfford ( const eve::resource::CostSpec &  cost) const
overridevirtual

Query whether a cost can be paid from currently available funds.

参数
costValid canonical cost borrowed for the call.
返回
Structured affordability, or a failed Result for invalid input/provider failure.

Can afford.

实现了 eve::resource::IResourceAccount.

在文件 InventoryResourceAccount.cpp 第 114 行定义.

引用了 cost, eve::Result< T >::failure(), eve::resource::AccountNonce::isZero(), eve::resource::CostSpec::items(), eve::Result< T >::success() , 以及 valid.

被这些函数引用 debit() , 以及 reserve().

◆ commit()

eve::Result< Receipt > eve::inventory::InventoryResourceAccount::commit ( const eve::resource::Reservation &  reservation)
overridevirtual

Commit one active reservation as an atomic debit.

参数
reservationCredential borrowed for the call.
返回
A debit receipt, or Conflict/NotFound without partial mutation.

Commits commit.

实现了 eve::resource::IResourceAccount.

在文件 InventoryResourceAccount.cpp 第 293 行定义.

引用了 eve::Applied, eve::Conflict, covered, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::resource::AccountNonce::isZero(), eve::Status::success(), eve::Result< T >::success() , 以及 eve::detail::StrongUint64< Tag >::value().

◆ credit()

eve::Result< Receipt > eve::inventory::InventoryResourceAccount::credit ( const eve::resource::CostSpec &  cost)
overridevirtual

Atomically credit all items immediately.

参数
costValid canonical positive quantities borrowed for the call.
返回
A credit receipt, or a failure with no state mutation.

Credit.

实现了 eve::resource::IResourceAccount.

在文件 InventoryResourceAccount.cpp 第 264 行定义.

引用了 eve::Applied, cost, eve::Result< T >::failure(), eve::resource::AccountNonce::isZero(), eve::Status::success(), eve::Result< T >::success() , 以及 eve::detail::StrongUint64< Tag >::value().

◆ debit()

eve::Result< Receipt > eve::inventory::InventoryResourceAccount::debit ( const eve::resource::CostSpec &  cost)
overridevirtual

Atomically debit all items immediately.

参数
costValid canonical cost borrowed for the call.
返回
A debit receipt, or a failure with no state mutation.

Debit.

实现了 eve::resource::IResourceAccount.

在文件 InventoryResourceAccount.cpp 第 248 行定义.

引用了 eve::Applied, canAfford(), cost, eve::Result< T >::failure(), eve::resource::AccountNonce::isZero(), eve::Status::success(), eve::Result< T >::success() , 以及 eve::detail::StrongUint64< Tag >::value().

◆ operator=() [1/2]

InventoryResourceAccount & eve::inventory::InventoryResourceAccount::operator= ( const InventoryResourceAccount &  )
delete

◆ operator=() [2/2]

InventoryResourceAccount & eve::inventory::InventoryResourceAccount::operator= ( InventoryResourceAccount &&  )
delete

◆ reserve()

eve::Result< Reservation > eve::inventory::InventoryResourceAccount::reserve ( const eve::resource::CostSpec &  cost)
overridevirtual

Reserve all items of a cost without changing visible balances.

参数
costValid canonical cost borrowed for the call.
返回
A reservation credential, or a failure with no state mutation.

Reserve.

实现了 eve::resource::IResourceAccount.

在文件 InventoryResourceAccount.cpp 第 135 行定义.

引用了 eve::Applied, canAfford(), eve::Conflict, cost, eve::Diagnostic::error(), eve::Result< T >::failure(), id, eve::InvariantViolation, eve::resource::AccountNonce::isZero(), eve::Status::success(), eve::Result< T >::success(), eve::detail::StrongUint64< Tag >::value() , 以及 value.

◆ rollback()

eve::Result< void > eve::inventory::InventoryResourceAccount::rollback ( const eve::resource::Reservation &  reservation)
overridevirtual

Release one active reservation without changing balances.

参数
reservationCredential borrowed for the call.
返回
Applied on the first rollback; duplicate/foreign credentials fail explicitly.

Rollback.

实现了 eve::resource::IResourceAccount.

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

引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::resource::AccountNonce::isZero(), eve::Status::success() , 以及 eve::Result< T >::success().


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