hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
subscriber.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_SUBSCRIPTION_SUBSCRIBER_HPP
7 #define IROHA_SUBSCRIPTION_SUBSCRIBER_HPP
8 
9 #include <atomic>
10 #include <functional>
11 #include <memory>
12 #include <mutex>
13 
14 #include "common/common.hpp"
15 
16 namespace iroha::subscription {
17 
18  using SubscriptionSetId = uint32_t;
19 
26  template <typename EventKey, typename Dispatcher, typename... Arguments>
27  class Subscriber : public std::enable_shared_from_this<
28  Subscriber<EventKey, Dispatcher, Arguments...>>,
31  public:
32  using EventType = EventKey;
33  virtual ~Subscriber() = default;
34 
41  virtual void on_notify(SubscriptionSetId set_id,
42  const EventType &key,
43  Arguments &&... args) = 0;
44  };
45 
46 } // namespace iroha::subscription
47 
48 #endif // IROHA_SUBSCRIPTION_SUBSCRIBER_HPP
uint32_t SubscriptionSetId
Definition: subscriber.hpp:18
subscription::IDispatcher Dispatcher
Definition: subscription_fwd.hpp:73
Definition: common.hpp:26
Definition: subscription_fwd.hpp:60
Definition: subscriber.hpp:27
virtual void on_notify(SubscriptionSetId set_id, const EventType &key, Arguments &&... args)=0
Definition: common.hpp:32