fedimint_client/sm/
dbtx.rsuse fedimint_core::core::ModuleInstanceId;
use fedimint_core::db::DatabaseTransaction;
pub struct ClientSMDatabaseTransaction<'inner, 'parent> {
dbtx: &'inner mut DatabaseTransaction<'parent>,
module_instance: ModuleInstanceId,
}
impl<'inner, 'parent> ClientSMDatabaseTransaction<'inner, 'parent> {
pub fn new(
dbtx: &'inner mut DatabaseTransaction<'parent>,
module_instance: ModuleInstanceId,
) -> Self {
Self {
dbtx,
module_instance,
}
}
pub fn module_tx(&mut self) -> DatabaseTransaction<'_> {
self.dbtx
.to_ref_with_prefix_module_id(self.module_instance)
.0
.into_nc()
}
#[allow(dead_code)]
pub(crate) fn global_tx(&mut self) -> &mut DatabaseTransaction<'parent> {
self.dbtx
}
pub(crate) fn module_id(&self) -> ModuleInstanceId {
self.module_instance
}
}