1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! RillExport crate.

#![warn(missing_docs)]

mod actors;
mod config;

use actors::embedded_node::EmbeddedNode;
use anyhow::Error;
use std::path::PathBuf;

metacrate::meta!();

/// The standalone server that provides access to metrics in different ways.
#[derive(Debug)]
pub struct RillExport {
    _scoped_to_drop: meio::thread::ScopedRuntime,
}

impl RillExport {
    /// Starts an exporting server.
    pub fn start(config: Option<PathBuf>) -> Result<Self, Error> {
        let actor = EmbeddedNode::new(config);
        let scoped = meio::thread::spawn(actor)?;
        Ok(Self {
            _scoped_to_drop: scoped,
        })
    }
}