Skip to content

Commit 6c26a08

Browse files
committed
Improve Builder and Config docs
We somewhat improve the docs on `Builder` and `Config`. Namely, we expand the docs in a few areas and remove stale fields/docs. While we're at it, we also fix some typos. Co-Authored-By: HAL 9000 Signed-off-by: Elias Rohrer <dev@tnull.de>
1 parent 804f00f commit 6c26a08

File tree

3 files changed

+77
-10
lines changed

3 files changed

+77
-10
lines changed

src/builder.rs

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,41 @@ impl std::error::Error for BuildError {}
236236
/// the getgo.
237237
///
238238
/// ### Defaults
239-
/// - Wallet entropy is sourced from a `keys_seed` file located under [`Config::storage_dir_path`]
239+
/// - See [`Config`] for the default values of all configuration options.
240240
/// - Chain data is sourced from the Esplora endpoint `https://blockstream.info/api`
241241
/// - Gossip data is sourced via the peer-to-peer network
242+
/// - Logs are written to the filesystem (see [Logging] below)
243+
///
244+
/// ### Storage
245+
///
246+
/// Several `build` methods are available depending on the desired storage backend:
247+
/// - [`build`] uses an SQLite database (recommended default).
248+
/// - [`build_with_fs_store`] uses a filesystem-based store.
249+
/// - [`build_with_vss_store`] and variants use a [VSS] remote store (**experimental**).
250+
/// - [`build_with_store`] allows providing a custom [`KVStore`] implementation.
251+
///
252+
/// ### Logging
253+
///
254+
/// By default, logs are written to the filesystem via an internal file logger at
255+
/// [`DEFAULT_LOG_LEVEL`]. The log file path and level can be customized via
256+
/// [`set_filesystem_logger`].
257+
///
258+
/// Alternatively, logs can be written to the [`log`] facade via [`set_log_facade_logger`], or to
259+
/// a custom [`LogWriter`] via [`set_custom_logger`].
260+
///
261+
/// [`build`]: Self::build
262+
/// [`build_with_fs_store`]: Self::build_with_fs_store
263+
/// [`build_with_vss_store`]: Self::build_with_vss_store
264+
/// [`build_with_store`]: Self::build_with_store
265+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
266+
/// [`KVStore`]: lightning::util::persist::KVStore
267+
/// [`DEFAULT_LOG_LEVEL`]: crate::config::DEFAULT_LOG_LEVEL
268+
/// [`set_filesystem_logger`]: Self::set_filesystem_logger
269+
/// [`set_log_facade_logger`]: Self::set_log_facade_logger
270+
/// [`set_custom_logger`]: Self::set_custom_logger
271+
/// [`log`]: https://crates.io/crates/log
272+
/// [Logging]: #logging
273+
/// [Storage]: #storage
242274
#[derive(Debug)]
243275
pub struct NodeBuilder {
244276
config: Config,
@@ -472,6 +504,10 @@ impl NodeBuilder {
472504
/// If set, the `max_log_level` sets the maximum log level. Otherwise, the latter defaults to
473505
/// [`DEFAULT_LOG_LEVEL`].
474506
///
507+
/// **Note:** Log rotation and pruning are the responsibility of the user and are not handled
508+
/// internally. For example, UNIX system tooling such as `logrotate` and `cron` can be used to
509+
/// manage log file sizes and retention.
510+
///
475511
/// [`DEFAULT_LOG_FILENAME`]: crate::config::DEFAULT_LOG_FILENAME
476512
pub fn set_filesystem_logger(
477513
&mut self, log_file_path: Option<String>, max_log_level: Option<LogLevel>,
@@ -764,9 +800,41 @@ impl NodeBuilder {
764800
/// the getgo.
765801
///
766802
/// ### Defaults
767-
/// - Wallet entropy is sourced from a `keys_seed` file located under [`Config::storage_dir_path`]
803+
/// - See [`Config`] for the default values of all configuration options.
768804
/// - Chain data is sourced from the Esplora endpoint `https://blockstream.info/api`
769805
/// - Gossip data is sourced via the peer-to-peer network
806+
/// - Logs are written to the filesystem (see [Logging] below)
807+
///
808+
/// ### Storage
809+
///
810+
/// Several `build` methods are available depending on the desired storage backend:
811+
/// - [`build`] uses an SQLite database (recommended default).
812+
/// - [`build_with_fs_store`] uses a filesystem-based store.
813+
/// - [`build_with_vss_store`] and variants use a [VSS] remote store (**experimental**).
814+
/// - [`build_with_store`] allows providing a custom [`KVStore`] implementation.
815+
///
816+
/// ### Logging
817+
///
818+
/// By default, logs are written to the filesystem via an internal file logger at
819+
/// [`DEFAULT_LOG_LEVEL`]. The log file path and level can be customized via
820+
/// [`set_filesystem_logger`].
821+
///
822+
/// Alternatively, logs can be written to the [`log`] facade via [`set_log_facade_logger`], or to
823+
/// a custom [`LogWriter`] via [`set_custom_logger`].
824+
///
825+
/// [`build`]: Self::build
826+
/// [`build_with_fs_store`]: Self::build_with_fs_store
827+
/// [`build_with_vss_store`]: Self::build_with_vss_store
828+
/// [`build_with_store`]: Self::build_with_store
829+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
830+
/// [`KVStore`]: lightning::util::persist::KVStore
831+
/// [`DEFAULT_LOG_LEVEL`]: crate::config::DEFAULT_LOG_LEVEL
832+
/// [`set_filesystem_logger`]: Self::set_filesystem_logger
833+
/// [`set_log_facade_logger`]: Self::set_log_facade_logger
834+
/// [`set_custom_logger`]: Self::set_custom_logger
835+
/// [`log`]: https://crates.io/crates/log
836+
/// [Logging]: #logging
837+
/// [Storage]: #storage
770838
#[derive(Debug)]
771839
#[cfg(feature = "uniffi")]
772840
pub struct ArcedNodeBuilder {
@@ -937,6 +1005,10 @@ impl ArcedNodeBuilder {
9371005
/// If set, the `max_log_level` sets the maximum log level. Otherwise, the latter defaults to
9381006
/// [`DEFAULT_LOG_LEVEL`].
9391007
///
1008+
/// **Note:** Log rotation and pruning are the responsibility of the user and are not handled
1009+
/// internally. For example, UNIX system tooling such as `logrotate` and `cron` can be used to
1010+
/// manage log file sizes and retention.
1011+
///
9401012
/// [`DEFAULT_LOG_FILENAME`]: crate::config::DEFAULT_LOG_FILENAME
9411013
pub fn set_filesystem_logger(
9421014
&self, log_file_path: Option<String>, log_level: Option<LogLevel>,

src/config.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,12 @@ pub(crate) const LNURL_AUTH_TIMEOUT_SECS: u64 = 15;
119119
/// | Parameter | Value |
120120
/// |----------------------------------------|--------------------|
121121
/// | `storage_dir_path` | /tmp/ldk_node/ |
122-
/// | `log_dir_path` | None |
123122
/// | `network` | Bitcoin |
124123
/// | `listening_addresses` | None |
124+
/// | `announcement_addresses` | None |
125125
/// | `node_alias` | None |
126-
/// | `default_cltv_expiry_delta` | 144 |
127-
/// | `onchain_wallet_sync_interval_secs` | 80 |
128-
/// | `wallet_sync_interval_secs` | 30 |
129-
/// | `fee_rate_cache_update_interval_secs` | 600 |
130126
/// | `trusted_peers_0conf` | [] |
131127
/// | `probing_liquidity_limit_multiplier` | 3 |
132-
/// | `log_level` | Debug |
133128
/// | `anchor_channels_config` | Some(..) |
134129
/// | `route_parameters` | None |
135130
/// | `tor_config` | None |
@@ -273,7 +268,7 @@ pub struct AnchorChannelsConfig {
273268
/// [`AnchorChannelsConfig::trusted_peers_no_reserve`], we will always try to spend the Anchor
274269
/// outputs with *any* on-chain funds available, i.e., the total reserve value as well as any
275270
/// spendable funds available in the on-chain wallet. Therefore, this per-channel multiplier is
276-
/// really a emergency reserve that we maintain at all time to reduce reduce the risk of
271+
/// really an emergency reserve that we maintain at all time to reduce the risk of
277272
/// insufficient funds at time of a channel closure. To this end, we will refuse to open
278273
/// outbound or accept inbound channels if we don't have sufficient on-chain funds available to
279274
/// cover the additional reserve requirement.

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! A ready-to-go Lightning node library built using [LDK](https://lightningdevkit.org/) and
1212
//! [BDK](https://bitcoindevkit.org/).
1313
//!
14-
//! LDK Node is a non-custodial Lightning node in library form. Its central goal is to provide a
14+
//! LDK Node is a self-custodial Lightning node in library form. Its central goal is to provide a
1515
//! small, simple, and straightforward interface that enables users to easily set up and run a
1616
//! Lightning node with an integrated on-chain wallet. While minimalism is at its core, LDK Node
1717
//! aims to be sufficiently modular and configurable to be useful for a variety of use cases.

0 commit comments

Comments
 (0)