Function load_worker_config

Source
fn load_worker_config(
    config_path: &String,
) -> (Arc<Mutex<u32>>, Option<HashMap<String, u32>>)
Expand description

Load the worker configuration from a file. This provides a static mapping of hostnames to worker IDs. Formats the file as follows: ,

§Arguments

  • ‘config_path’ - the path to the configuration file

§Returns

Returns a tuple containing:

  • An Arc<Mutex> containing the worker ID for any new hostname, which is the maximum ID + 1 in the configuration file
  • An Option<HashMap<String, u32>> containing the mapping of hostnames to worker IDs

§Panics

Panics if the configuration file does not exist, or if there are malformed entries, duplicate hostnames, or duplicate IDs.