Skip to main content

load_worker_config

Function load_worker_config 

Source
pub 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: hostname,id

§Arguments

  • config_path - the path to the configuration file

§Returns

  • The worker ID for any new hostname, which is the maximum ID + 1 in the configuration file
  • A mapping of hostnames to worker IDs

§Panics

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