extern crate ids_service;
extern crate simplelog;
use crate::ids_service::crypto_hash::*;
use crate::ids_service::common::*;
use crate::simplelog::*;
use log::*;
fn main() {
let _ = SimpleLogger::init(LevelFilter::Info, Config::default());
let mut ids = IdsService::new(10_000, Sha3Mode::Sha3_256,Some(num_cpus::get() as usize));
ids.start();
let _r=ids.filled_at_percent_event(10).recv().is_ok();
info!("Current numbers of items in cache: {}", ids.get_cache_len());
info!("Get an id: {}", ids.get_id().as_hex());
info!("Get another id: {}", ids.get_id().as_base64());
info!("Current numbers of items in cache: {}", ids.get_cache_len());
let mut ids2 = IdsService::default();
info!("Get an id: {}", ids2.get_id().as_hex());
let mut ids3 = IdsService::default();
ids3.start();
let _ = ids3.filled_event().recv().is_ok();
info!("1) Current numbers of items in cache ids3: {}", ids3.get_cache_len());
ids3.set_cache_size(150_000);
let _ = ids3.filled_event().recv().is_ok();
info!("2) Current numbers of items in cache ids3: {}", ids3.get_cache_len());
ids.stop();
ids2.stop();
ids3.stop();
}