[][src]Crate manager

artifice manager is the crate that is responsible for managing the resources of artifice such as configs, peers list, permissions, and applications

Examples

Authenticate incoming user

use manager::{ArtificeDB, Manager};
use manager::database::Database;
use networking::peers::ArtificePeer;
use networking::ArtificeHost;
fn main(){
    let database = ArtificeDB::default();
    let manager = Manager::load(database, b"example_password").unwrap();
    let host = ArtificeHost::from_host_data(manager.config()).unwrap();
    for netstream in host {
        let stream = netstream.unwrap();
        if manager.authenticate(stream.peer()).unwrap() {
            println!("peer authenticated");
        }
    }
}

Connect to remote peer

use manager::{ArtificeDB, Manager};
use manager::database::Database;
use networking::peers::ArtificePeer;
use networking::ArtificeHost;

fn main(){
    let database = ArtificeDB::default();
    let manager = Manager::load(database, b"example_password").unwrap();
    let host = ArtificeHost::from_host_data(manager.config()).unwrap();
    let peer = manager.get_peer("global_peer_hash").unwrap();
    let host = ArtificeHost::from_host_data(manager.config()).unwrap();
    let stream = host.connect(peer).unwrap();
}

Re-exports

pub use database::*;
pub use crate::database::*;

Modules

archive

used to archive and compress configs

database

provides Table, and Database traits

permissions

permissions management implementation may transfer to seperate crate

users

will be used for users tracking when a secure implementation is created

Structs

ArtificeDB

this is the primary database containing information on the artifice installation it provides access to a list of applications, and there granted permissions as well as configuraiton for networking, and a table of peers to connect to

Manager

this is the main management structure that other structures work through

PermissionManager