Functor of type shard_view_generator_t that implements the default subgroup allocation algorithm, parameterized based on a policy for each subgroup type (i.e.
More...
#include <subgroup_functions.hpp>
|
std::map< std::type_index, std::vector< std::vector< uint32_t > > > | compute_standard_shard_sizes (const std::vector< std::type_index > &subgroup_type_order, const std::unique_ptr< View > &prev_view, const View &curr_view) const |
| Determines how many members each shard can have in the current view, based on each shard's policy (minimum and maximum number of nodes) and the size of the current view. More...
|
|
subgroup_shard_layout_t | allocate_standard_subgroup_type (const std::type_index subgroup_type, View &curr_view, const std::map< std::type_index, std::vector< std::vector< uint32_t >>> &shard_sizes) const |
| Creates and returns an initial membership allocation for a single subgroup type, based on the input map of shard sizes. More...
|
|
subgroup_shard_layout_t | update_standard_subgroup_type (const std::type_index subgroup_type, const subgroup_type_id_t subgroup_type_id, const std::unique_ptr< View > &prev_view, View &curr_view, const std::map< std::type_index, std::vector< std::vector< uint32_t >>> &shard_sizes) const |
| Creates and returns a new membership allocation for a single subgroup type, based on its previous allocation and its newly-assigned sizes. More...
|
|
void | compute_standard_memberships (const std::vector< std::type_index > &subgroup_type_order, const std::unique_ptr< View > &prev_view, View &curr_view, subgroup_allocation_map_t &subgroup_layouts) const |
| Helper function that implements the subgroup allocation algorithm for all "standard" (non-cross-product) subgroups. More...
|
|
void | compute_cross_product_memberships (const std::vector< std::type_index > &subgroup_type_order, const std::unique_ptr< View > &prev_view, View &curr_view, subgroup_allocation_map_t &subgroup_layouts) const |
| Helper function that implements the subgroup allocation algorithm for all cross-product subgroups. More...
|
|
Functor of type shard_view_generator_t that implements the default subgroup allocation algorithm, parameterized based on a policy for each subgroup type (i.e.
Replicated Object type). Its operator() will throw a subgroup_provisioning_exception if there are not enough nodes in the current view to populate all of the subgroups and shards.
Definition at line 250 of file subgroup_functions.hpp.
◆ DefaultSubgroupAllocator() [1/3]
◆ DefaultSubgroupAllocator() [2/3]
◆ DefaultSubgroupAllocator() [3/3]
◆ allocate_standard_subgroup_type()
subgroup_shard_layout_t derecho::DefaultSubgroupAllocator::allocate_standard_subgroup_type |
( |
const std::type_index |
subgroup_type, |
|
|
View & |
curr_view, |
|
|
const std::map< std::type_index, std::vector< std::vector< uint32_t >>> & |
shard_sizes |
|
) |
| const |
|
protected |
Creates and returns an initial membership allocation for a single subgroup type, based on the input map of shard sizes.
- Parameters
-
subgroup_type | The subgroup type to allocate members for |
curr_view | The current view, whose next_unassigned_rank will be updated |
shard_sizes | The map of membership sizes for every subgroup and shard |
- Returns
- A subgroup layout for this subgroup type
Definition at line 228 of file subgroup_functions.cpp.
◆ compute_cross_product_memberships()
void derecho::DefaultSubgroupAllocator::compute_cross_product_memberships |
( |
const std::vector< std::type_index > & |
subgroup_type_order, |
|
|
const std::unique_ptr< View > & |
prev_view, |
|
|
View & |
curr_view, |
|
|
subgroup_allocation_map_t & |
subgroup_layouts |
|
) |
| const |
|
protected |
Helper function that implements the subgroup allocation algorithm for all cross-product subgroups.
It must be run second so that it can refer to the allocations created for the "standard" subgroups. It creates entries for the cross-product subgroups in the out-parameter subgroup_layouts.
- Parameters
-
subgroup_type_order | The same subgroup type order passed in to the operator() function |
prev_view | The same previous view passed in to the operator() function |
curr_view | The same current view passed in to the operator() function |
subgroup_layouts | The map of subgroup types to subgroup layouts that operator() will end up returning; this function will fill in the entries for some of the types. |
Definition at line 314 of file subgroup_functions.cpp.
◆ compute_standard_memberships()
void derecho::DefaultSubgroupAllocator::compute_standard_memberships |
( |
const std::vector< std::type_index > & |
subgroup_type_order, |
|
|
const std::unique_ptr< View > & |
prev_view, |
|
|
View & |
curr_view, |
|
|
subgroup_allocation_map_t & |
subgroup_layouts |
|
) |
| const |
|
protected |
Helper function that implements the subgroup allocation algorithm for all "standard" (non-cross-product) subgroups.
It creates entries for those subgroups in the out-parameter subgroup_layouts.
- Parameters
-
subgroup_type_order | The same subgroup type order passed in to the operator() function |
prev_view | The same previous view passed in to the operator() function |
curr_view | The same current view passed in to the operator() function |
subgroup_layouts | The map of subgroup types to subgroup layouts that operator() will end up returning; this function will fill in the entries for some of the types. |
Definition at line 97 of file subgroup_functions.cpp.
◆ compute_standard_shard_sizes()
std::map< std::type_index, std::vector< std::vector< uint32_t > > > derecho::DefaultSubgroupAllocator::compute_standard_shard_sizes |
( |
const std::vector< std::type_index > & |
subgroup_type_order, |
|
|
const std::unique_ptr< View > & |
prev_view, |
|
|
const View & |
curr_view |
|
) |
| const |
|
protected |
Determines how many members each shard can have in the current view, based on each shard's policy (minimum and maximum number of nodes) and the size of the current view.
This function first assigns the minimum number of nodes to each shard, then evenly increments every shard's size by 1 (in order of subgroup_type_order and in order of shard number within each subgroup) until either all shards are at their maximum size or all of the View's members are accounted for. It throws a subgroup_provisioning_exception if the View doesn't have enough members for even the minimum-size allocation.
- Parameters
-
subgroup_type_order | The same subgroup type order passed in to the operator() function |
prev_view | The previous View, if there is one. This is used to ensure that every shard can keep the non-failed nodes it had in the previous View, even if the even-incrementing rule would assign it fewer nodes in this View. |
curr_view | The current View |
- Returns
- A map from subgroup type -> subgroup index -> shard number -> number of nodes in that shard
Definition at line 132 of file subgroup_functions.cpp.
◆ operator()()
subgroup_allocation_map_t derecho::DefaultSubgroupAllocator::operator() |
( |
const std::vector< std::type_index > & |
subgroup_type_order, |
|
|
const std::unique_ptr< View > & |
prev_view, |
|
|
View & |
curr_view |
|
) |
| const |
◆ update_standard_subgroup_type()
subgroup_shard_layout_t derecho::DefaultSubgroupAllocator::update_standard_subgroup_type |
( |
const std::type_index |
subgroup_type, |
|
|
const subgroup_type_id_t |
subgroup_type_id, |
|
|
const std::unique_ptr< View > & |
prev_view, |
|
|
View & |
curr_view, |
|
|
const std::map< std::type_index, std::vector< std::vector< uint32_t >>> & |
shard_sizes |
|
) |
| const |
|
protected |
Creates and returns a new membership allocation for a single subgroup type, based on its previous allocation and its newly-assigned sizes.
- Parameters
-
subgroup_type | The subgroup type to allocate members for |
subgroup_type_id | The numeric "type ID" for this subgroup type (its position in the subgroup_type_order list) |
prev_view | The previous View, now known to be non-null |
curr_view | The current View, whose next_unassigned_rank will be updated |
shard_sizes | The map of membership sizes for every subgroup and shard in curr_view |
- Returns
- A subgroup layout for this subgroup type.
Definition at line 266 of file subgroup_functions.cpp.
◆ policies
The documentation for this class was generated from the following files: