mithril_signer/
lib.rs
1#![warn(missing_docs)]
2mod commands;
10mod configuration;
11pub mod database;
12pub mod dependency_injection;
13pub mod entities;
14mod message_adapters;
15pub mod metrics;
16mod runtime;
17pub mod services;
18pub mod store;
19
20pub use commands::*;
21pub use configuration::{Configuration, DefaultConfiguration};
22pub use entities::SignerEpochSettings;
23pub use message_adapters::{FromEpochSettingsAdapter, ToRegisterSignerMessageAdapter};
24pub use metrics::*;
25pub use runtime::*;
26
27const HTTP_REQUEST_TIMEOUT_DURATION: u64 = 30000;
29
30const SQLITE_FILE: &str = "signer.sqlite3";
32const SQLITE_FILE_CARDANO_TRANSACTION: &str = "cardano-transaction.sqlite3";
33
34#[cfg(all(not(target_env = "msvc"), feature = "jemallocator"))]
36use tikv_jemallocator::Jemalloc;
37
38#[cfg(all(not(target_env = "msvc"), feature = "jemallocator"))]
39#[global_allocator]
40static GLOBAL: Jemalloc = Jemalloc;
41
42#[cfg(test)]
43pub(crate) mod test_tools {
44 use std::fs::File;
45 use std::io;
46 use std::sync::Arc;
47
48 use slog::{Drain, Logger};
49 use slog_async::Async;
50 use slog_term::{CompactFormat, PlainDecorator};
51
52 pub struct TestLogger;
53
54 impl TestLogger {
55 fn from_writer<W: io::Write + Send + 'static>(writer: W) -> Logger {
56 let decorator = PlainDecorator::new(writer);
57 let drain = CompactFormat::new(decorator).build().fuse();
58 let drain = Async::new(drain).build().fuse();
59 Logger::root(Arc::new(drain), slog::o!())
60 }
61
62 pub fn stdout() -> Logger {
63 Self::from_writer(slog_term::TestStdoutWriter)
64 }
65
66 pub fn file(filepath: &std::path::Path) -> Logger {
67 Self::from_writer(File::create(filepath).unwrap())
68 }
69 }
70}