pub struct MonitorUpdatingPersisterAsync<K: Deref, S: FutureSpawner, L: Deref, ES: Deref, SP: Deref, BI: Deref, FE: Deref>(/* private fields */)
where
K::Target: KVStore,
L::Target: Logger,
ES::Target: EntropySource + Sized,
SP::Target: SignerProvider + Sized,
BI::Target: BroadcasterInterface,
FE::Target: FeeEstimator;Expand description
A variant of the MonitorUpdatingPersister which utilizes the async KVStore and offers
async versions of the public accessors.
Note that async monitor updating is considered beta, and bugs may be triggered by its use.
Unlike MonitorUpdatingPersister, this does not implement Persist, but is instead used
directly by the ChainMonitor via ChainMonitor::new_async_beta.
This is not exported to bindings users as async is only supported in Rust.
Implementations§
Source§impl<K: Deref, S: FutureSpawner, L: Deref, ES: Deref, SP: Deref, BI: Deref, FE: Deref> MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>where
K::Target: KVStore,
L::Target: Logger,
ES::Target: EntropySource + Sized,
SP::Target: SignerProvider + Sized,
BI::Target: BroadcasterInterface,
FE::Target: FeeEstimator,
impl<K: Deref, S: FutureSpawner, L: Deref, ES: Deref, SP: Deref, BI: Deref, FE: Deref> MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>where
K::Target: KVStore,
L::Target: Logger,
ES::Target: EntropySource + Sized,
SP::Target: SignerProvider + Sized,
BI::Target: BroadcasterInterface,
FE::Target: FeeEstimator,
Sourcepub fn new(
kv_store: K,
future_spawner: S,
logger: L,
maximum_pending_updates: u64,
entropy_source: ES,
signer_provider: SP,
broadcaster: BI,
fee_estimator: FE,
) -> Self
pub fn new( kv_store: K, future_spawner: S, logger: L, maximum_pending_updates: u64, entropy_source: ES, signer_provider: SP, broadcaster: BI, fee_estimator: FE, ) -> Self
Constructs a new MonitorUpdatingPersisterAsync.
See MonitorUpdatingPersister::new for more info.
Sourcepub async fn read_all_channel_monitors_with_updates(
&self,
) -> Result<Vec<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>)>, Error>
pub async fn read_all_channel_monitors_with_updates( &self, ) -> Result<Vec<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>)>, Error>
Reads all stored channel monitors, along with any stored updates for them.
It is extremely important that your KVStore::read implementation uses the
io::ErrorKind::NotFound variant correctly. For more information, please see the
documentation for MonitorUpdatingPersister.
Sourcepub async fn read_channel_monitor_with_updates(
&self,
monitor_key: &str,
) -> Result<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>), Error>
pub async fn read_channel_monitor_with_updates( &self, monitor_key: &str, ) -> Result<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::EcdsaSigner>), Error>
Read a single channel monitor, along with any stored updates for it.
It is extremely important that your KVStoreSync::read implementation uses the
io::ErrorKind::NotFound variant correctly. For more information, please see the
documentation for MonitorUpdatingPersister.
For monitor_key, channel storage keys can be the channel’s funding OutPoint, with an
underscore _ between txid and index for v1 channels. For example, given:
- Transaction ID:
deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef - Index:
1
The correct monitor_key would be:
deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1
For v2 channels, the hex-encoded ChannelId is used directly for monitor_key instead.
Loading a large number of monitors will be faster if done in parallel. You can use this function to accomplish this. Take care to limit the number of parallel readers.
Sourcepub async fn cleanup_stale_updates(&self, lazy: bool) -> Result<(), Error>
pub async fn cleanup_stale_updates(&self, lazy: bool) -> Result<(), Error>
Cleans up stale updates for all monitors.
This function works by first listing all monitors, and then for each of them, listing all
updates. The updates that have an update_id less than or equal to than the stored monitor
are deleted. The deletion can either be lazy or non-lazy based on the lazy flag; this will
be passed to KVStoreSync::remove.