Allow registration and unregistration of transaction observers from Conn

This commit is contained in:
Emily Toop 2018-03-09 12:17:58 +00:00
parent cf510e758f
commit 77c91c71df

View file

@ -58,6 +58,7 @@ use mentat_db::{
transact_terms, transact_terms,
PartitionMap, PartitionMap,
TxObservationService, TxObservationService,
TxObserver,
TxReport, TxReport,
}; };
@ -806,6 +807,14 @@ impl Conn {
}, },
} }
} }
pub fn register_observer(&mut self, key: String, observer: Arc<TxObserver>) {
self.tx_observer_service.lock().unwrap().register(key, observer);
}
pub fn unregister_observer(&mut self, key: &String) {
self.tx_observer_service.lock().unwrap().deregister(key);
}
} }
#[cfg(test)] #[cfg(test)]