Skip to content

Commit 2b83ad2

Browse files
committed
fixup! update docs on start and config objects
1 parent e2a626d commit 2b83ad2

File tree

1 file changed

+47
-42
lines changed
  • lightning-background-processor/src

1 file changed

+47
-42
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,7 @@ pub struct BackgroundProcessorConfigAsync<
10391039
sleeper: Sleeper,
10401040
mobile_interruptable_platform: bool,
10411041
fetch_time: FetchTime,
1042+
/// Phantom data to ensure proper lifetime and type parameter constraints.
10421043
_phantom: PhantomData<&'a ()>,
10431044
}
10441045

@@ -1110,6 +1111,7 @@ pub struct BackgroundProcessorConfigAsyncBuilder<
11101111
sleeper: Sleeper,
11111112
mobile_interruptable_platform: bool,
11121113
fetch_time: FetchTime,
1114+
/// Phantom data to ensure proper lifetime and type parameter constraints.
11131115
_phantom: PhantomData<&'a ()>,
11141116
}
11151117

@@ -1225,19 +1227,19 @@ impl<
12251227
self
12261228
}
12271229

1228-
/// Sets the optional liquidity manager component
1230+
/// Sets the optional liquidity manager component.
12291231
pub fn with_liquidity_manager(&mut self, liquidity_manager: LM) -> &mut Self {
12301232
self.liquidity_manager = Some(liquidity_manager);
12311233
self
12321234
}
12331235

1234-
/// Sets the optional sweeper component
1236+
/// Sets the optional sweeper component.
12351237
pub fn with_sweeper(&mut self, sweeper: OS) -> &mut Self {
12361238
self.sweeper = Some(sweeper);
12371239
self
12381240
}
12391241

1240-
/// Sets the optional scorer component,
1242+
/// Sets the optional scorer component.
12411243
pub fn with_scorer(&mut self, scorer: S) -> &mut Self {
12421244
self.scorer = Some(scorer);
12431245
self
@@ -1301,51 +1303,14 @@ impl BackgroundProcessor {
13011303
/// Start a background thread that takes care of responsibilities enumerated in the [top-level
13021304
/// documentation].
13031305
///
1304-
/// The thread runs indefinitely unless the object is dropped, [`stop`] is called, or
1306+
/// The thread runs indefinitely unless the object is dropped, [`Self::stop`] is called, or
13051307
/// [`Persister::persist_manager`] returns an error. In case of an error, the error is retrieved by calling
1306-
/// either [`join`] or [`stop`].
1308+
/// either [`Self::join`] or [`Self::stop`].
13071309
///
13081310
/// This method takes a [`BackgroundProcessorConfig`] object that contains all necessary components for
13091311
/// background processing. To build this configuration, you can use the [`BackgroundProcessorConfigBuilder`]
13101312
/// which provides a convenient builder pattern for setting up both required and optional components.
13111313
///
1312-
/// # Data Persistence
1313-
///
1314-
/// [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
1315-
/// uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
1316-
/// [`ChannelManager`]. See the `lightning-persister` crate for LDK's
1317-
/// provided implementation.
1318-
///
1319-
/// [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
1320-
/// [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
1321-
/// See the `lightning-persister` crate for LDK's provided implementation.
1322-
///
1323-
/// Typically, users should either implement [`Persister::persist_manager`] to never return an
1324-
/// error or call [`join`] and handle any error that may arise. For the latter case,
1325-
/// `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
1326-
///
1327-
/// # Event Handling
1328-
///
1329-
/// The `event_handler` in the configuration is responsible for handling events that users should be notified of (e.g.,
1330-
/// payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
1331-
/// functionality implemented by other handlers.
1332-
/// * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
1333-
///
1334-
/// # Rapid Gossip Sync
1335-
///
1336-
/// If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
1337-
/// to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
1338-
/// until the [`RapidGossipSync`] instance completes its first sync.
1339-
///
1340-
/// [top-level documentation]: BackgroundProcessor
1341-
/// [`join`]: Self::join
1342-
/// [`stop`]: Self::stop
1343-
/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
1344-
/// [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
1345-
/// [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
1346-
/// [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
1347-
/// [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
1348-
/// [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
13491314
pub fn start<
13501315
'a,
13511316
UL: 'static + Deref,
@@ -1566,6 +1531,44 @@ impl BackgroundProcessor {
15661531
///
15671532
/// The configuration can be constructed using [`BackgroundProcessorConfigBuilder`], which provides
15681533
/// a convenient builder pattern for setting up both required and optional components.
1534+
///
1535+
/// # Data Persistence
1536+
///
1537+
/// [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or
1538+
/// uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
1539+
/// [`ChannelManager`]. See the `lightning-persister` crate for LDK's
1540+
/// provided implementation.
1541+
///
1542+
/// [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if
1543+
/// [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`].
1544+
/// See the `lightning-persister` crate for LDK's provided implementation.
1545+
///
1546+
/// Typically, users should either implement [`Persister::persist_manager`] to never return an
1547+
/// error or call [`BackgroundProcessor::join`] and handle any error that may arise. For the latter case,
1548+
/// `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
1549+
///
1550+
/// # Event Handling
1551+
///
1552+
/// The `event_handler` in the configuration is responsible for handling events that users should be notified of (e.g.,
1553+
/// payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
1554+
/// functionality implemented by other handlers.
1555+
/// * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures.
1556+
///
1557+
/// # Rapid Gossip Sync
1558+
///
1559+
/// If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync`
1560+
/// to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance
1561+
/// until the [`RapidGossipSync`] instance completes its first sync.
1562+
///
1563+
/// [top-level documentation]: BackgroundProcessor
1564+
/// [`BackgroundProcessor::join`]: BackgroundProcessor::join
1565+
/// [`BackgroundProcessor::stop`]: BackgroundProcessor::stop
1566+
/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
1567+
/// [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
1568+
/// [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager
1569+
/// [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph
1570+
/// [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph
1571+
/// [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable
15691572
#[cfg(feature = "std")]
15701573
pub struct BackgroundProcessorConfig<
15711574
'a,
@@ -1623,6 +1626,7 @@ pub struct BackgroundProcessorConfig<
16231626
sweeper: Option<OS>,
16241627
logger: L,
16251628
scorer: Option<S>,
1629+
/// Phantom data to ensure proper lifetime and type parameter constraints.
16261630
_phantom: PhantomData<(&'a (), CF, T, F, P)>,
16271631
}
16281632

@@ -1688,6 +1692,7 @@ pub struct BackgroundProcessorConfigBuilder<
16881692
sweeper: Option<OS>,
16891693
logger: L,
16901694
scorer: Option<S>,
1695+
/// Phantom data to ensure proper lifetime and type parameter constraints.
16911696
_phantom: PhantomData<(&'a (), CF, T, F, P)>,
16921697
}
16931698

0 commit comments

Comments
 (0)