Kagome
Polkadot Runtime Engine in C++17
|
#include <subscription_engine.hpp>
Public Types | |
using | EventKeyType = EventKey |
using | ReceiverType = Receiver |
using | SubscriberType = Subscriber< EventKeyType, ReceiverType, EventParams... > |
using | SubscriberWeakPtr = std::weak_ptr< SubscriberType > |
using | SubscribersContainer = std::list< std::pair< SubscriptionSetId, SubscriberWeakPtr >> |
using | IteratorType = typename SubscribersContainer::iterator |
Public Member Functions | |
SubscriptionEngine ()=default | |
~SubscriptionEngine ()=default | |
SubscriptionEngine (SubscriptionEngine &&)=default | |
SubscriptionEngine & | operator= (SubscriptionEngine &&)=default |
SubscriptionEngine (const SubscriptionEngine &)=delete | |
SubscriptionEngine & | operator= (const SubscriptionEngine &)=delete |
size_t | size (const EventKeyType &key) const |
size_t | size () const |
void | notify (const EventKeyType &key, const EventParams &...args) |
Private Types | |
using | KeyValueContainer = std::unordered_map< EventKeyType, SubscribersContainer > |
Private Member Functions | |
IteratorType | subscribe (SubscriptionSetId set_id, const EventKeyType &key, SubscriberWeakPtr ptr) |
void | unsubscribe (const EventKeyType &key, const IteratorType &it_remove) |
Private Attributes | |
std::shared_mutex | subscribers_map_cs_ |
KeyValueContainer | subscribers_map_ |
Friends | |
template<typename KeyType , typename ValueType , typename... Args> | |
class | Subscriber |
EventKey | - the type of a specific event from event set (e. g. a key from a storage or a particular kind of event from an enumeration) |
Receiver | - the type of an object that is a part of a Subscriber internal state and can be accessed on every event |
EventParams | - set of types of values passed on each event notification |
Definition at line 30 of file subscription_engine.hpp.
using kagome::subscription::SubscriptionEngine< EventKey, Receiver, EventParams >::EventKeyType = EventKey |
Definition at line 34 of file subscription_engine.hpp.
using kagome::subscription::SubscriptionEngine< EventKey, Receiver, EventParams >::IteratorType = typename SubscribersContainer::iterator |
Definition at line 46 of file subscription_engine.hpp.
|
private |
Definition at line 62 of file subscription_engine.hpp.
using kagome::subscription::SubscriptionEngine< EventKey, Receiver, EventParams >::ReceiverType = Receiver |
Definition at line 35 of file subscription_engine.hpp.
using kagome::subscription::SubscriptionEngine< EventKey, Receiver, EventParams >::SubscribersContainer = std::list<std::pair<SubscriptionSetId, SubscriberWeakPtr>> |
List is preferable here because this container iterators remain alive after removal from the middle of the container TODO(iceseer): PRE-476 remove processor cache penalty, while iterating, using custom allocator
Definition at line 45 of file subscription_engine.hpp.
using kagome::subscription::SubscriptionEngine< EventKey, Receiver, EventParams >::SubscriberType = Subscriber<EventKeyType, ReceiverType, EventParams...> |
Definition at line 37 of file subscription_engine.hpp.
using kagome::subscription::SubscriptionEngine< EventKey, Receiver, EventParams >::SubscriberWeakPtr = std::weak_ptr<SubscriberType> |
Definition at line 38 of file subscription_engine.hpp.
|
default |
|
default |
|
default |
|
delete |
|
inline |
Definition at line 101 of file subscription_engine.hpp.
|
default |
|
delete |
|
inline |
Definition at line 86 of file subscription_engine.hpp.
|
inline |
Definition at line 94 of file subscription_engine.hpp.
|
inlineprivate |
Definition at line 67 of file subscription_engine.hpp.
|
inlineprivate |
Definition at line 76 of file subscription_engine.hpp.
|
friend |
Definition at line 60 of file subscription_engine.hpp.
|
private |
Definition at line 65 of file subscription_engine.hpp.
|
mutableprivate |
Definition at line 64 of file subscription_engine.hpp.