Beethoven.RoleAlloc.Lib (Beethoven v0.2.3)

Library module for RoleAlloc server.

Summary

Functions

Gets the maximum number of retries possible. Based on total roles to assign * number of nodes in the cluster via Node.list/0.

Makes fresh retries tuple. retries have 4 categories 0 -> Role retries 1 -> Total retries 2 -> Max Role retries (# of nodes via Node.list/0) 3 -> Max Total Retries (all roles * all hosts)

Takes input role map and provides a list of roles needed based on current roles hosted in the cluster.

Generates a new host queue based on how many roles the nodes have. Less roles == higher priority in the queue.

Takes the input role map and outputs a list of roles. Uses the instance value for each role to create n amount of roles in the list as needed,

Functions

get_max_retries(roles)

@spec get_max_retries(map()) :: integer()

Gets the maximum number of retries possible. Based on total roles to assign * number of nodes in the cluster via Node.list/0.

If result equals <4 output value will be 4.

get_new_retries(roles)

Makes fresh retries tuple. retries have 4 categories 0 -> Role retries 1 -> Total retries 2 -> Max Role retries (# of nodes via Node.list/0) 3 -> Max Total Retries (all roles * all hosts)

get_open_roles(roles)

@spec get_open_roles(map()) :: list()

Takes input role map and provides a list of roles needed based on current roles hosted in the cluster.

make_host_queue()

@spec make_host_queue() :: :queue.queue(node())

Generates a new host queue based on how many roles the nodes have. Less roles == higher priority in the queue.

role_map_to_list(roles)

@spec role_map_to_list(map()) :: list()

Takes the input role map and outputs a list of roles. Uses the instance value for each role to create n amount of roles in the list as needed,