Struct lightning_persister::FilesystemPersister
source · [−]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
sourceimpl FilesystemPersister
impl FilesystemPersister
sourcepub fn new(path_to_channel_data: String) -> Self
pub fn new(path_to_channel_data: String) -> Self
Initialize a new FilesystemPersister and set the path to the individual channels’ files.
sourcepub fn get_data_dir(&self) -> String
pub fn get_data_dir(&self) -> String
Get the directory which was provided when this persister was initialized.
sourcepub 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
Auto Trait Implementations
impl RefUnwindSafe for FilesystemPersister
impl Send for FilesystemPersister
impl Sync for FilesystemPersister
impl Unpin for FilesystemPersister
impl UnwindSafe for FilesystemPersister
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<ChannelSigner, K> Persist<ChannelSigner> for K where
ChannelSigner: Sign,
K: KVStorePersister,
impl<ChannelSigner, K> Persist<ChannelSigner> for K where
ChannelSigner: Sign,
K: KVStorePersister,
sourcefn persist_new_channel(
&self,
funding_txo: OutPoint,
monitor: &ChannelMonitor<ChannelSigner>,
_update_id: MonitorUpdateId
) -> Result<(), ChannelMonitorUpdateErr>
fn persist_new_channel(
&self,
funding_txo: OutPoint,
monitor: &ChannelMonitor<ChannelSigner>,
_update_id: MonitorUpdateId
) -> Result<(), ChannelMonitorUpdateErr>
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
sourcefn update_persisted_channel(
&self,
funding_txo: OutPoint,
_update: &Option<ChannelMonitorUpdate>,
monitor: &ChannelMonitor<ChannelSigner>,
_update_id: MonitorUpdateId
) -> Result<(), ChannelMonitorUpdateErr>
fn update_persisted_channel(
&self,
funding_txo: OutPoint,
_update: &Option<ChannelMonitorUpdate>,
monitor: &ChannelMonitor<ChannelSigner>,
_update_id: MonitorUpdateId
) -> Result<(), ChannelMonitorUpdateErr>
Update one channel’s data. The provided ChannelMonitor
has already applied the given
update. Read more