Struct MonitorUpdatingPersisterAsync

Source
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>

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<K, S, L, ES, SP, BI, FE> Freeze for MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>
where <SP as Deref>::Target: Sized, <ES as Deref>::Target: Sized,

§

impl<K, S, L, ES, SP, BI, FE> RefUnwindSafe for MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>

§

impl<K, S, L, ES, SP, BI, FE> Send for MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>
where <SP as Deref>::Target: Sized, <ES as Deref>::Target: Sized, K: Sync + Send, L: Sync + Send, ES: Sync + Send, SP: Sync + Send, BI: Sync + Send, FE: Sync + Send,

§

impl<K, S, L, ES, SP, BI, FE> Sync for MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>
where <SP as Deref>::Target: Sized, <ES as Deref>::Target: Sized, K: Sync + Send, L: Sync + Send, ES: Sync + Send, SP: Sync + Send, BI: Sync + Send, FE: Sync + Send,

§

impl<K, S, L, ES, SP, BI, FE> Unpin for MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>
where <SP as Deref>::Target: Sized, <ES as Deref>::Target: Sized,

§

impl<K, S, L, ES, SP, BI, FE> UnwindSafe for MonitorUpdatingPersisterAsync<K, S, L, ES, SP, BI, FE>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V