Derecho  0.9
Distributed systems toolkit for RDMA
Public Member Functions | Public Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
derecho::ViewManager Class Reference

#include <view_manager.hpp>

Collaboration diagram for derecho::ViewManager:
Collaboration graph
[legend]

Public Member Functions

 ViewManager (const SubgroupInfo &subgroup_info, const std::vector< std::type_index > &subgroup_type_order, const bool any_persistent_objects, const std::shared_ptr< tcp::tcp_connections > &group_tcp_sockets, ReplicatedObjectReferenceMap &object_reference_map, const persistence_manager_callbacks_t &_persistence_manager_callbacks, std::vector< view_upcall_t > _view_upcalls={})
 Constructor for a new group where this node is the GMS leader. More...
 
 ViewManager (tcp::socket &leader_connection, const SubgroupInfo &subgroup_info, const std::vector< std::type_index > &subgroup_type_order, const bool any_persistent_objects, const std::shared_ptr< tcp::tcp_connections > &group_tcp_sockets, ReplicatedObjectReferenceMap &object_reference_map, const persistence_manager_callbacks_t &_persistence_manager_callbacks, std::vector< view_upcall_t > _view_upcalls={})
 Constructor for joining an existing group, assuming the caller has already opened a socket to the group's leader. More...
 
 ~ViewManager ()
 
void await_rejoining_nodes (const node_id_t my_id)
 Setup method for the leader when it is restarting from complete failure: waits for a restart quorum of nodes from the last known view to join. More...
 
bool check_view_committed (tcp::socket &leader_connection)
 Setup method for non-leader nodes: checks whether the initial View received in the constructor gets committed by the leader, and if not, waits for another initial View to be sent. More...
 
bool leader_prepare_initial_view (bool &leader_has_quorum)
 Setup method for the leader node in total restart mode: sends a Prepare message to all non-leader nodes indicating that state transfer has finished. More...
 
void leader_commit_initial_view ()
 Setup method for the leader node: sends a commit message to all non-leader nodes indicating that it is safe to use the initial View. More...
 
void truncate_logs ()
 An extra setup step only needed during total restart; truncates the persistent logs of this node to conform to the ragged trim decided on by the restart leader. More...
 
void send_logs ()
 An extra setup method only needed during total restart. More...
 
void initialize_multicast_groups (CallbackSet callbacks)
 Sets up RDMA sessions for the multicast groups within this group. More...
 
void finish_setup ()
 Completes first-time setup of the ViewManager, including synchronizing the initial SST and delivering the first new-view upcalls. More...
 
void start ()
 Starts predicate evaluation in the current view's SST. More...
 
const vector_int64_2dget_old_shard_leaders () const
 
void leave ()
 Causes this node to cleanly leave the group by setting itself to "failed.". More...
 
std::vector< node_id_tget_members ()
 Returns a vector listing the nodes that are currently members of the group. More...
 
int32_t get_my_rank ()
 Returns the order of this node in the sequence of members of the group. More...
 
std::vector< std::vector< node_id_t > > get_subgroup_members (subgroup_type_id_t subgroup_type, uint32_t subgroup_index)
 Returns a vector of vectors listing the members of a single subgroup (identified by type and index), organized by shard number. More...
 
std::size_t get_number_of_shards_in_subgroup (subgroup_type_id_t subgroup_type, uint32_t subgroup_index)
 
int32_t get_my_shard (subgroup_type_id_t subgroup_type, uint32_t subgroup_index)
 If this node is a member of the given subgroup (identified by its type and index), returns the number of the shard this node belongs to. More...
 
void send (subgroup_id_t subgroup_num, long long unsigned int payload_size, const std::function< void(char *buf)> &msg_generator, bool cooked_send=false)
 Instructs the managed DerechoGroup's to send the next message. More...
 
const uint64_t compute_global_stability_frontier (subgroup_id_t subgroup_num)
 
SharedLockedReference< Viewget_current_view ()
 
SharedLockedReference< const Viewget_current_view_const ()
 This function is a dirty workaround for the fact that Group might need read-only access to curr_view during a total restart when curr_view is owned by restart_leader_state, but it's only available by const reference and SharedLockedReference<View> wants a mutable reference. More...
 
void add_view_upcall (const view_upcall_t &upcall)
 Adds another function to the set of "view upcalls," which are called when the view changes to notify another component of the new view. More...
 
void report_failure (const node_id_t who)
 Reports to the GMS that the given node has failed. More...
 
void barrier_sync ()
 Waits until all members of the group have called this function. More...
 
void register_initialize_objects_upcall (initialize_rpc_objects_t upcall)
 Registers a function that will initialize all the RPC objects at this node, given a new view and a list of the shard leaders in the previous view (needed to download object state). More...
 
void silence ()
 stop complaining about node failures. More...
 
void debug_print_status () const
 
std::map< subgroup_id_t, uint64_t > get_max_payload_sizes ()
 

Public Attributes

std::map< subgroup_id_t, uint64_t > max_payload_sizes
 
uint64_t view_max_rpc_reply_payload_size = 0
 
uint32_t view_max_rpc_window_size = 0
 

Private Types

using pred_handle = sst::Predicates< DerechoSST >::pred_handle
 
using initialize_rpc_objects_t = std::function< void(node_id_t, const View &, const std::vector< std::vector< int64_t > > &)>
 
using ReplicatedObjectReferenceMap = std::map< subgroup_id_t, std::reference_wrapper< ReplicatedObject > >
 

Private Member Functions

bool has_pending_join ()
 
void new_suspicion (DerechoSST &gmsSST)
 Called when there is a new failure suspicion. More...
 
void leader_start_join (DerechoSST &gmsSST)
 Runs only on the group leader; proposes new views to include new members. More...
 
void redirect_join_attempt (DerechoSST &gmsSST)
 Runs on non-leaders to redirect confused new members to the current leader. More...
 
void new_leader_takeover (DerechoSST &gmsSST)
 Runs once on a node that becomes a leader due to a failure. More...
 
void leader_commit_change (DerechoSST &gmsSST)
 Runs only on the group leader and updates num_committed when all non-failed members have acked a proposed view change. More...
 
void acknowledge_proposed_change (DerechoSST &gmsSST)
 Updates num_acked to acknowledge a proposed change when the leader increments num_changes. More...
 
void start_meta_wedge (DerechoSST &gmsSST)
 Runs when at least one membership change has been committed by the leader, and wedges the current view in preparation for a new view. More...
 
void terminate_epoch (DerechoSST &gmsSST)
 Runs when all live nodes have reported they have wedged the current view (meta-wedged), and starts ragged edge cleanup to finalize the terminated epoch. More...
 
void echo_ragged_trim (std::shared_ptr< std::map< subgroup_id_t, uint32_t >> follower_subgroups_and_shards, DerechoSST &gmsSST)
 Runs when the leader nodes of each subgroup have finished ragged edge cleanup. More...
 
void deliver_ragged_trim (DerechoSST &gmsSST)
 Delivers messages that were marked deliverable by the ragged trim and proceeds to finish_view_change() when this is done. More...
 
void finish_view_change (DerechoSST &gmsSST)
 Finishes installing the new view, assuming it is adequately provisioned. More...
 
bool receive_join (DerechoSST &gmsSST, tcp::socket &client_socket)
 Assuming this node is the leader, handles a join request from a client. More...
 
void update_tcp_connections (const View &new_view)
 Updates the TCP connections pool to reflect the joined and departed members in a new view. More...
 
void send_objects_to_new_members (const View &new_view, const vector_int64_2d &old_shard_leaders)
 Helper method for completing view changes; determines whether this node needs to send Replicated Object state to each node that just joined, and then sends the state if necessary. More...
 
void send_subgroup_object (subgroup_id_t subgroup_id, node_id_t new_node_id)
 Sends a single subgroup's replicated object to a new member after a view change. More...
 
void send_view (const View &new_view, tcp::socket &client_socket)
 Sends a joining node the new view that has been constructed to include it. More...
 
void log_ragged_trim (const int shard_leader_rank, const subgroup_id_t subgroup_num, const uint32_t num_received_offset, const uint num_shard_senders)
 Reads the global_min values for the specified subgroup (and the shard that this node belongs to) from the SST, creates a ragged trim vector with these values, and persists the ragged trim to disk. More...
 
void deliver_in_order (const int shard_leader_rank, const subgroup_id_t subgroup_num, const uint32_t num_received_offset, const std::vector< node_id_t > &shard_members, uint num_shard_senders)
 Reads the global_min for the specified subgroup from the SST (assuming it has been computed already) and tells the current View's MulticastGroup to deliver messages up to the global_min (i.e. More...
 
void leader_ragged_edge_cleanup (const subgroup_id_t subgroup_num, const uint32_t num_received_offset, const std::vector< node_id_t > &shard_members, uint num_shard_senders)
 Implements the Ragged Edge Cleanup algorithm for a subgroup/shard leader, operating on the shard that this node is a member of. More...
 
void follower_ragged_edge_cleanup (const subgroup_id_t subgroup_num, uint shard_leader_rank, const uint32_t num_received_offset, uint num_shard_senders)
 Implements the Ragged Edge Cleanup algorithm for a non-leader node in a subgroup. More...
 
void create_threads ()
 Constructor helper method to encapsulate spawning the background threads. More...
 
void register_predicates ()
 Constructor helper method to encapsulate creating all the predicates. More...
 
void load_ragged_trim ()
 Constructor helper that reads logged ragged trim information from disk, called only if there is also a logged view on disk from a previous failed group. More...
 
void await_first_view (const node_id_t my_id)
 Constructor helper for the leader when it first starts; waits for enough new nodes to join to make the first view adequately provisioned. More...
 
void receive_view_and_leaders (const node_id_t my_id, tcp::socket &leader_connection)
 Constructor helper for non-leader nodes; encapsulates receiving and deserializing a View, DerechoParams, and state-transfer leaders (old shard leaders) from the leader. More...
 
void truncate_persistent_logs (const ragged_trim_map_t &logged_ragged_trim)
 Helper function for total restart mode: Uses the RaggedTrim values in logged_ragged_trim to truncate any persistent logs that have a persisted version later than the last committed version in the RaggedTrim. More...
 
void initialize_rdmc_sst ()
 Performs one-time global initialization of RDMC and SST, using the current view's membership. More...
 
void receive_initial_view (node_id_t my_id, tcp::socket &leader_connection)
 Helper for joining an existing group; receives the View and parameters from the leader. More...
 
void setup_initial_tcp_connections (const View &initial_view, node_id_t my_id)
 Constructor helper that initializes TCP connections (for state transfer) to the members of initial_view in ascending rank order. More...
 
void reinit_tcp_connections (const View &initial_view, node_id_t my_id)
 Another setup helper for joining nodes; re-initializes the TCP connections list to reflect the current list of members in initial_view, assuming that the first view was aborted and a new one has been sent. More...
 
void construct_multicast_group (CallbackSet callbacks, const std::map< subgroup_id_t, SubgroupSettings > &subgroup_settings, const uint32_t num_received_size, const uint32_t slot_size)
 Creates the SST and MulticastGroup for the first time, using the current view's member list. More...
 
void transition_multicast_group (const std::map< subgroup_id_t, SubgroupSettings > &new_subgroup_settings, const uint32_t new_num_received_size, const uint32_t new_slot_size)
 Sets up the SST and MulticastGroup for a new view, based on the settings in the current view, and copies over the SST data from the current view. More...
 
std::pair< uint32_t, uint32_t > derive_subgroup_settings (View &curr_view, std::map< subgroup_id_t, SubgroupSettings > &subgroup_settings)
 Creates the subgroup-settings map that MulticastGroup's constructor needs (and the num_received_size for the SST) based on the subgroup information already in curr_view. More...
 

Static Private Member Functions

static bool suspected_not_equal (const DerechoSST &gmsSST, const std::vector< bool > &old)
 
static void copy_suspected (const DerechoSST &gmsSST, std::vector< bool > &old)
 
static bool changes_contains (const DerechoSST &gmsSST, const node_id_t q)
 
static int min_acked (const DerechoSST &gmsSST, const std::vector< char > &failed)
 
static bool previous_leaders_suspected (const DerechoSST &gmsSST, const View &curr_view)
 
static bool copy_prior_leader_proposals (DerechoSST &gmsSST)
 Searches backwards from this node's row in the SST to lower-ranked rows, looking for proposed changes not in this node's changes list, assuming this node is the current leader and the lower-ranked rows are failed prior leaders. More...
 
static std::unique_ptr< Viewmake_next_view (const std::unique_ptr< View > &curr_view, const DerechoSST &gmsSST)
 Constructs the next view from the current view and the set of committed changes in the SST. More...
 
static void make_subgroup_maps (const SubgroupInfo &subgroup_info, const std::unique_ptr< View > &prev_view, View &curr_view)
 Initializes curr_view with subgroup information based on the membership functions in subgroup_info. More...
 
static uint32_t compute_num_received_size (const View &view)
 Recomputes num_received_size (the length of the num_received column in the SST) for an existing provisioned View, without re-running the subgroup membership functions. More...
 
template<PORT_TYPE port_index>
static std::map< node_id_t, std::pair< ip_addr_t, uint16_t > > make_member_ips_and_ports_map (const View &view)
 Constructs a map from node ID -> IP address from the parallel vectors in the given View. More...
 
static vector_int64_2d old_shard_leaders_by_new_ids (const View &curr_view, const View &next_view)
 Constructs a vector mapping subgroup ID in the new view -> shard number -> node ID of that shard's leader in the old view. More...
 
template<typename ValueType >
static std::unique_ptr< std::vector< std::vector< ValueType > > > receive_vector2d (tcp::socket &socket)
 A little convenience method that receives a 2-dimensional vector using our standard network protocol, which first sends the buffer size and then a serialized buffer. More...
 

Private Attributes

std::shared_timed_mutex view_mutex
 Controls access to curr_view. More...
 
std::condition_variable_any view_change_cv
 Notified when curr_view changes (i.e. More...
 
std::unique_ptr< Viewcurr_view
 The current View, containing the state of the managed group. More...
 
std::unique_ptr< Viewnext_view
 May hold a pointer to the partially-constructed next view, if we are in the process of transitioning to a new view. More...
 
LockedQueue< tcp::socketpending_join_sockets
 On the leader node, contains client sockets for pending joins that have not yet been handled. More...
 
std::queue< std::unique_ptr< View > > old_views
 Contains old Views that need to be cleaned up. More...
 
std::mutex old_views_mutex
 
std::condition_variable old_views_cv
 
std::list< tcp::socketproposed_join_sockets
 The sockets connected to clients that will join in the next view, if any. More...
 
std::vector< bool > last_suspected
 A cached copy of the last known value of this node's suspected[] array. More...
 
tcp::connection_listener server_socket
 The TCP socket the leader uses to listen for joining clients. More...
 
std::atomic< bool > thread_shutdown
 A flag to signal background threads to shut down; set to true when the group is destroyed. More...
 
std::thread client_listener_thread
 The background thread that listens for clients connecting on our server socket. More...
 
std::thread old_view_cleanup_thread
 
const bool disable_partitioning_safety
 A user-configurable option that disables the checks for partitioning events. More...
 
pred_handle suspected_changed_handle
 
pred_handle start_join_handle
 
pred_handle reject_join_handle
 
pred_handle change_commit_ready_handle
 
pred_handle leader_proposed_handle
 
pred_handle leader_committed_handle
 
std::vector< view_upcall_tview_upcalls
 Functions to be called whenever the view changes, to report the new view to some other component. More...
 
const SubgroupInfo subgroup_info
 The subgroup membership function, which will be called whenever the view changes. More...
 
std::vector< std::type_index > subgroup_type_order
 Indicates the order that the subgroups should be provisioned; set by Group to be the same order as its template parameters. More...
 
std::shared_ptr< tcp::tcp_connectionstcp_sockets
 The same set of TCP sockets used by Group and RPCManager. More...
 
ReplicatedObjectReferenceMapsubgroup_objects
 A type-erased list of references to the Replicated<T> objects in this group, indexed by their subgroup ID. More...
 
initialize_rpc_objects_t initialize_subgroup_objects
 A function that will be called to initialize replicated objects after transitioning to a new view. More...
 
const bool any_persistent_objects
 True if any of the Replicated<T> objects in this group have a Persistent<T> field, false if none of them do. More...
 
bool in_total_restart
 Set to true in the constructor if this node must do a total restart before completing group setup; false otherwise. More...
 
std::unique_ptr< RestartLeaderStaterestart_leader_state_machine
 If this node is the restart leader and currently doing a total restart, this object contains state related to the restart, including curr_view. More...
 
std::unique_ptr< RestartStaterestart_state
 If this node is currently doing a total restart, this object contains state related to restarting, such as the current logged ragged trim. More...
 
bool active_leader
 True if this node is the current leader and is fully active (i.e. More...
 
persistence_manager_callbacks_t persistence_manager_callbacks
 The persistence request func is from persistence manager. More...
 
std::vector< std::vector< int64_t > > prior_view_shard_leaders
 A 2-dimensional vector, indexed by (subgroup ID -> shard number), containing the ID of the node in each shard that was its leader in the prior view, or -1 if that shard had no state in the prior view. More...
 
std::atomic< bool > bSilent = false
 On a graceful exit, nodes will be agree to leave at some point, where the view manager should stop throw exception on "failure". More...
 

Friends

class rpc::RPCManager
 
template<typename T >
class Replicated
 
template<typename T >
class ExternalCaller
 
class PersistenceManager
 
class RestartLeaderState
 

Detailed Description

Definition at line 93 of file view_manager.hpp.

Member Typedef Documentation

◆ initialize_rpc_objects_t

using derecho::ViewManager::initialize_rpc_objects_t = std::function<void(node_id_t, const View&, const std::vector<std::vector<int64_t> >&)>
private

Definition at line 97 of file view_manager.hpp.

◆ pred_handle

Definition at line 95 of file view_manager.hpp.

◆ ReplicatedObjectReferenceMap

using derecho::ViewManager::ReplicatedObjectReferenceMap = std::map<subgroup_id_t, std::reference_wrapper<ReplicatedObject> >
private

Definition at line 172 of file view_manager.hpp.

Constructor & Destructor Documentation

◆ ViewManager() [1/2]

derecho::ViewManager::ViewManager ( const SubgroupInfo subgroup_info,
const std::vector< std::type_index > &  subgroup_type_order,
const bool  any_persistent_objects,
const std::shared_ptr< tcp::tcp_connections > &  group_tcp_sockets,
ReplicatedObjectReferenceMap object_reference_map,
const persistence_manager_callbacks_t _persistence_manager_callbacks,
std::vector< view_upcall_t _view_upcalls = {} 
)

Constructor for a new group where this node is the GMS leader.

Parameters
my_ipThe IP address of the node executing this code
subgroup_infoThe set of functions defining subgroup membership for this group.
group_tcp_socketsThe pool of TCP connections to each group member that is shared with Group.
object_reference_mapA mutable reference to the list of ReplicatedObject references in Group, so that ViewManager can access it while Group manages the list
_persistence_manager_callbacksThe persistence manager callbacks.
_view_upcallsAny extra View Upcalls to be called when a view changes.

Definition at line 29 of file view_manager.cpp.

◆ ViewManager() [2/2]

derecho::ViewManager::ViewManager ( tcp::socket leader_connection,
const SubgroupInfo subgroup_info,
const std::vector< std::type_index > &  subgroup_type_order,
const bool  any_persistent_objects,
const std::shared_ptr< tcp::tcp_connections > &  group_tcp_sockets,
ReplicatedObjectReferenceMap object_reference_map,
const persistence_manager_callbacks_t _persistence_manager_callbacks,
std::vector< view_upcall_t _view_upcalls = {} 
)

Constructor for joining an existing group, assuming the caller has already opened a socket to the group's leader.

Parameters
my_idThe node ID of this node
leader_connectionA Socket connected to the leader on its group-management service port.
subgroup_infoThe set of functions defining subgroup membership in this group. Must be the same as the SubgroupInfo used to set up the leader.
group_tcp_socketsThe pool of TCP connections to each group member that is shared with Group.
object_reference_mapA mutable reference to the list of ReplicatedObject references in Group, so that ViewManager can access it while Group manages the list
_persistence_manager_callbacksThe persistence manager callbacks
_view_upcallsAny extra View Upcalls to be called when a view changes.

Definition at line 88 of file view_manager.cpp.

◆ ~ViewManager()

derecho::ViewManager::~ViewManager ( )

Definition at line 117 of file view_manager.cpp.

Member Function Documentation

◆ acknowledge_proposed_change()

void derecho::ViewManager::acknowledge_proposed_change ( DerechoSST gmsSST)
private

Updates num_acked to acknowledge a proposed change when the leader increments num_changes.

Mostly intended for non-leaders, but also runs on the leader.

Definition at line 887 of file view_manager.cpp.

◆ add_view_upcall()

void derecho::ViewManager::add_view_upcall ( const view_upcall_t upcall)

Adds another function to the set of "view upcalls," which are called when the view changes to notify another component of the new view.

Definition at line 2046 of file view_manager.cpp.

◆ await_first_view()

void derecho::ViewManager::await_first_view ( const node_id_t  my_id)
private

Constructor helper for the leader when it first starts; waits for enough new nodes to join to make the first view adequately provisioned.

Definition at line 420 of file view_manager.cpp.

◆ await_rejoining_nodes()

void derecho::ViewManager::await_rejoining_nodes ( const node_id_t  my_id)

Setup method for the leader when it is restarting from complete failure: waits for a restart quorum of nodes from the last known view to join.

Definition at line 539 of file view_manager.cpp.

◆ barrier_sync()

void derecho::ViewManager::barrier_sync ( )

Waits until all members of the group have called this function.

Definition at line 2087 of file view_manager.cpp.

◆ changes_contains()

bool derecho::ViewManager::changes_contains ( const DerechoSST gmsSST,
const node_id_t  q 
)
staticprivate

Definition at line 1778 of file view_manager.cpp.

◆ check_view_committed()

bool derecho::ViewManager::check_view_committed ( tcp::socket leader_connection)

Setup method for non-leader nodes: checks whether the initial View received in the constructor gets committed by the leader, and if not, waits for another initial View to be sent.

Parameters
leader_connection
Returns
True if the initial View was committed, false if it was aborted and a new View has been received.

Definition at line 245 of file view_manager.cpp.

◆ compute_global_stability_frontier()

const uint64_t derecho::ViewManager::compute_global_stability_frontier ( subgroup_id_t  subgroup_num)

Definition at line 2041 of file view_manager.cpp.

◆ compute_num_received_size()

uint32_t derecho::ViewManager::compute_num_received_size ( const View view)
staticprivate

Recomputes num_received_size (the length of the num_received column in the SST) for an existing provisioned View, without re-running the subgroup membership functions.

Used in total restart to set up an SST when all you have is a logged View.

Parameters
viewThe View to compute num_received_size for, based on its SubViews
Returns
The length to provide to DerechoSST for num_received_size

Definition at line 1515 of file view_manager.cpp.

◆ construct_multicast_group()

void derecho::ViewManager::construct_multicast_group ( CallbackSet  callbacks,
const std::map< subgroup_id_t, SubgroupSettings > &  subgroup_settings,
const uint32_t  num_received_size,
const uint32_t  slot_size 
)
private

Creates the SST and MulticastGroup for the first time, using the current view's member list.

Parameters
callbacksThe custom callbacks to supply to the MulticastGroup
subgroup_settingsThe subgroup settings map to supply to the MulticastGroup
num_received_sizeThe size of the num_received field in the SST (derived from subgroup_settings)

Definition at line 1338 of file view_manager.cpp.

◆ copy_prior_leader_proposals()

bool derecho::ViewManager::copy_prior_leader_proposals ( DerechoSST gmsSST)
staticprivate

Searches backwards from this node's row in the SST to lower-ranked rows, looking for proposed changes not in this node's changes list, assuming this node is the current leader and the lower-ranked rows are failed prior leaders.

If a lower-ranked row has more changes, or different changes, copies that node's changes array to the local row.

Parameters
gmsSST
Returns
True if there was a prior leader with changes to copy, false if no prior proposals were found.

Definition at line 1822 of file view_manager.cpp.

◆ copy_suspected()

void derecho::ViewManager::copy_suspected ( const DerechoSST gmsSST,
std::vector< bool > &  old 
)
staticprivate

Definition at line 1772 of file view_manager.cpp.

◆ create_threads()

void derecho::ViewManager::create_threads ( )
private

Constructor helper method to encapsulate spawning the background threads.

Definition at line 615 of file view_manager.cpp.

◆ debug_print_status()

void derecho::ViewManager::debug_print_status ( ) const

Definition at line 2105 of file view_manager.cpp.

◆ deliver_in_order()

void derecho::ViewManager::deliver_in_order ( const int  shard_leader_rank,
const subgroup_id_t  subgroup_num,
const uint32_t  num_received_offset,
const std::vector< node_id_t > &  shard_members,
uint  num_shard_senders 
)
private

Reads the global_min for the specified subgroup from the SST (assuming it has been computed already) and tells the current View's MulticastGroup to deliver messages up to the global_min (i.e.

the computed ragged trim).

Parameters
shard_leader_rankThe rank of the leader node in this node's shard of the specified subgroup
subgroup_numThe subgroup ID to deliver messages in
num_received_offsetThe offset into the SST's num_received field that corresponds to the specified subgroup's entries in it
shard_membersThe IDs of the members of this node's shard in the specified subgroup
num_shard_sendersThe number of nodes in that shard that are active senders in the current epoch

Definition at line 1938 of file view_manager.cpp.

◆ deliver_ragged_trim()

void derecho::ViewManager::deliver_ragged_trim ( DerechoSST gmsSST)
private

Delivers messages that were marked deliverable by the ragged trim and proceeds to finish_view_change() when this is done.

Runs after every non-leader node has echoed the subgroup leaders' ragged trims.

Definition at line 1135 of file view_manager.cpp.

◆ derive_subgroup_settings()

std::pair< uint32_t, uint32_t > derecho::ViewManager::derive_subgroup_settings ( View curr_view,
std::map< subgroup_id_t, SubgroupSettings > &  subgroup_settings 
)
private

Creates the subgroup-settings map that MulticastGroup's constructor needs (and the num_received_size for the SST) based on the subgroup information already in curr_view.

Also reinitializes curr_view's my_subgroups to indicate which subgroups this node belongs to.

Parameters
curr_viewA mutable reference to the current View, which will have its my_subgroups corrected
subgroup_settingsA mutable reference to the subgroup settings map, which will be filled in by this function
Returns
num_received_size and slot_size for the SST based on the current View's subgroup membership

Definition at line 1589 of file view_manager.cpp.

◆ echo_ragged_trim()

void derecho::ViewManager::echo_ragged_trim ( std::shared_ptr< std::map< subgroup_id_t, uint32_t >>  follower_subgroups_and_shards,
DerechoSST gmsSST 
)
private

Runs when the leader nodes of each subgroup have finished ragged edge cleanup.

Echoes the global_min they have posted in the SST to acknowledge it.

Parameters
follower_subgroups_and_shardsA list of subgroups this node is a non-leader in, and the corresponding shard number for this node

Definition at line 1087 of file view_manager.cpp.

◆ finish_setup()

void derecho::ViewManager::finish_setup ( )

Completes first-time setup of the ViewManager, including synchronizing the initial SST and delivering the first new-view upcalls.

This assumes the initial view has been committed and initialize_multicast_groups has finished.

Definition at line 313 of file view_manager.cpp.

◆ finish_view_change()

void derecho::ViewManager::finish_view_change ( DerechoSST gmsSST)
private

Finishes installing the new view, assuming it is adequately provisioned.

Sends the new view and necessary Replicated Object state to new members, sets up the new SST and MulticastGroup instances, and calls the new-view upcalls.

Definition at line 1190 of file view_manager.cpp.

◆ follower_ragged_edge_cleanup()

void derecho::ViewManager::follower_ragged_edge_cleanup ( const subgroup_id_t  subgroup_num,
uint  shard_leader_rank,
const uint32_t  num_received_offset,
uint  num_shard_senders 
)
private

Implements the Ragged Edge Cleanup algorithm for a non-leader node in a subgroup.

This simply waits for the leader to write a value to global_min and then copies and uses it.

Parameters
subgroup_numThe subgroup ID of the subgroup to do cleanup on
shard_leader_rankThe rank of the leader node in this node's shard of the specified subgroup
num_received_offsetThe offset into the SST's num_received field that corresponds to the specified subgroup's entries in it
num_shard_sendersThe number of nodes in that shard that are active senders in the current epoch

Definition at line 1914 of file view_manager.cpp.

◆ get_current_view()

SharedLockedReference< View > derecho::ViewManager::get_current_view ( )
Returns
a reference to the current View, wrapped in a container that holds a read-lock on it. This is mostly here to make it easier for the Group that contains this ViewManager to set things up.

Definition at line 2092 of file view_manager.cpp.

◆ get_current_view_const()

SharedLockedReference< const View > derecho::ViewManager::get_current_view_const ( )

This function is a dirty workaround for the fact that Group might need read-only access to curr_view during a total restart when curr_view is owned by restart_leader_state, but it's only available by const reference and SharedLockedReference<View> wants a mutable reference.

Returns

Definition at line 2097 of file view_manager.cpp.

◆ get_max_payload_sizes()

std::map< subgroup_id_t, uint64_t > derecho::ViewManager::get_max_payload_sizes ( )

Definition at line 1641 of file view_manager.cpp.

◆ get_members()

std::vector< node_id_t > derecho::ViewManager::get_members ( )

Returns a vector listing the nodes that are currently members of the group.

Definition at line 2050 of file view_manager.cpp.

◆ get_my_rank()

int32_t derecho::ViewManager::get_my_rank ( )

Returns the order of this node in the sequence of members of the group.

Definition at line 2055 of file view_manager.cpp.

◆ get_my_shard()

int32_t derecho::ViewManager::get_my_shard ( subgroup_type_id_t  subgroup_type,
uint32_t  subgroup_index 
)

If this node is a member of the given subgroup (identified by its type and index), returns the number of the shard this node belongs to.

Otherwise, returns -1.

Definition at line 2076 of file view_manager.cpp.

◆ get_number_of_shards_in_subgroup()

std::size_t derecho::ViewManager::get_number_of_shards_in_subgroup ( subgroup_type_id_t  subgroup_type,
uint32_t  subgroup_index 
)

Definition at line 2070 of file view_manager.cpp.

◆ get_old_shard_leaders()

const vector_int64_2d& derecho::ViewManager::get_old_shard_leaders ( ) const
inline
Returns
The list of shard leaders in the previous view that this node received along with curr_view when it joined the group. Needed by Group to complete state transfer.

Definition at line 707 of file view_manager.hpp.

◆ get_subgroup_members()

std::vector< std::vector< node_id_t > > derecho::ViewManager::get_subgroup_members ( subgroup_type_id_t  subgroup_type,
uint32_t  subgroup_index 
)

Returns a vector of vectors listing the members of a single subgroup (identified by type and index), organized by shard number.

Definition at line 2060 of file view_manager.cpp.

◆ has_pending_join()

bool derecho::ViewManager::has_pending_join ( )
inlineprivate

Definition at line 233 of file view_manager.hpp.

◆ initialize_multicast_groups()

void derecho::ViewManager::initialize_multicast_groups ( CallbackSet  callbacks)

Sets up RDMA sessions for the multicast groups within this group.

This should only be called once the initial view is committed by the leader.

Parameters
callbacksThe set of callback functions for message delivery events in this group.

Definition at line 296 of file view_manager.cpp.

◆ initialize_rdmc_sst()

void derecho::ViewManager::initialize_rdmc_sst ( )
private

Performs one-time global initialization of RDMC and SST, using the current view's membership.

Definition at line 595 of file view_manager.cpp.

◆ leader_commit_change()

void derecho::ViewManager::leader_commit_change ( DerechoSST gmsSST)
private

Runs only on the group leader and updates num_committed when all non-failed members have acked a proposed view change.

Definition at line 880 of file view_manager.cpp.

◆ leader_commit_initial_view()

void derecho::ViewManager::leader_commit_initial_view ( )

Setup method for the leader node: sends a commit message to all non-leader nodes indicating that it is safe to use the initial View.

Definition at line 584 of file view_manager.cpp.

◆ leader_prepare_initial_view()

bool derecho::ViewManager::leader_prepare_initial_view ( bool &  leader_has_quorum)

Setup method for the leader node in total restart mode: sends a Prepare message to all non-leader nodes indicating that state transfer has finished.

Also checks to see whether any non-leader nodes have failed in the meantime. This function simply does nothing if this node is not in total restart mode.

Parameters
leader_has_quorumA mutable reference to a bool that will be set to False if the leader realizes it no longer has a restart quorum due to failures.
Returns
True if all non-leader nodes are still alive, False if there was a failure.

Definition at line 569 of file view_manager.cpp.

◆ leader_ragged_edge_cleanup()

void derecho::ViewManager::leader_ragged_edge_cleanup ( const subgroup_id_t  subgroup_num,
const uint32_t  num_received_offset,
const std::vector< node_id_t > &  shard_members,
uint  num_shard_senders 
)
private

Implements the Ragged Edge Cleanup algorithm for a subgroup/shard leader, operating on the shard that this node is a member of.

This computes the last safely-deliverable message from each sender in the shard and places it in this node's SST row in the global_min field.

Parameters
subgroup_numThe subgroup ID of the subgroup to do cleanup on
num_received_offsetThe offset into the SST's num_received field that corresponds to the specified subgroup's entries in it
shard_membersThe IDs of the members of this node's shard in the specified subgroup
num_shard_sendersThe number of nodes in that shard that are active senders in the current epoch

Definition at line 1864 of file view_manager.cpp.

◆ leader_start_join()

void derecho::ViewManager::leader_start_join ( DerechoSST gmsSST)
private

Runs only on the group leader; proposes new views to include new members.

Definition at line 804 of file view_manager.cpp.

◆ leave()

void derecho::ViewManager::leave ( )

Causes this node to cleanly leave the group by setting itself to "failed.".

Definition at line 2019 of file view_manager.cpp.

◆ load_ragged_trim()

void derecho::ViewManager::load_ragged_trim ( )
private

Constructor helper that reads logged ragged trim information from disk, called only if there is also a logged view on disk from a previous failed group.

◆ log_ragged_trim()

void derecho::ViewManager::log_ragged_trim ( const int  shard_leader_rank,
const subgroup_id_t  subgroup_num,
const uint32_t  num_received_offset,
const uint  num_shard_senders 
)
private

Reads the global_min values for the specified subgroup (and the shard that this node belongs to) from the SST, creates a ragged trim vector with these values, and persists the ragged trim to disk.

Parameters
shard_leader_rankThe rank of the leader node in this node's shard of the specified subgroup
subgroup_numThe subgroup ID to compute the ragged trim for
num_received_offsetThe offset into the SST's num_received field that corresponds to the specified subgroup's entries in it
num_shard_sendersThe number of nodes in that shard that are active senders in the current epoch

Definition at line 1965 of file view_manager.cpp.

◆ make_member_ips_and_ports_map()

template<PORT_TYPE port_index>
static std::map<node_id_t, std::pair<ip_addr_t, uint16_t> > derecho::ViewManager::make_member_ips_and_ports_map ( const View view)
inlinestaticprivate

Constructs a map from node ID -> IP address from the parallel vectors in the given View.

Definition at line 536 of file view_manager.hpp.

◆ make_next_view()

std::unique_ptr< View > derecho::ViewManager::make_next_view ( const std::unique_ptr< View > &  curr_view,
const DerechoSST gmsSST 
)
staticprivate

Constructs the next view from the current view and the set of committed changes in the SST.

Parameters
curr_viewThe current view, which the proposed changes are relative to
gmsSSTThe SST containing the proposed/committed changes
loggerA logger for printing out debug information
Returns
A View object for the next view

Definition at line 1645 of file view_manager.cpp.

◆ make_subgroup_maps()

void derecho::ViewManager::make_subgroup_maps ( const SubgroupInfo subgroup_info,
const std::unique_ptr< View > &  prev_view,
View curr_view 
)
staticprivate

Initializes curr_view with subgroup information based on the membership functions in subgroup_info.

If curr_view would be inadequate based on the subgroup allocation functions, it will be marked as inadequate.

Parameters
subgroup_infoThe SubgroupInfo (containing subgroup membership functions) to use to provision subgroups
prev_viewThe previous View, which may be null if the current view is the first one
curr_viewA mutable reference to the current View, which will have its SubViews initialized

Definition at line 1531 of file view_manager.cpp.

◆ min_acked()

int derecho::ViewManager::min_acked ( const DerechoSST gmsSST,
const std::vector< char > &  failed 
)
staticprivate

Definition at line 1791 of file view_manager.cpp.

◆ new_leader_takeover()

void derecho::ViewManager::new_leader_takeover ( DerechoSST gmsSST)
private

Runs once on a node that becomes a leader due to a failure.

Searches for and re-proposes changes proposed by prior leaders, as well as suspicions noticed by this node before it became the leader.

Definition at line 847 of file view_manager.cpp.

◆ new_suspicion()

void derecho::ViewManager::new_suspicion ( DerechoSST gmsSST)
private

Called when there is a new failure suspicion.

Updates the suspected[] array and, for the leader, proposes new views to exclude failed members.

Definition at line 710 of file view_manager.cpp.

◆ old_shard_leaders_by_new_ids()

vector_int64_2d derecho::ViewManager::old_shard_leaders_by_new_ids ( const View curr_view,
const View next_view 
)
staticprivate

Constructs a vector mapping subgroup ID in the new view -> shard number -> node ID of that shard's leader in the old view.

If a shard had no leader in the old view, or is a RawObject shard (which does not do state transfer), the "node ID" for that shard will be -1.

Definition at line 1732 of file view_manager.cpp.

◆ previous_leaders_suspected()

bool derecho::ViewManager::previous_leaders_suspected ( const DerechoSST gmsSST,
const View curr_view 
)
staticprivate

Definition at line 1805 of file view_manager.cpp.

◆ receive_initial_view()

void derecho::ViewManager::receive_initial_view ( node_id_t  my_id,
tcp::socket leader_connection 
)
private

Helper for joining an existing group; receives the View and parameters from the leader.

Definition at line 131 of file view_manager.cpp.

◆ receive_join()

bool derecho::ViewManager::receive_join ( DerechoSST gmsSST,
tcp::socket client_socket 
)
private

Assuming this node is the leader, handles a join request from a client.

Returns
True if the join succeeded, false if it failed because the client's ID was already in use.

Definition at line 1393 of file view_manager.cpp.

◆ receive_vector2d()

template<typename ValueType >
static std::unique_ptr<std::vector<std::vector<ValueType> > > derecho::ViewManager::receive_vector2d ( tcp::socket socket)
inlinestaticprivate

A little convenience method that receives a 2-dimensional vector using our standard network protocol, which first sends the buffer size and then a serialized buffer.

Parameters
socketThe socket to read from
Returns
A 2-dimensional vector of ValueType
Template Parameters
ValueTypeThe type of values in the vector; this assumes ValueType can be serialized by mutils

Definition at line 566 of file view_manager.hpp.

◆ receive_view_and_leaders()

void derecho::ViewManager::receive_view_and_leaders ( const node_id_t  my_id,
tcp::socket leader_connection 
)
private

Constructor helper for non-leader nodes; encapsulates receiving and deserializing a View, DerechoParams, and state-transfer leaders (old shard leaders) from the leader.

Definition at line 207 of file view_manager.cpp.

◆ redirect_join_attempt()

void derecho::ViewManager::redirect_join_attempt ( DerechoSST gmsSST)
private

Runs on non-leaders to redirect confused new members to the current leader.

Definition at line 823 of file view_manager.cpp.

◆ register_initialize_objects_upcall()

void derecho::ViewManager::register_initialize_objects_upcall ( initialize_rpc_objects_t  upcall)
inline

Registers a function that will initialize all the RPC objects at this node, given a new view and a list of the shard leaders in the previous view (needed to download object state).

ViewManger will call it after it has installed a new view.

Definition at line 764 of file view_manager.hpp.

◆ register_predicates()

void derecho::ViewManager::register_predicates ( )
private

Constructor helper method to encapsulate creating all the predicates.

Definition at line 640 of file view_manager.cpp.

◆ reinit_tcp_connections()

void derecho::ViewManager::reinit_tcp_connections ( const View initial_view,
node_id_t  my_id 
)
private

Another setup helper for joining nodes; re-initializes the TCP connections list to reflect the current list of members in initial_view, assuming that the first view was aborted and a new one has been sent.

Parameters
initial_viewThe View whose membership the TCP connections should be updated to reflect

Definition at line 379 of file view_manager.cpp.

◆ report_failure()

void derecho::ViewManager::report_failure ( const node_id_t  who)

Reports to the GMS that the given node has failed.

Definition at line 1985 of file view_manager.cpp.

◆ send()

void derecho::ViewManager::send ( subgroup_id_t  subgroup_num,
long long unsigned int  payload_size,
const std::function< void(char *buf)> &  msg_generator,
bool  cooked_send = false 
)

Instructs the managed DerechoGroup's to send the next message.

This returns immediately in sending through RDMC; the send is scheduled to happen some time in the future. if sending through SST, the RDMA write is issued in this call

Definition at line 2032 of file view_manager.cpp.

◆ send_logs()

void derecho::ViewManager::send_logs ( )

An extra setup method only needed during total restart.

Sends Replicated Object data (most importantly, the persistent logs) to all members of a shard if this node is listed as that shard's leader. This function does nothing if this node is not in total restart mode.

Definition at line 343 of file view_manager.cpp.

◆ send_objects_to_new_members()

void derecho::ViewManager::send_objects_to_new_members ( const View new_view,
const vector_int64_2d old_shard_leaders 
)
private

Helper method for completing view changes; determines whether this node needs to send Replicated Object state to each node that just joined, and then sends the state if necessary.

Definition at line 1465 of file view_manager.cpp.

◆ send_subgroup_object()

void derecho::ViewManager::send_subgroup_object ( subgroup_id_t  subgroup_id,
node_id_t  new_node_id 
)
private

Sends a single subgroup's replicated object to a new member after a view change.

Definition at line 1488 of file view_manager.cpp.

◆ send_view()

void derecho::ViewManager::send_view ( const View new_view,
tcp::socket client_socket 
)
private

Sends a joining node the new view that has been constructed to include it.

Definition at line 1455 of file view_manager.cpp.

◆ setup_initial_tcp_connections()

void derecho::ViewManager::setup_initial_tcp_connections ( const View initial_view,
node_id_t  my_id 
)
private

Constructor helper that initializes TCP connections (for state transfer) to the members of initial_view in ascending rank order.

Assumes that no TCP connections have been set up yet.

Parameters
initial_viewThe View to use for membership

Definition at line 367 of file view_manager.cpp.

◆ silence()

void derecho::ViewManager::silence ( )

stop complaining about node failures.

Definition at line 2015 of file view_manager.cpp.

◆ start()

void derecho::ViewManager::start ( )

Starts predicate evaluation in the current view's SST.

Call this only when all other setup has been done for the Derecho group.

Definition at line 394 of file view_manager.cpp.

◆ start_meta_wedge()

void derecho::ViewManager::start_meta_wedge ( DerechoSST gmsSST)
private

Runs when at least one membership change has been committed by the leader, and wedges the current view in preparation for a new view.

Ends by awaiting the "meta-wedged" state and registers terminate_epoch() to trigger when meta-wedged is true.

Definition at line 930 of file view_manager.cpp.

◆ suspected_not_equal()

bool derecho::ViewManager::suspected_not_equal ( const DerechoSST gmsSST,
const std::vector< bool > &  old 
)
staticprivate

Definition at line 1761 of file view_manager.cpp.

◆ terminate_epoch()

void derecho::ViewManager::terminate_epoch ( DerechoSST gmsSST)
private

Runs when all live nodes have reported they have wedged the current view (meta-wedged), and starts ragged edge cleanup to finalize the terminated epoch.

Determines if the next view will be adequate, and only proceeds to start a view change if it will be.

Definition at line 961 of file view_manager.cpp.

◆ transition_multicast_group()

void derecho::ViewManager::transition_multicast_group ( const std::map< subgroup_id_t, SubgroupSettings > &  new_subgroup_settings,
const uint32_t  new_num_received_size,
const uint32_t  new_slot_size 
)
private

Sets up the SST and MulticastGroup for a new view, based on the settings in the current view, and copies over the SST data from the current view.

Parameters
new_subgroup_settingsThe subgroup settings map to supply to the MulticastGroup; this needs to change to account for the new subgroup/shard membership in the new view
new_num_received_sizeThe size of the num_recieved field in the new SST

Definition at line 1362 of file view_manager.cpp.

◆ truncate_logs()

void derecho::ViewManager::truncate_logs ( )

An extra setup step only needed during total restart; truncates the persistent logs of this node to conform to the ragged trim decided on by the restart leader.

This function does nothing if this node is not in total restart mode.

Definition at line 282 of file view_manager.cpp.

◆ truncate_persistent_logs()

void derecho::ViewManager::truncate_persistent_logs ( const ragged_trim_map_t logged_ragged_trim)
private

Helper function for total restart mode: Uses the RaggedTrim values in logged_ragged_trim to truncate any persistent logs that have a persisted version later than the last committed version in the RaggedTrim.

Definition at line 399 of file view_manager.cpp.

◆ update_tcp_connections()

void derecho::ViewManager::update_tcp_connections ( const View new_view)
private

Updates the TCP connections pool to reflect the joined and departed members in a new view.

Removes connections to departed members, and initializes new connections to joined members.

Parameters
new_viewThe new view that is about to be installed.

Definition at line 1502 of file view_manager.cpp.

Friends And Related Function Documentation

◆ ExternalCaller

template<typename T >
friend class ExternalCaller
friend

Definition at line 104 of file view_manager.hpp.

◆ PersistenceManager

friend class PersistenceManager
friend

Definition at line 106 of file view_manager.hpp.

◆ Replicated

template<typename T >
friend class Replicated
friend

Definition at line 102 of file view_manager.hpp.

◆ RestartLeaderState

friend class RestartLeaderState
friend

Definition at line 108 of file view_manager.hpp.

◆ rpc::RPCManager

friend class rpc::RPCManager
friend

Definition at line 100 of file view_manager.hpp.

Member Data Documentation

◆ active_leader

bool derecho::ViewManager::active_leader
private

True if this node is the current leader and is fully active (i.e.

has finished "waking up"), false otherwise.

Definition at line 211 of file view_manager.hpp.

◆ any_persistent_objects

const bool derecho::ViewManager::any_persistent_objects
private

True if any of the Replicated<T> objects in this group have a Persistent<T> field, false if none of them do.

Definition at line 191 of file view_manager.hpp.

◆ bSilent

std::atomic<bool> derecho::ViewManager::bSilent = false
private

On a graceful exit, nodes will be agree to leave at some point, where the view manager should stop throw exception on "failure".

Set 'bSilence' to keep the view manager calm on detecting intended node "failure."

Definition at line 231 of file view_manager.hpp.

◆ change_commit_ready_handle

pred_handle derecho::ViewManager::change_commit_ready_handle
private

Definition at line 156 of file view_manager.hpp.

◆ client_listener_thread

std::thread derecho::ViewManager::client_listener_thread
private

The background thread that listens for clients connecting on our server socket.

Definition at line 142 of file view_manager.hpp.

◆ curr_view

std::unique_ptr<View> derecho::ViewManager::curr_view
private

The current View, containing the state of the managed group.

Must be a pointer so we can re-assign it, but will never be null.

Definition at line 118 of file view_manager.hpp.

◆ disable_partitioning_safety

const bool derecho::ViewManager::disable_partitioning_safety
private

A user-configurable option that disables the checks for partitioning events.

It defaults to false, because disabling them is unsafe, but some users might want to do this for testing purposes.

Definition at line 150 of file view_manager.hpp.

◆ in_total_restart

bool derecho::ViewManager::in_total_restart
private

Set to true in the constructor if this node must do a total restart before completing group setup; false otherwise.

Definition at line 195 of file view_manager.hpp.

◆ initialize_subgroup_objects

initialize_rpc_objects_t derecho::ViewManager::initialize_subgroup_objects
private

A function that will be called to initialize replicated objects after transitioning to a new view.

This transfers control back to Group because the objects' constructors are only known by Group.

Definition at line 186 of file view_manager.hpp.

◆ last_suspected

std::vector<bool> derecho::ViewManager::last_suspected
private

A cached copy of the last known value of this node's suspected[] array.

Helps the SST predicate detect when there's been a change to suspected[].

Definition at line 135 of file view_manager.hpp.

◆ leader_committed_handle

pred_handle derecho::ViewManager::leader_committed_handle
private

Definition at line 158 of file view_manager.hpp.

◆ leader_proposed_handle

pred_handle derecho::ViewManager::leader_proposed_handle
private

Definition at line 157 of file view_manager.hpp.

◆ max_payload_sizes

std::map<subgroup_id_t, uint64_t> derecho::ViewManager::max_payload_sizes

Definition at line 776 of file view_manager.hpp.

◆ next_view

std::unique_ptr<View> derecho::ViewManager::next_view
private

May hold a pointer to the partially-constructed next view, if we are in the process of transitioning to a new view.

Definition at line 121 of file view_manager.hpp.

◆ old_view_cleanup_thread

std::thread derecho::ViewManager::old_view_cleanup_thread
private

Definition at line 143 of file view_manager.hpp.

◆ old_views

std::queue<std::unique_ptr<View> > derecho::ViewManager::old_views
private

Contains old Views that need to be cleaned up.

Definition at line 127 of file view_manager.hpp.

◆ old_views_cv

std::condition_variable derecho::ViewManager::old_views_cv
private

Definition at line 129 of file view_manager.hpp.

◆ old_views_mutex

std::mutex derecho::ViewManager::old_views_mutex
private

Definition at line 128 of file view_manager.hpp.

◆ pending_join_sockets

LockedQueue<tcp::socket> derecho::ViewManager::pending_join_sockets
private

On the leader node, contains client sockets for pending joins that have not yet been handled.

Definition at line 124 of file view_manager.hpp.

◆ persistence_manager_callbacks

persistence_manager_callbacks_t derecho::ViewManager::persistence_manager_callbacks
private

The persistence request func is from persistence manager.

Definition at line 214 of file view_manager.hpp.

◆ prior_view_shard_leaders

std::vector<std::vector<int64_t> > derecho::ViewManager::prior_view_shard_leaders
private

A 2-dimensional vector, indexed by (subgroup ID -> shard number), containing the ID of the node in each shard that was its leader in the prior view, or -1 if that shard had no state in the prior view.

Only used for state transfer during initial startup and total restart, may be empty otherwise.

Definition at line 223 of file view_manager.hpp.

◆ proposed_join_sockets

std::list<tcp::socket> derecho::ViewManager::proposed_join_sockets
private

The sockets connected to clients that will join in the next view, if any.

Definition at line 132 of file view_manager.hpp.

◆ reject_join_handle

pred_handle derecho::ViewManager::reject_join_handle
private

Definition at line 155 of file view_manager.hpp.

◆ restart_leader_state_machine

std::unique_ptr<RestartLeaderState> derecho::ViewManager::restart_leader_state_machine
private

If this node is the restart leader and currently doing a total restart, this object contains state related to the restart, including curr_view.

Otherwise this will be a null pointer.

Definition at line 200 of file view_manager.hpp.

◆ restart_state

std::unique_ptr<RestartState> derecho::ViewManager::restart_state
private

If this node is currently doing a total restart, this object contains state related to restarting, such as the current logged ragged trim.

Otherwise this will be a null pointer.

Definition at line 205 of file view_manager.hpp.

◆ server_socket

tcp::connection_listener derecho::ViewManager::server_socket
private

The TCP socket the leader uses to listen for joining clients.

Definition at line 138 of file view_manager.hpp.

◆ start_join_handle

pred_handle derecho::ViewManager::start_join_handle
private

Definition at line 154 of file view_manager.hpp.

◆ subgroup_info

const SubgroupInfo derecho::ViewManager::subgroup_info
private

The subgroup membership function, which will be called whenever the view changes.

Definition at line 164 of file view_manager.hpp.

◆ subgroup_objects

ReplicatedObjectReferenceMap& derecho::ViewManager::subgroup_objects
private

A type-erased list of references to the Replicated<T> objects in this group, indexed by their subgroup ID.

The actual objects live in the Group<ReplicatedTypes...> that owns this ViewManager, and the abstract ReplicatedObject interface only provides functions for the object state management tasks that ViewManager needs to do. This list also lives in the Group, where it is updated as replicated objects are added and destroyed, so ViewManager has only a reference to it.

Definition at line 182 of file view_manager.hpp.

◆ subgroup_type_order

std::vector<std::type_index> derecho::ViewManager::subgroup_type_order
private

Indicates the order that the subgroups should be provisioned; set by Group to be the same order as its template parameters.

Definition at line 167 of file view_manager.hpp.

◆ suspected_changed_handle

pred_handle derecho::ViewManager::suspected_changed_handle
private

Definition at line 153 of file view_manager.hpp.

◆ tcp_sockets

std::shared_ptr<tcp::tcp_connections> derecho::ViewManager::tcp_sockets
private

The same set of TCP sockets used by Group and RPCManager.

Definition at line 170 of file view_manager.hpp.

◆ thread_shutdown

std::atomic<bool> derecho::ViewManager::thread_shutdown
private

A flag to signal background threads to shut down; set to true when the group is destroyed.

Definition at line 140 of file view_manager.hpp.

◆ view_change_cv

std::condition_variable_any derecho::ViewManager::view_change_cv
private

Notified when curr_view changes (i.e.

we are finished with a pending view change).

Definition at line 114 of file view_manager.hpp.

◆ view_max_rpc_reply_payload_size

uint64_t derecho::ViewManager::view_max_rpc_reply_payload_size = 0

Definition at line 779 of file view_manager.hpp.

◆ view_max_rpc_window_size

uint32_t derecho::ViewManager::view_max_rpc_window_size = 0

Definition at line 780 of file view_manager.hpp.

◆ view_mutex

std::shared_timed_mutex derecho::ViewManager::view_mutex
private

Controls access to curr_view.

Read-only accesses should acquire a shared_lock, while view changes acquire a unique_lock.

Definition at line 112 of file view_manager.hpp.

◆ view_upcalls

std::vector<view_upcall_t> derecho::ViewManager::view_upcalls
private

Functions to be called whenever the view changes, to report the new view to some other component.

Definition at line 162 of file view_manager.hpp.


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