pub struct FilesystemPersister { /* private fields */ }
Expand description

FilesystemPersister persists channel data on disk, where each channel’s data is stored in a file named after its funding outpoint.

Warning: this module does the best it can with calls to persist data, but it can only guarantee that the data is passed to the drive. It is up to the drive manufacturers to do the actual persistence properly, which they often don’t (especially on consumer-grade hardware). Therefore, it is up to the user to validate their entire storage stack, to ensure the writes are persistent. Corollary: especially when dealing with larger amounts of money, it is best practice to have multiple channel data backups and not rely only on one FilesystemPersister.

Implementations§

source§

impl FilesystemPersister

source

pub fn new(path_to_channel_data: String) -> Self

Initialize a new FilesystemPersister and set the path to the individual channels’ files.

source

pub fn get_data_dir(&self) -> String

Get the directory which was provided when this persister was initialized.

source

pub fn read_channelmonitors<ES: Deref, SP: Deref>( &self, entropy_source: ES, signer_provider: SP ) -> Result<Vec<(BlockHash, ChannelMonitor<<SP::Target as SignerProvider>::Signer>)>>where ES::Target: EntropySource + Sized, SP::Target: SignerProvider + Sized,

Read ChannelMonitors from disk.

Trait Implementations§

source§

impl KVStorePersister for FilesystemPersister

source§

fn persist<W: Writeable>(&self, key: &str, object: &W) -> Result<()>

Persist the given writeable using the provided key

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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<ChannelSigner, K> Persist<ChannelSigner> for Kwhere ChannelSigner: WriteableEcdsaChannelSigner, K: KVStorePersister,

source§

fn persist_new_channel( &self, funding_txo: OutPoint, monitor: &ChannelMonitor<ChannelSigner>, _update_id: MonitorUpdateId ) -> ChannelMonitorUpdateStatus

Persist a new channel’s data in response to a chain::Watch::watch_channel call. This is called by ChannelManager for new channels, or may be called directly, e.g. on startup. Read more
source§

fn update_persisted_channel( &self, funding_txo: OutPoint, _update: Option<&ChannelMonitorUpdate>, monitor: &ChannelMonitor<ChannelSigner>, _update_id: MonitorUpdateId ) -> ChannelMonitorUpdateStatus

Update one channel’s data. The provided ChannelMonitor has already applied the given update. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.