6 #ifndef KAGOME_CORE_PRIMITIVES_EVENT_TYPES_HPP 7 #define KAGOME_CORE_PRIMITIVES_EVENT_TYPES_HPP 12 #include <boost/none_t.hpp> 13 #include <boost/variant.hpp> 14 #include <libp2p/peer/peer_id.hpp> 34 using ref_t = std::reference_wrapper<const T>;
90 using Hash256Span = gsl::span<const uint8_t, common::Hash256::size()>;
93 gsl::span<const libp2p::peer::PeerId>
peers;
125 using Params = boost::variant<std::nullopt_t,
135 id, ExtrinsicEventType::FUTURE,
Params{std::nullopt}};
140 id, ExtrinsicEventType::READY,
Params{std::nullopt}};
147 ExtrinsicEventType::BROADCAST,
148 Params{BroadcastEventParams{.peers = std::move(peers)}}};
155 ExtrinsicEventType::IN_BLOCK,
156 Params{InBlockEventParams{.block = std::move(block)}}};
163 ExtrinsicEventType::RETRACTED,
164 Params{RetractedEventParams{.retracted_block =
165 std::move(retracted_block)}}};
172 ExtrinsicEventType::FINALITY_TIMEOUT,
173 Params{FinalizedEventParams{.block = std::move(block)}}};
180 ExtrinsicEventType::FINALIZED,
181 Params{FinalizedEventParams{.block = std::move(block)}}};
188 ExtrinsicEventType::USURPED,
190 std::move(transaction_hash)}}};
195 id, ExtrinsicEventType::DROPPED,
Params{std::nullopt}};
200 id, ExtrinsicEventType::INVALID,
Params{std::nullopt}};
212 : id{
id}, type{type}, params{std::move(params)} {}
218 std::shared_ptr<api::Session>,
219 std::optional<common::Buffer>,
222 std::shared_ptr<StorageSubscriptionEngine>;
229 std::shared_ptr<api::Session>,
238 std::shared_ptr<api::Session>,
241 std::shared_ptr<ExtrinsicSubscriptionEngine>;
248 #endif // KAGOME_CORE_PRIMITIVES_EVENT_TYPES_HPP gsl::span< const uint8_t, common::Hash256::size()> Hash256Span
static ExtrinsicLifecycleEvent Invalid(SubscribedExtrinsicId id)
uint32_t SubscribedExtrinsicId
ref_t< const primitives::BlockHash > NewRuntimeEventParams
static ExtrinsicLifecycleEvent Broadcast(SubscribedExtrinsicId id, gsl::span< const libp2p::peer::PeerId > peers)
std::shared_ptr< ExtrinsicEventSubscriber > ExtrinsicEventSubscriberPtr
std::shared_ptr< StorageSubscriptionEngine > StorageSubscriptionEnginePtr
static ExtrinsicLifecycleEvent Dropped(SubscribedExtrinsicId id)
static ExtrinsicLifecycleEvent Retracted(SubscribedExtrinsicId id, Hash256Span retracted_block)
ref_t< const primitives::Version > RuntimeVersionEventParams
static ExtrinsicLifecycleEvent Ready(SubscribedExtrinsicId id)
static ExtrinsicLifecycleEvent Usurped(SubscribedExtrinsicId id, Hash256Span transaction_hash)
Hash256Span retracted_block
static ExtrinsicLifecycleEvent FinalityTimeout(SubscribedExtrinsicId id, Hash256Span block)
boost::variant< std::nullopt_t, HeadsEventParams, RuntimeVersionEventParams, NewRuntimeEventParams > ChainEventParams
std::shared_ptr< ChainEventSubscriber > ChainEventSubscriberPtr
static ExtrinsicLifecycleEvent Finalized(SubscribedExtrinsicId id, Hash256Span block)
static ExtrinsicLifecycleEvent Future(SubscribedExtrinsicId id)
SLBuffer< std::numeric_limits< size_t >::max()> Buffer
std::shared_ptr< ChainSubscriptionEngine > ChainSubscriptionEnginePtr
ExtrinsicLifecycleEvent(SubscribedExtrinsicId id, ExtrinsicEventType type, Params params)
static ExtrinsicLifecycleEvent InBlock(SubscribedExtrinsicId id, Hash256Span block)
std::shared_ptr< ExtrinsicSubscriptionEngine > ExtrinsicSubscriptionEnginePtr
Hash256Span transaction_hash
std::shared_ptr< StorageEventSubscriber > StorageEventSubscriberPtr
gsl::span< const libp2p::peer::PeerId > peers
ref_t< const primitives::BlockHeader > HeadsEventParams
boost::variant< std::nullopt_t, BroadcastEventParams, InBlockEventParams, RetractedEventParams, FinalityTimeoutEventParams, FinalizedEventParams, UsurpedEventParams > Params
std::reference_wrapper< const T > ref_t