Switch Logger from Arc to Deref.
[rapid-gossip-sync-server] / src / snapshot.rs
index bbe94a93618037a227dac3cad4aab0c815658b78..05cc63e3222c4181944a571572efa45fab6df4da 100644 (file)
@@ -1,20 +1,22 @@
 use std::collections::HashMap;
 use std::fs;
+use std::ops::Deref;
 use std::os::unix::fs::symlink;
 use std::sync::Arc;
 use std::time::{Duration, SystemTime, UNIX_EPOCH};
 
 use lightning::routing::gossip::NetworkGraph;
+use lightning::util::logger::Logger;
 
-use crate::{config, TestLogger};
+use crate::config;
 use crate::config::cache_path;
 
-pub(crate) struct Snapshotter {
-       network_graph: Arc<NetworkGraph<TestLogger>>,
+pub(crate) struct Snapshotter<L: Deref> where L::Target: Logger {
+       network_graph: Arc<NetworkGraph<L>>,
 }
 
-impl Snapshotter {
-       pub fn new(network_graph: Arc<NetworkGraph<TestLogger>>) -> Self {
+impl<L: Deref> Snapshotter<L> where L::Target: Logger {
+       pub fn new(network_graph: Arc<NetworkGraph<L>>) -> Self {
                Self { network_graph }
        }
 
@@ -77,7 +79,7 @@ impl Snapshotter {
                                {
                                        println!("Calculating {}-day snapshot", day_range);
                                        // calculate the snapshot
-                                       let snapshot = super::serialize_delta(network_graph_clone, current_last_sync_timestamp.clone() as u32, true).await;
+                                       let snapshot = super::serialize_delta(network_graph_clone, current_last_sync_timestamp.clone() as u32).await;
 
                                        // persist the snapshot and update the symlink
                                        let snapshot_filename = format!("snapshot__calculated-at:{}__range:{}-days__previous-sync:{}.lngossip", reference_timestamp, day_range, current_last_sync_timestamp);