You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.0 KiB
43 lines
1.0 KiB
extern crate electrs;
|
|
extern crate error_chain;
|
|
|
|
use electrs::{
|
|
config::Config, daemon::Daemon, errors::*, index, metrics::Metrics, parse::Parser,
|
|
signal::Waiter, store::{ReadStore, Row, WriteStore}, util::Bytes,
|
|
};
|
|
use error_chain::ChainedError;
|
|
|
|
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>) {}
|
|
fn flush(&self) {}
|
|
}
|
|
|
|
fn run() -> Result<()> {
|
|
let signal = Waiter::new();
|
|
let config = Config::from_args();
|
|
let metrics = Metrics::new(config.monitoring_addr);
|
|
metrics.start();
|
|
|
|
let daemon = Daemon::new(config.network_type, &metrics)?;
|
|
let fake_store = FakeStore {};
|
|
let index = Index::load(&fake_store, &daemon, &metrics)?;
|
|
index.update(&fake_store, &signal)?;
|
|
Ok(())
|
|
}
|
|
|
|
fn main() {
|
|
if let Err(e) = run() {
|
|
eprintln!("{}", e.display_chain());
|
|
}
|
|
}
|
|
|