node_crunch 0.1.0

A crate for distributed computing
Documentation
//! This module contains the configuration for the server and the nodes.
//! Usually code for the server and the node is shared.

/// This data structure contains the configuration for the server and the node.
#[derive(Debug, Clone)]
pub struct NCConfiguration{
    /// IP address of the server, default: 127.0.0.1
    pub address: String,
    /// Port used by the server, default: 9000.
    pub port: u16,
    /// Nodes have to send a heartbeat every n seconds or they will be marked as offline.
    /// (The method [`heartbeat_timeout(node_id)`](crate::nc_server::NCServer::heartbeat_timeout)
    /// with the corresponding node ID is called), default: 5.
    pub heartbeat: u64,
    /// Nodes will wait n seconds before contacting the server again to prevent a denial of service, default: 60.
    pub delay_request_data: u64,
    /// Number of times a node should try to contact the server before givin up, default: 5.
    pub retry_counter: u64,
    /// The number of threads in the thread pool, default: 8.
    pub pool_size: u64,
}

impl Default for NCConfiguration {
    fn default() -> Self {
        NCConfiguration {
            address: "127.0.0.1".to_string(),
            port: 9000,
            heartbeat: 60,
            delay_request_data: 60,
            retry_counter: 5,
            pool_size: 8
        }
    }
}