use xenith_core::{ChainId, StateKey};
pub struct SubscriptionHandle {
pub key: StateKey,
pub source_chain: ChainId,
abort_handle: tokio::task::AbortHandle,
}
impl SubscriptionHandle {
pub(crate) fn new(
key: StateKey,
source_chain: ChainId,
abort_handle: tokio::task::AbortHandle,
) -> Self {
Self {
key,
source_chain,
abort_handle,
}
}
pub fn cancel(self) {
self.abort_handle.abort();
}
}