CatapultServer  v0.5.0.1 (Elephant)
DisruptorTypes.h
Go to the documentation of this file.
1 
21 #pragma once
23 #include <functional>
24 #include <stdint.h>
25 
26 namespace catapult { namespace disruptor {
27 
29  using PositionType = uint64_t;
30 
32  using DisruptorElementId = uint64_t;
33 
35  using CompletionCode = uint32_t;
36 
38  enum class CompletionStatus : uint8_t {
40  Aborted,
41 
43  Normal,
44 
46  Consumed
47  };
48 
51  enum class ConsumerResultSeverity : uint8_t {
53  Neutral,
54 
56  Success,
57 
59  Failure
60  };
61 
63  struct ConsumerResult {
64  public:
66  constexpr ConsumerResult() : ConsumerResult(disruptor::CompletionStatus::Normal, 0)
67  {}
68 
69  private:
71  : CompletionStatus(status)
72  , CompletionCode(code)
73  {}
74 
75  public:
78 
81 
82  public:
84  static constexpr ConsumerResult Abort() {
85  return Abort(0);
86  }
87 
91  }
92 
94  static constexpr ConsumerResult Continue() {
95  return {};
96  }
97 
101  }
102  };
103 
106  public:
108  constexpr ConsumerCompletionResult() : FinalConsumerPosition(std::numeric_limits<PositionType>::max())
109  {}
110 
111  public:
114  };
115 
118 
122  explicit FreeTransactionElement(const model::Transaction& transaction)
123  : model::TransactionElement(transaction)
125  {}
126 
129  };
130 
132  using BlockElements = std::vector<model::BlockElement>;
133 
135  using TransactionElements = std::vector<FreeTransactionElement>;
136 }}
catapult::disruptor::FreeTransactionElement::ResultSeverity
ConsumerResultSeverity ResultSeverity
Consumer result severity.
Definition: DisruptorTypes.h:128
catapult::disruptor::PositionType
uint64_t PositionType
Position within disruptor components.
Definition: DisruptorTypes.h:29
catapult::disruptor::ConsumerResult::ConsumerResult
constexpr ConsumerResult()
Creates a default result.
Definition: DisruptorTypes.h:66
catapult::disruptor::ConsumerCompletionResult
Extended consumer result passed to completion callback.
Definition: DisruptorTypes.h:105
catapult::disruptor::ConsumerCompletionResult::FinalConsumerPosition
PositionType FinalConsumerPosition
Position of the final consumer processing the entity.
Definition: DisruptorTypes.h:113
catapult::disruptor::CompletionStatus::Aborted
Processing of the entity was aborted by a consumer.
Elements.h
catapult::disruptor::FreeTransactionElement::FreeTransactionElement
FreeTransactionElement(const model::Transaction &transaction)
Creates a transaction element around transaction.
Definition: DisruptorTypes.h:122
catapult::disruptor::CompletionStatus
CompletionStatus
Completion status.
Definition: DisruptorTypes.h:38
catapult::disruptor::DisruptorElementId
uint64_t DisruptorElementId
Id of a disruptor element.
Definition: DisruptorTypes.h:32
catapult::disruptor::ConsumerResultSeverity::Neutral
Neutral result.
catapult::disruptor::ConsumerResult::ConsumerResult
constexpr ConsumerResult(disruptor::CompletionStatus status, disruptor::CompletionCode code)
Definition: DisruptorTypes.h:70
catapult::disruptor::ProcessingCompleteFunc
consumer< DisruptorElementId, const ConsumerCompletionResult & > ProcessingCompleteFunc
Function signature for signaling that processing finished.
Definition: DisruptorTypes.h:117
catapult::disruptor::TransactionElements
std::vector< FreeTransactionElement > TransactionElements
A container of FreeTransactionElement.
Definition: DisruptorTypes.h:135
catapult::disruptor::ConsumerResult::Continue
static constexpr ConsumerResult Continue()
Creates a consumer result indicating that processing should continue.
Definition: DisruptorTypes.h:94
catapult::disruptor::BlockElements
std::vector< model::BlockElement > BlockElements
A container of BlockElement.
Definition: DisruptorTypes.h:132
catapult::model::TransactionElement
Processing element for a transaction composed of a transaction and metadata.
Definition: Elements.h:33
catapult::disruptor::ConsumerResult::CompletionCode
disruptor::CompletionCode CompletionCode
Optional code that can provide additional consumer completion information.
Definition: DisruptorTypes.h:80
catapult::disruptor::ConsumerResultSeverity::Failure
Failure result.
catapult::disruptor::FreeTransactionElement
Processing element for a transaction unassociated with a block composed of a transaction and metadata...
Definition: DisruptorTypes.h:120
catapult::disruptor::CompletionStatus::Normal
Processing of the entity is ongoing.
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::disruptor::CompletionStatus::Consumed
Processing of the entity was completed and the entity was consumed.
catapult::disruptor::ConsumerResult::Abort
static constexpr ConsumerResult Abort(disruptor::CompletionCode code)
Creates a consumer result indicating that processing should be aborted with the specified code.
Definition: DisruptorTypes.h:89
catapult::disruptor::ConsumerResult::Complete
static constexpr ConsumerResult Complete(disruptor::CompletionCode code)
Creates a consumer result indicating that processing has completed with the specified code.
Definition: DisruptorTypes.h:99
catapult::disruptor::ConsumerResultSeverity
ConsumerResultSeverity
Definition: DisruptorTypes.h:51
catapult::disruptor::ConsumerCompletionResult::ConsumerCompletionResult
constexpr ConsumerCompletionResult()
Creates a default result.
Definition: DisruptorTypes.h:108
catapult::model::TransactionElement::TransactionElement
TransactionElement(const model::Transaction &transaction)
Creates a transaction element around transaction.
Definition: Elements.h:36
catapult::consumer
std::function< void(TArgs...)> consumer
A consumer function.
Definition: functions.h:35
catapult::disruptor::ConsumerResultSeverity::Success
Success result.
catapult::disruptor::ConsumerResult::CompletionStatus
disruptor::CompletionStatus CompletionStatus
Completion status.
Definition: DisruptorTypes.h:77
catapult::disruptor::CompletionCode
uint32_t CompletionCode
Optional code that can provide additional consumer completion information.
Definition: DisruptorTypes.h:35
catapult::disruptor::ConsumerResult::Abort
static constexpr ConsumerResult Abort()
Creates a consumer result indicating that processing should be aborted.
Definition: DisruptorTypes.h:84
catapult::disruptor::ConsumerResult
Result of a consumer operation.
Definition: DisruptorTypes.h:63
catapult::model::Transaction
Binary layout for a transaction.
Definition: Transaction.h:32