TARAXA
taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params > Class Template Reference

#include <watches.hpp>

Collaboration diagram for taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >:

Classes

struct  Watch
 

Public Types

using InputType = InputType_
 
using OutputType = std::conditional_t< std::is_same_v< OutputType_, placeholder_t >, InputType, OutputType_ >
 
using time_point = std::chrono::high_resolution_clock::time_point
 
using Updater = std::function< void(Params const &, InputType const &, std::function< void(OutputType const &)> const &)>
 

Public Member Functions

 WatchGroup (WatchesConfig const &cfg={}, Updater &&updater={})
 
WatchID install_watch (Params &&params={}) const
 
bool uninstall_watch (WatchID watch_id) const
 
void uninstall_stale_watches () const
 
std::optional< Params > get_watch_params (WatchID watch_id) const
 
void process_update (InputType const &obj_in) const
 
auto poll (WatchID watch_id) const
 

Static Public Attributes

static constexpr auto type = type_
 

Private Attributes

WatchGroupConfig cfg_
 
Updater updater_
 
std::unordered_map< WatchID, Watchwatches_
 
std::shared_mutex watches_mu_
 
WatchID watch_id_seq_ = 0
 

Class Documentation

◆ taraxa::net::rpc::eth::WatchGroup::Watch

struct taraxa::net::rpc::eth::WatchGroup::Watch

template<WatchType type_, typename InputType_, typename OutputType_ = placeholder_t, typename Params = placeholder_t>
struct taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::Watch

Collaboration diagram for taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::Watch:
Class Members
time_point last_touched
DefaultConstructCopyableMovable< shared_mutex > mu
Params params
vector< OutputType > updates

Member Typedef Documentation

◆ InputType

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
using taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::InputType = InputType_

◆ OutputType

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
using taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::OutputType = std::conditional_t<std::is_same_v<OutputType_, placeholder_t>, InputType, OutputType_>

◆ time_point

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
using taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::time_point = std::chrono::high_resolution_clock::time_point

◆ Updater

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
using taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::Updater = std::function<void(Params const&, InputType const&, std::function<void(OutputType const&)> const& )>

Constructor & Destructor Documentation

◆ WatchGroup()

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::WatchGroup ( WatchesConfig const &  cfg = {},
Updater &&  updater = {} 
)
inlineexplicit

Member Function Documentation

◆ get_watch_params()

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
std::optional<Params> taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::get_watch_params ( WatchID  watch_id) const
inline

◆ install_watch()

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
WatchID taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::install_watch ( Params &&  params = {}) const
inline

◆ poll()

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
auto taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::poll ( WatchID  watch_id) const
inline

◆ process_update()

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
void taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::process_update ( InputType const &  obj_in) const
inline

◆ uninstall_stale_watches()

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
void taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::uninstall_stale_watches ( ) const
inline

◆ uninstall_watch()

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
bool taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::uninstall_watch ( WatchID  watch_id) const
inline

Member Data Documentation

◆ cfg_

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
WatchGroupConfig taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::cfg_
private

◆ type

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
constexpr auto taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::type = type_
staticconstexpr

◆ updater_

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
Updater taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::updater_
private

◆ watch_id_seq_

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
WatchID taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::watch_id_seq_ = 0
mutableprivate

◆ watches_

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
std::unordered_map<WatchID, Watch> taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::watches_
mutableprivate

◆ watches_mu_

template<WatchType type_, typename InputType_ , typename OutputType_ = placeholder_t, typename Params = placeholder_t>
std::shared_mutex taraxa::net::rpc::eth::WatchGroup< type_, InputType_, OutputType_, Params >::watches_mu_
mutableprivate

The documentation for this class was generated from the following file: