pub async fn bootstrap() -> Result<Self, Box<dyn Error>> {
        // Get the hostname of the host to register
        let hostname = gethostname::gethostname().into_string().unwrap();

        // Display the banner, just for fun :D
        Riklet::banner();

        // Load the configuration
        let config = Configuration::load()?;

        // Connect to the master node scheduler
        let mut client = WorkerClient::connect(config.master_ip.clone()).await?;
        log::debug!("gRPC WorkerClient connected.");

        // Register this node to the master
        let request = Request::new(WorkerRegistration {
            hostname: hostname.clone(),
        });
        let stream = client.register(request).await?.into_inner();

        log::trace!("Registration success");

        // Initialize the container runtime
        let container_runtime = Runc::new(config.runner.clone())?;
        // Initialize the image manager
        let image_manager = ImageManager::new(config.manager.clone())?;

        Ok(Self {
            hostname,
            container_runtime,
            image_manager,
            config,
            client,
            stream,
            workloads: HashMap::<String, Vec<Container>>::new(),
        })
    }
/// Bootstrap a Riklet in order to run properly.
Bootstrap a Riklet in order to run properly.
Bootstrap a Riklet in order to run properly .
pub async fn bootstrap() -> Result<Self, Box<dyn Error>> {
        // Get the hostname of the host to register
        let hostname = gethostname::gethostname().into_string().unwrap();
        // Display the banner, just for fun :D
        Riklet::banner();
        // Load the configuration
        let config = Configuration::load()?;
        // Connect to the master node scheduler
        let mut client = WorkerClient::connect(config.master_ip.clone()).await?;
        log::debug!("gRPC WorkerClient connected.");
        // Register this node to the master
        let request = Request::new(WorkerRegistration {
            hostname: hostname.clone(),
        });
        let stream = client.register(request).await?.into_inner();
        log::trace!("Registration success");
        // Initialize the container runtime
        let container_runtime = Runc::new(config.runner.clone())?;
        // Initialize the image manager
        let image_manager = ImageManager::new(config.manager.clone())?;
        Ok(Self {
            hostname,
            container_runtime,
            image_manager,
            config,
            client,
            stream,
            workloads: HashMap::<String, Vec<Container>>::new(),
        })
    }
pub async fn bootstrap ( ) -> Result < Self , Box < dyn Error > > { // Get the hostname of the host to register let hostname = gethostname :: gethostname ( ) . into_string ( ) . unwrap ( ) ; // Display the banner, just for fun :D Riklet :: banner ( ) ; // Load the configuration let config = Configuration :: load ( ) ? ; // Connect to the master node scheduler let mut client = WorkerClient :: connect ( config . master_ip . clone ( ) ) . await ? ; log :: debug ! ( " " ) ; // Register this node to the master let request = Request :: new ( WorkerRegistration { hostname : hostname . clone ( ) , } ) ; let stream = client . register ( request ) . await ? . into_inner ( ) ; log :: trace ! ( " " ) ; // Initialize the container runtime let container_runtime = Runc :: new ( config . runner . clone ( ) ) ? ; // Initialize the image manager let image_manager = ImageManager :: new ( config . manager . clone ( ) ) ? ; Ok ( Self { hostname , container_runtime , image_manager , config , client , stream , workloads : HashMap :: < String , Vec < Container > > :: new ( ) , } ) }
Bootstrap a Riklet in order to run properly.
Bootstrap a Riklet in order to run properly .