Use streaming socket interface within accountant

Pull messages from streamer process them and forward them to the sender.
This commit is contained in:
Anatoly Yakovenko
2018-03-10 22:09:17 -06:00
parent 67f4f4fb49
commit eb94613d7d
5 changed files with 117 additions and 38 deletions

View File

@@ -4,6 +4,7 @@ extern crate silk;
use silk::accountant_skel::AccountantSkel;
use silk::accountant::Accountant;
use std::io::{self, BufRead};
use std::sync::{Arc, Mutex};
fn main() {
let addr = "127.0.0.1:8000";
@@ -13,7 +14,8 @@ fn main() {
.lines()
.map(|line| serde_json::from_str(&line.unwrap()).unwrap());
let acc = Accountant::new_from_entries(entries, Some(1000));
let mut skel = AccountantSkel::new(acc);
let exit = Arc::new(Mutex::new(false));
let skel = Arc::new(Mutex::new(AccountantSkel::new(acc)));
eprintln!("Listening on {}", addr);
skel.serve(addr).unwrap();
let _threads = AccountantSkel::serve(skel, addr, exit.clone()).unwrap();
}