Struct lightning_persister::FilesystemPersister [−][src]
pub struct FilesystemPersister { /* fields omitted */ }
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
Initialize a new FilesystemPersister and set the path to the individual channels’ files.
Get the directory which was provided when this persister was initialized.
pub fn persist_manager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>(
data_dir: String,
manager: &ChannelManager<Signer, M, T, K, F, L>
) -> Result<(), Error> where
M::Target: Watch<Signer>,
T::Target: BroadcasterInterface,
K::Target: KeysInterface<Signer = Signer>,
F::Target: FeeEstimator,
L::Target: Logger,
pub fn persist_manager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>(
data_dir: String,
manager: &ChannelManager<Signer, M, T, K, F, L>
) -> Result<(), Error> where
M::Target: Watch<Signer>,
T::Target: BroadcasterInterface,
K::Target: KeysInterface<Signer = Signer>,
F::Target: FeeEstimator,
L::Target: Logger,
Writes the provided ChannelManager
to the path provided at FilesystemPersister
initialization, within a file called “manager”.
pub fn read_channelmonitors<Signer: Sign, K: Deref>(
&self,
keys_manager: K
) -> Result<Vec<(BlockHash, ChannelMonitor<Signer>)>, Error> where
K::Target: KeysInterface<Signer = Signer> + Sized,
pub fn read_channelmonitors<Signer: Sign, K: Deref>(
&self,
keys_manager: K
) -> Result<Vec<(BlockHash, ChannelMonitor<Signer>)>, Error> where
K::Target: KeysInterface<Signer = Signer> + Sized,
Read ChannelMonitor
s from disk.
Trait Implementations
fn persist_new_channel(
&self,
funding_txo: OutPoint,
monitor: &ChannelMonitor<ChannelSigner>
) -> Result<(), ChannelMonitorUpdateErr>
fn persist_new_channel(
&self,
funding_txo: OutPoint,
monitor: &ChannelMonitor<ChannelSigner>
) -> Result<(), ChannelMonitorUpdateErr>
Persist a new channel’s data. The data can be stored any way you want, but
the identifier provided by Rust-Lightning is the channel’s outpoint (and
it is up to you to maintain a correct mapping between the outpoint and the
stored channel data). Note that you must persist every new monitor to
disk. See the Persist
trait documentation for more details. Read more
fn update_persisted_channel(
&self,
funding_txo: OutPoint,
_update: &ChannelMonitorUpdate,
monitor: &ChannelMonitor<ChannelSigner>
) -> Result<(), ChannelMonitorUpdateErr>
fn update_persisted_channel(
&self,
funding_txo: OutPoint,
_update: &ChannelMonitorUpdate,
monitor: &ChannelMonitor<ChannelSigner>
) -> Result<(), ChannelMonitorUpdateErr>
Update one channel’s data. The provided ChannelMonitor
has already
applied the given update. Read more