13 #include <type_traits> 29 #include <mutils-containers/KindMap.hpp> 30 #include <mutils-containers/TypeMap2.hpp> 38 template <uint32_t counter,
typename TargetType,
typename FirstType,
typename... RestTypes>
40 if constexpr(std::is_same<TargetType, FirstType>::value)
54 template <
typename TargetType,
typename... TypePack>
62 template <
typename TargetType,
typename... TypePack>
63 using contains = std::integral_constant<bool, (std::is_same<TargetType, TypePack>::value || ...)>;
77 template <
typename SubgroupType>
80 template <
typename SubgroupType>
83 template <
typename SubgroupType>
86 template <
typename SubgroupType>
90 template <
typename ReplicatedType>
93 virtual void set_replicated_pointer(std::type_index, uint32_t,
void**) = 0;
94 virtual void set_external_caller_pointer(std::type_index, uint32_t,
void**) = 0;
110 this->subgroup_index = subgroup_index;
121 template <
typename... ReplicatedTypes>
124 void set_replicated_pointer(std::type_index type, uint32_t subgroup_num,
void** ret);
125 void set_external_caller_pointer(std::type_index type, uint32_t subgroup_num,
void** ret);
135 template <
typename T>
204 void receive_objects(
const std::set<std::pair<subgroup_id_t, node_id_t>>& subgroups_and_leaders);
207 void set_up_components();
216 template <
typename... Empty>
217 std::enable_if_t<0 ==
sizeof...(Empty),
218 std::set<std::pair<subgroup_id_t, node_id_t>>>
220 return std::set<std::pair<subgroup_id_t, node_id_t>>();
241 template <
typename FirstType,
typename... RestTypes>
242 std::set<std::pair<subgroup_id_t, node_id_t>> construct_objects(
266 std::vector<view_upcall_t> _view_upcalls = {},
301 template <
typename SubgroupType>
317 template <
typename SubgroupType>
320 template <
typename SubgroupType>
326 void leave(
bool group_shutdown =
true);
329 std::vector<node_id_t> get_members();
336 template <
typename SubgroupType>
339 std::int32_t get_my_rank();
345 template <
typename SubgroupType>
346 std::int32_t get_my_shard(uint32_t subgroup_index = 0);
348 void report_failure(
const node_id_t who);
351 void debug_print_status()
const;
The Deserialization Interface to be implemented by user applications.
auto & get_subgroup(uint32_t subgroup_num=0)
PersistenceManager persistence_manager
Persist the objects.
The top-level object for creating a Derecho group.
std::vector< std::vector< int64_t > > vector_int64_2d
Type of a 2-dimensional vector used to store potential node IDs, or -1.
mutils::KindMap< Factory, ReplicatedTypes... > factories
Maps a type to the Factory for that type.
IDeserializationContext * user_deserialization_context
The shared pointer holding deserialization context is obsolete.
rpc::RPCManager rpc_manager
Contains all state related to receiving and handling RPC function calls for any Replicated objects im...
std::shared_ptr< tcp::tcp_connections > tcp_sockets
Contains a TCP connection to each member of the group, for the purpose of transferring state informat...
ViewManager view_manager
Contains all state related to managing Views, including the MulticastGroup and SST (since those chang...
mutils::KindMap< external_caller_index_map, ReplicatedTypes... > external_callers
Maps each type T to a map of (index -> ExternalCaller<T>) for the subgroup(s) of that type that this ...
virtual ~_Group()=default
constexpr uint32_t index_of_type_impl()
The function that implements index_of_type, which is separate to hide the "counter" template paramete...
std::size_t get_number_of_shards(uint32_t subgroup_index=0)
auto & get_nonmember_subgroup(uint32_t subgroup_num=0)
void set(volatile Elem &e, const Elem &value)
Thread-safe setter for DerechoSST members; ensures there is a std::atomic_signal_fence after writing ...
std::optional< tcp::socket > leader_connection
constexpr uint32_t index_of_type
A compile-time "function" that computes the index of a type within a template parameter pack of types...
std::integral_constant< bool,(std::is_same< TargetType, TypePack >::value||...)> contains
A type-trait-like template that provides a True member "value" if TargetType matches some type in Typ...
PersistenceManager is responsible for persisting all the data in a group.
virtual uint32_t get_index_of_type(const std::type_info &)=0
std::function< std::unique_ptr< T >(persistent::PersistentRegistry *)> Factory
The type of factory function the user must provide to the Group constructor, to construct each Replic...
Bundles together a set of callback functions for message delivery events.
std::enable_if_t< 0==sizeof...(Empty), std::set< std::pair< subgroup_id_t, node_id_t > > > construct_objects(const View &, const vector_int64_2d &)
Base case for the construct_objects template.
uint32_t node_id_t
Type alias for Node IDs in a Derecho group.
std::vector< std::vector< node_id_t > > get_subgroup_members(uint32_t subgroup_index=0)
std::map< uint32_t, Replicated< T > > replicated_index_map
Container for whatever information is needed to describe a Group's subgroups and shards.
std::map< subgroup_id_t, std::reference_wrapper< ReplicatedObject > > objects_by_subgroup_id
Alternate view of the Replicated<T>s, indexed by subgroup ID.
void set_group_pointers(_Group *group, uint32_t subgroup_index)
std::map< uint32_t, ExternalCaller< T > > external_caller_index_map
mutils::KindMap< replicated_index_map, ReplicatedTypes... > replicated_objects
Maps each type T to a map of (index -> Replicated<T>) for that type's subgroup(s).