0.1.0-alpha2 |
|
---|---|
0.1.0-alpha1 |
|
#8 in #however
26KB
398 代码行
Artifice Installer - Artifice网络安装程序
描述
此crate作为artifice网络的安装程序,但也可以用作简单的任务调度器
依赖
[dependencies]
installer = "*"
manager = "*"
示例
use manager::{ArtificeDB, Database};
use installer::installation::*;
use std::time::Duration;
use manager::database::ArtificePeers;
use std::io::{Read, Write};
use networking::ArtificeConfig;
fn main(){
let database = ArtificeDB::create("/home/user/.artifice").unwrap();
let password = "hello_world".to_string();
let mut installer = Installer::new(InstallationSrc::NewCompiled, database, 4, Duration::from_secs(5000000));
let first_task = Task::<std::io::Error, ArtificeDB>::new(1, "create", move |database, schedule|{
let peers: ArtificePeers = database.create_table("peers".to_string(), &password.clone().into_bytes())?;
let config: ArtificeConfig = database.load_entry("config".to_string(), &password.clone().into_bytes())?;
Ok(())
});
installer.add_task(first_task);
installer.run();
}
依赖
~30–42MB
~763K SLoC