载入中...
搜索中...
未找到
ResourceAccountParticipant.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
12
13#include <cstdint>
14#include <string>
15#include <string_view>
16
17namespace eve::transaction {
18
20enum class ResourceDebitState : std::uint8_t {
21 Idle,
26};
27
38public:
46 std::string name = "resource-debit");
47
52
54 [[nodiscard]] std::string_view name() const noexcept override { return name_; }
55
58 [[nodiscard]] eve::Result<void> prepare(const TransactionContext& context) override;
59
62 [[nodiscard]] eve::Result<void> commit(const TransactionContext& context) override;
63
66 [[nodiscard]] eve::Result<void> rollback(const TransactionContext& context) override;
67
70 [[nodiscard]] eve::Result<void> compensate(const TransactionContext& context) override;
71
73 [[nodiscard]] ResourceDebitState state() const noexcept { return state_; }
74
75private:
78 eve::resource::Reservation reservation_;
79 std::string name_;
80 ResourceDebitState state_ = ResourceDebitState::Idle;
81};
82
83} // namespace eve::transaction
eve::resource::CostSpec cost
eve::resource::IResourceAccount * account
#define EVENGINE_API_FOUNDATION
每个链接组(link group)各自的导出宏。
Definition Export.h:106
std::string name
Strongly typed, transaction-friendly resource cost protocol.
const VegetationPresetContext & context
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Immutable canonical multi-resource cost.
Provider-neutral resource account contract.
Synchronous participant contract for one coordinator transaction.
Adapts IResourceAccount debit semantics to Coordinator.
ResourceDebitParticipant & operator=(ResourceDebitParticipant &&)=delete
std::string_view name() const noexcept override
Return the diagnostic name supplied at construction.
ResourceDebitParticipant & operator=(const ResourceDebitParticipant &)=delete
ResourceDebitParticipant(const ResourceDebitParticipant &)=delete
ResourceDebitState state() const noexcept
Return the participant lifecycle state for diagnostics/tests.
ResourceDebitParticipant(ResourceDebitParticipant &&)=delete
Immutable context shared by every participant of one transaction.
Definition Transaction.h:30
ResourceDebitState
Lifecycle state of a resource debit participant.
Reservation credential returned by a successful reserve operation.