CatapultServer  v0.5.0.1 (Elephant)
TransactionPlugin.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "ResolverContext.h"
23 #include "TransactionRegistry.h"
24 #include "WeakEntityInfo.h"
26 
27 namespace catapult {
28  namespace model {
29  struct EmbeddedTransaction;
30  class NotificationSubscriber;
31  struct Transaction;
32  }
33 }
34 
35 namespace catapult { namespace model {
36 
40  uint8_t MinVersion;
41 
43  uint8_t MaxVersion;
44 
48  };
49 
51  template<typename TTransaction>
53  public:
54  virtual ~TransactionPluginT() = default;
55 
56  public:
58  virtual EntityType type() const = 0;
59 
61  virtual TransactionAttributes attributes() const = 0;
62 
64  virtual uint64_t calculateRealSize(const TTransaction& transaction) const = 0;
65  };
66 
68  class EmbeddedTransactionPlugin : public TransactionPluginT<EmbeddedTransaction> {
69  public:
71  virtual void publish(const EmbeddedTransaction& transaction, NotificationSubscriber& sub) const = 0;
72  };
73 
75  class TransactionPlugin : public TransactionPluginT<Transaction> {
76  public:
78  virtual void publish(const WeakEntityInfoT<Transaction>& transactionInfo, NotificationSubscriber& sub) const = 0;
79 
81  virtual RawBuffer dataBuffer(const Transaction& transaction) const = 0;
82 
85  virtual std::vector<RawBuffer> merkleSupplementaryBuffers(const Transaction& transaction) const = 0;
86 
88  virtual bool supportsTopLevel() const = 0;
89 
91  virtual bool supportsEmbedding() const = 0;
92 
94  virtual const EmbeddedTransactionPlugin& embeddedPlugin() const = 0;
95  };
96 
98  class TransactionRegistry : public TransactionRegistryT<TransactionPlugin> {};
99 }}
ResolverContext.h
catapult::model::TransactionAttributes::MaxVersion
uint8_t MaxVersion
Maximum supported version.
Definition: TransactionPlugin.h:43
catapult::model::TransactionPluginT::calculateRealSize
virtual uint64_t calculateRealSize(const TTransaction &transaction) const =0
Calculates the real size of transaction.
catapult::model::TransactionPlugin::merkleSupplementaryBuffers
virtual std::vector< RawBuffer > merkleSupplementaryBuffers(const Transaction &transaction) const =0
catapult::model::TransactionPlugin::supportsEmbedding
virtual bool supportsEmbedding() const =0
true if this transaction type supports being embedded in other transactions.
catapult::model::TransactionAttributes::MaxLifetime
utils::TimeSpan MaxLifetime
Definition: TransactionPlugin.h:47
catapult::model::NotificationSubscriber
A notification subscriber.
Definition: NotificationSubscriber.h:27
catapult::model::TransactionPluginT::attributes
virtual TransactionAttributes attributes() const =0
Gets transaction dependent attributes.
catapult::model::EmbeddedTransactionPlugin::publish
virtual void publish(const EmbeddedTransaction &transaction, NotificationSubscriber &sub) const =0
Sends all notifications from transaction to sub.
WeakEntityInfo.h
catapult::model::EntityType
EntityType
Enumeration of entity types.
Definition: EntityType.h:43
catapult::model::TransactionAttributes::MinVersion
uint8_t MinVersion
Minimum supported version.
Definition: TransactionPlugin.h:40
catapult::model::TransactionPluginT
A typed transaction plugin.
Definition: TransactionPlugin.h:52
catapult::model::TransactionPlugin::publish
virtual void publish(const WeakEntityInfoT< Transaction > &transactionInfo, NotificationSubscriber &sub) const =0
Sends all notifications from transactionInfo to sub.
catapult::utils::TimeSpan
Represents a time duration.
Definition: TimeSpan.h:30
catapult::model::TransactionRegistryT
A registry of transaction plugins.
Definition: TransactionRegistry.h:29
TransactionRegistry.h
catapult::model::TransactionPlugin::embeddedPlugin
virtual const EmbeddedTransactionPlugin & embeddedPlugin() const =0
Gets the corresponding embedded plugin if supportsEmbedding() is true.
catapult::model::TransactionPluginT::type
virtual EntityType type() const =0
Gets the transaction entity type.
catapult::model::WeakEntityInfoT
Wrapper around a strongly typed entity and its associated metadata.
Definition: WeakEntityInfo.h:33
catapult::model::EmbeddedTransactionPlugin
An embedded transaction plugin.
Definition: TransactionPlugin.h:68
catapult::model::TransactionPlugin::dataBuffer
virtual RawBuffer dataBuffer(const Transaction &transaction) const =0
Extracts the primary data buffer from transaction that is used for signing and basic hashing.
catapult::model::TransactionPluginT::~TransactionPluginT
virtual ~TransactionPluginT()=default
catapult::model::TransactionPlugin
A transaction plugin.
Definition: TransactionPlugin.h:75
catapult::model::TransactionPlugin::supportsTopLevel
virtual bool supportsTopLevel() const =0
true if this transaction type supports being embedded directly in blocks.
catapult::model::EmbeddedTransaction
Binary layout for an embedded transaction (non-verifiable).
Definition: EmbeddedTransaction.h:38
TimeSpan.h
catapult::model::TransactionAttributes
Transaction dependent attributes.
Definition: TransactionPlugin.h:38
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::model::TransactionRegistry
A registry of transaction plugins.
Definition: TransactionPlugin.h:98
catapult::model::BasicEntityType::Transaction
Transaction type.
catapult::utils::RawBuffer
BasicRawBuffer< const uint8_t > RawBuffer
A const binary buffer.
Definition: RawBuffer.h:62
catapult::model::Transaction
Binary layout for a transaction.
Definition: Transaction.h:32