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 9f3d2c08b2
commit c2e5052877

View file

@ -58,6 +58,7 @@ use mentat_db::{
transact_terms,
PartitionMap,
TxObservationService,
TxObserver,
TxReport,
};
@ -813,6 +814,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)]