Kagome
Polkadot Runtime Engine in C++17
|
#include <author_api_impl.hpp>
Public Types | |
using | EventType = EventKey |
using | ReceiverType = Receiver |
using | Hash = size_t |
using | SubscriptionEngineType = SubscriptionEngine< EventType, ReceiverType, Arguments... > |
using | SubscriptionEnginePtr = std::shared_ptr< SubscriptionEngineType > |
using | CallbackFnType = std::function< void(SubscriptionSetId, ReceiverType &, const EventType &, const Arguments &...)> |
Public Member Functions | |
template<typename... SubscriberConstructorArgs> | |
Subscriber (SubscriptionEnginePtr &ptr, SubscriberConstructorArgs &&...args) | |
~Subscriber () | |
Subscriber (const Subscriber &)=delete | |
Subscriber & | operator= (const Subscriber &)=delete |
Subscriber (Subscriber &&)=default | |
Subscriber & | operator= (Subscriber &&)=default |
void | setCallback (CallbackFnType &&f) |
SubscriptionSetId | generateSubscriptionSetId () |
void | subscribe (SubscriptionSetId id, const EventType &key) |
bool | unsubscribe (SubscriptionSetId id, const EventType &key) |
bool | unsubscribe (SubscriptionSetId id) |
void | unsubscribe () |
void | on_notify (SubscriptionSetId set_id, const EventType &key, const Arguments &...args) |
ReceiverType & | get () |
Private Types | |
using | SubscriptionsContainer = std::unordered_map< EventType, typename SubscriptionEngineType::IteratorType > |
using | SubscriptionsSets = std::unordered_map< SubscriptionSetId, SubscriptionsContainer > |
Private Attributes | |
SubscriptionEnginePtr | engine_ |
ReceiverType | object_ |
std::mutex | subscriptions_cs_ |
SubscriptionsSets | subscriptions_sets_ |
CallbackFnType | on_notify_callback_ |
Is a wrapper class, which provides subscription to events from SubscriptionEngine
EventKey | is a type of a particular subscription event (might be a key from an observed storage or a specific event type from an enumeration). |
ReceiverType | is a type of an object which is a part of Subscriber's internal state and can be accessed on every event notification. |
Arguments | is a set of types of objects that are passed on every event notification. |
Definition at line 51 of file author_api_impl.hpp.
using kagome::subscription::Subscriber< EventKey, Receiver, Arguments >::CallbackFnType = std::function<void(SubscriptionSetId, ReceiverType &, const EventType &, const Arguments &...)> |
Definition at line 49 of file subscriber.hpp.
using kagome::subscription::Subscriber< EventKey, Receiver, Arguments >::EventType = EventKey |
Definition at line 38 of file subscriber.hpp.
using kagome::subscription::Subscriber< EventKey, Receiver, Arguments >::Hash = size_t |
Definition at line 40 of file subscriber.hpp.
using kagome::subscription::Subscriber< EventKey, Receiver, Arguments >::ReceiverType = Receiver |
Definition at line 39 of file subscriber.hpp.
using kagome::subscription::Subscriber< EventKey, Receiver, Arguments >::SubscriptionEnginePtr = std::shared_ptr<SubscriptionEngineType> |
Definition at line 44 of file subscriber.hpp.
using kagome::subscription::Subscriber< EventKey, Receiver, Arguments >::SubscriptionEngineType = SubscriptionEngine<EventType, ReceiverType, Arguments...> |
Definition at line 43 of file subscriber.hpp.
|
private |
Definition at line 54 of file subscriber.hpp.
|
private |
Definition at line 56 of file subscriber.hpp.
|
inlineexplicit |
Definition at line 67 of file subscriber.hpp.
|
inline |
Definition at line 72 of file subscriber.hpp.
|
delete |
|
default |
|
inline |
Definition at line 88 of file subscriber.hpp.
|
inline |
Definition at line 155 of file subscriber.hpp.
|
inline |
Definition at line 148 of file subscriber.hpp.
|
delete |
|
default |
|
inline |
Definition at line 84 of file subscriber.hpp.
|
inline |
Here we check first local subscriptions because of strong connection with SubscriptionEngine.
Definition at line 92 of file subscriber.hpp.
|
inline |
id | – subscription set id that unsubscribes from
|
key | – event key to unsubscribe from |
Definition at line 108 of file subscriber.hpp.
|
inline |
id | – subscription set id to unsubscribe from |
Definition at line 127 of file subscriber.hpp.
|
inline |
Definition at line 140 of file subscriber.hpp.
|
private |
Definition at line 57 of file subscriber.hpp.
|
private |
Definition at line 58 of file subscriber.hpp.
|
private |
Definition at line 63 of file subscriber.hpp.
|
private |
Definition at line 60 of file subscriber.hpp.
|
private |
Definition at line 61 of file subscriber.hpp.