CatapultServer  v0.5.0.1 (Elephant)
ConsumerInput.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "DisruptorTypes.h"
23 #include "InputSource.h"
26 
27 namespace catapult { namespace disruptor {
28 
30  class ConsumerInput {
31  public:
33  ConsumerInput();
34 
36  explicit ConsumerInput(model::AnnotatedBlockRange&& range, InputSource source = InputSource::Unknown);
37 
39  explicit ConsumerInput(model::AnnotatedTransactionRange&& range, InputSource source = InputSource::Unknown);
40 
41  public:
43  bool empty() const;
44 
46  bool hasBlocks() const;
47 
49  bool hasTransactions() const;
50 
51  public:
54 
56  const BlockElements& blocks() const;
57 
60 
62  const TransactionElements& transactions() const;
63 
65  InputSource source() const;
66 
68  const Key& sourcePublicKey() const;
69 
70  public:
73 
76 
77  public:
79  friend std::ostream& operator<<(std::ostream& out, const ConsumerInput& input);
80 
81  private:
82  // backing memory
85 
86  // used by consumers
89 
92 
93  // used by formatting
96  };
97 }}
catapult::disruptor::ConsumerInput
Consumer input composed of a range of entities augmented with metadata.
Definition: ConsumerInput.h:30
catapult::disruptor::ConsumerInput::operator<<
friend std::ostream & operator<<(std::ostream &out, const ConsumerInput &input)
Insertion operator for outputting input to out.
Definition: ConsumerInput.cpp:150
catapult::disruptor::ConsumerInput::m_source
InputSource m_source
Definition: ConsumerInput.h:90
catapult::disruptor::ConsumerInput::blocks
BlockElements & blocks()
Returns the block elements associated with this input.
Definition: ConsumerInput.cpp:75
catapult::utils::HexFormat
constexpr void HexFormat(const ByteArray< N, TTag > &)
m_sourcePublicKey
Key m_sourcePublicKey
Definition: ChainSynchronizer.cpp:166
catapult::disruptor::ConsumerInput::source
InputSource source() const
Gets the source of this input.
Definition: ConsumerInput.cpp:97
catapult::model::EntityRange::empty
bool empty() const
Gets a value indicating whether or not this range is empty.
Definition: EntityRange.h:303
catapult::disruptor::InputSource
InputSource
Possible consumer input sources.
Definition: InputSource.h:42
catapult::model::AnnotatedEntityRange
Combination of an entity range and optional context.
Definition: AnnotatedEntityRange.h:30
catapult::disruptor::ConsumerInput::m_transactionRange
model::TransactionRange m_transactionRange
Definition: ConsumerInput.h:84
catapult::disruptor::ConsumerInput::hasBlocks
bool hasBlocks() const
Returns true if this input is not empty and has blocks.
Definition: ConsumerInput.cpp:63
catapult::model::EntityRange
Represents a range of entities.
Definition: EntityRange.h:31
catapult::disruptor::ConsumerInput::hasTransactions
bool hasTransactions() const
Returns true if this input is not empty and has transactions.
Definition: ConsumerInput.cpp:67
InputSource.h
catapult::utils::BaseValue< uint64_t, Height_tag >
catapult::utils::ByteArray::data
constexpr const uint8_t * data() const noexcept
Returns a const pointer to the underlying array.
Definition: ByteArray.h:70
HexFormatter.h
catapult::disruptor::operator<<
std::ostream & operator<<(std::ostream &out, const ConsumerInput &input)
Definition: ConsumerInput.cpp:150
DisruptorTypes.h
AnnotatedEntityRange.h
ConsumerInput.h
catapult::disruptor::ConsumerInput::m_transactionElements
TransactionElements m_transactionElements
Definition: ConsumerInput.h:88
catapult::model::EntityRange::size
size_t size() const
Gets the size of this range.
Definition: EntityRange.h:308
catapult::disruptor::TransactionElements
std::vector< FreeTransactionElement > TransactionElements
A container of FreeTransactionElement.
Definition: DisruptorTypes.h:135
catapult::disruptor::ConsumerInput::m_endHeight
Height m_endHeight
Definition: ConsumerInput.h:95
catapult::disruptor::ConsumerInput::ConsumerInput
ConsumerInput()
Creates a default consumer input.
Definition: ConsumerInput.cpp:29
catapult::disruptor::ConsumerInput::m_blockRange
model::BlockRange m_blockRange
Definition: ConsumerInput.h:83
catapult::disruptor::BlockElements
std::vector< model::BlockElement > BlockElements
A container of BlockElement.
Definition: DisruptorTypes.h:132
CATAPULT_THROW_RUNTIME_ERROR
#define CATAPULT_THROW_RUNTIME_ERROR(MESSAGE)
Macro used to throw a catapult runtime error.
Definition: exceptions.h:167
catapult::model::BlockElement
Processing element for a block composed of a block and metadata.
Definition: Elements.h:55
catapult::disruptor::FreeTransactionElement
Processing element for a transaction unassociated with a block composed of a transaction and metadata...
Definition: DisruptorTypes.h:120
catapult::disruptor::ConsumerInput::m_startHeight
Height m_startHeight
Definition: ConsumerInput.h:94
catapult::disruptor::ConsumerInput::m_blockElements
BlockElements m_blockElements
Definition: ConsumerInput.h:87
catapult::disruptor::ConsumerInput::empty
bool empty() const
Returns true if this input is empty and has no elements.
Definition: ConsumerInput.cpp:59
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::disruptor::ConsumerInput::transactions
TransactionElements & transactions()
Returns the (free) transaction elements associated with this input.
Definition: ConsumerInput.cpp:86
catapult::disruptor::ConsumerInput::m_sourcePublicKey
Key m_sourcePublicKey
Definition: ConsumerInput.h:91
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::disruptor::ConsumerInput::sourcePublicKey
const Key & sourcePublicKey() const
Gets the (optional) source public key.
Definition: ConsumerInput.cpp:101
catapult::disruptor::ConsumerInput::detachTransactionRange
model::TransactionRange detachTransactionRange()
Detaches the transaction range associated with this input.
Definition: ConsumerInput.cpp:116
catapult::disruptor::ConsumerInput::detachBlockRange
model::BlockRange detachBlockRange()
Detaches the block range associated with this input.
Definition: ConsumerInput.cpp:109
RangeTypes.h