2018-06-05 10:41:32 +00:00
|
|
|
extern crate electrs;
|
|
|
|
extern crate error_chain;
|
|
|
|
|
|
|
|
use electrs::{config::Config,
|
|
|
|
daemon::Daemon,
|
|
|
|
errors::*,
|
|
|
|
index::Index,
|
2018-06-12 15:51:45 +00:00
|
|
|
metrics::Metrics,
|
2018-06-11 18:46:14 +00:00
|
|
|
signal::Waiter,
|
2018-06-05 10:41:32 +00:00
|
|
|
store::{ReadStore, Row, WriteStore},
|
|
|
|
util::Bytes};
|
2018-06-09 15:22:30 +00:00
|
|
|
use error_chain::ChainedError;
|
2018-06-05 10:41:32 +00:00
|
|
|
|
|
|
|
struct FakeStore;
|
|
|
|
|
|
|
|
impl ReadStore for FakeStore {
|
|
|
|
fn get(&self, _key: &[u8]) -> Option<Bytes> {
|
|
|
|
None
|
|
|
|
}
|
|
|
|
fn scan(&self, _prefix: &[u8]) -> Vec<Row> {
|
|
|
|
vec![]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl WriteStore for FakeStore {
|
|
|
|
fn write(&self, _rows: Vec<Row>) {}
|
2018-06-10 05:51:07 +00:00
|
|
|
fn flush(&self) {}
|
2018-06-05 10:41:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn run() -> Result<()> {
|
2018-06-12 15:51:45 +00:00
|
|
|
let signal = Waiter::new();
|
2018-06-05 10:41:32 +00:00
|
|
|
let config = Config::from_args();
|
2018-06-12 15:51:45 +00:00
|
|
|
let metrics = Metrics::new(config.monitoring_addr);
|
2018-06-05 10:41:32 +00:00
|
|
|
let daemon = Daemon::new(config.network_type)?;
|
|
|
|
let fake_store = FakeStore {};
|
2018-06-12 15:51:45 +00:00
|
|
|
let index = Index::load(&fake_store, &metrics);
|
|
|
|
index.update(&fake_store, &daemon, &signal)?;
|
2018-06-05 10:41:32 +00:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
if let Err(e) = run() {
|
2018-06-09 15:22:30 +00:00
|
|
|
eprintln!("{}", e.display_chain());
|
2018-06-05 10:41:32 +00:00
|
|
|
}
|
|
|
|
}
|