Skip to content

Commit fba204b

Browse files
authored
Merge pull request #848 from TheBlueMatt/2021-03-doc-cleanups
Clean up doc links and enforce them in CI
2 parents 32f6205 + e447131 commit fba204b

File tree

19 files changed

+95
-110
lines changed

19 files changed

+95
-110
lines changed

background-processor/src/lib.rs

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//! Utilities that take care of tasks that (1) need to happen periodically to keep Rust-Lightning
2+
//! running properly, and (2) either can or should be run in the background. See docs for
3+
//! [`BackgroundProcessor`] for more details on the nitty-gritty.
4+
5+
#![deny(broken_intra_doc_links)]
6+
#![deny(missing_docs)]
7+
#![deny(unsafe_code)]
8+
19
#[macro_use] extern crate lightning;
210

311
use lightning::chain;
@@ -40,18 +48,21 @@ impl BackgroundProcessor {
4048
/// Start a background thread that takes care of responsibilities enumerated in the top-level
4149
/// documentation.
4250
///
43-
/// If `persist_manager` returns an error, then this thread will return said error (and `start()`
44-
/// will need to be called again to restart the `BackgroundProcessor`). Users should wait on
45-
/// [`thread_handle`]'s `join()` method to be able to tell if and when an error is returned, or
46-
/// implement `persist_manager` such that an error is never returned to the `BackgroundProcessor`
51+
/// If `persist_manager` returns an error, then this thread will return said error (and
52+
/// `start()` will need to be called again to restart the `BackgroundProcessor`). Users should
53+
/// wait on [`thread_handle`]'s `join()` method to be able to tell if and when an error is
54+
/// returned, or implement `persist_manager` such that an error is never returned to the
55+
/// `BackgroundProcessor`
4756
///
48-
/// `persist_manager` is responsible for writing out the `ChannelManager` to disk, and/or uploading
49-
/// to one or more backup services. See [`ChannelManager::write`] for writing out a `ChannelManager`.
50-
/// See [`FilesystemPersister::persist_manager`] for Rust-Lightning's provided implementation.
57+
/// `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
58+
/// uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
59+
/// [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
60+
/// provided implementation.
5161
///
52-
/// [`thread_handle`]: struct.BackgroundProcessor.html#structfield.thread_handle
53-
/// [`ChannelManager::write`]: ../lightning/ln/channelmanager/struct.ChannelManager.html#method.write
54-
/// [`FilesystemPersister::persist_manager`]: ../lightning_persister/struct.FilesystemPersister.html#impl
62+
/// [`thread_handle`]: BackgroundProcessor::thread_handle
63+
/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
64+
/// [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
65+
/// [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
5566
pub fn start<PM, Signer, M, T, K, F, L>(persist_manager: PM, manager: Arc<ChannelManager<Signer, Arc<M>, Arc<T>, Arc<K>, Arc<F>, Arc<L>>>, logger: Arc<L>) -> Self
5667
where Signer: 'static + Sign,
5768
M: 'static + chain::Watch<Signer>,

ci/check-compiles.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ set -e
33
set -x
44
echo Testing $(git log -1 --oneline)
55
cargo check
6+
cargo doc
7+
cargo doc --document-private-items
68
cd fuzz && cargo check --features=stdin_fuzz

lightning-block-sync/src/http.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! Simple HTTP implementation which supports both async and traditional execution environments
2+
//! with minimal dependencies. This is used as the basis for REST and RPC clients.
3+
14
use chunked_transfer;
25
use serde_json;
36

lightning-block-sync/src/init.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! Utilities to assist in the initial sync required to initialize or reload Rust-Lightning objects
2+
//! from disk.
3+
14
use crate::{BlockSource, BlockSourceResult, Cache, ChainNotifier};
25
use crate::poll::{ChainPoller, Validate, ValidatedBlockHeader};
36

@@ -11,6 +14,8 @@ use lightning::chain;
1114
///
1215
/// Upon success, the returned header can be used to initialize [`SpvClient`]. Useful during a fresh
1316
/// start when there are no chain listeners to sync yet.
17+
///
18+
/// [`SpvClient`]: crate::SpvClient
1419
pub async fn validate_best_block_header<B: BlockSource>(block_source: &mut B) ->
1520
BlockSourceResult<ValidatedBlockHeader> {
1621
let (best_block_hash, best_block_height) = block_source.get_best_block().await?;
@@ -113,9 +118,9 @@ BlockSourceResult<ValidatedBlockHeader> {
113118
/// }
114119
/// ```
115120
///
116-
/// [`SpvClient`]: ../struct.SpvClient.html
117-
/// [`ChannelManager`]: ../../lightning/ln/channelmanager/struct.ChannelManager.html
118-
/// [`ChannelMonitor`]: ../../lightning/chain/channelmonitor/struct.ChannelMonitor.html
121+
/// [`SpvClient`]: crate::SpvClient
122+
/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
123+
/// [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
119124
pub async fn synchronize_listeners<B: BlockSource, C: Cache>(
120125
block_source: &mut B,
121126
network: Network,

lightning-block-sync/src/lib.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@
1212
//!
1313
//! Both features support either blocking I/O using `std::net::TcpStream` or, with feature `tokio`,
1414
//! non-blocking I/O using `tokio::net::TcpStream` from inside a Tokio runtime.
15-
//!
16-
//! [`SpvClient`]: struct.SpvClient.html
17-
//! [`BlockSource`]: trait.BlockSource.html
15+
16+
#![deny(broken_intra_doc_links)]
17+
#![deny(missing_docs)]
18+
#![deny(unsafe_code)]
1819

1920
#[cfg(any(feature = "rest-client", feature = "rpc-client"))]
2021
pub mod http;
@@ -69,8 +70,7 @@ pub trait BlockSource : Sync + Send {
6970
/// When polling a block source, [`Poll`] implementations may pass the height to [`get_header`]
7071
/// to allow for a more efficient lookup.
7172
///
72-
/// [`Poll`]: poll/trait.Poll.html
73-
/// [`get_header`]: #tymethod.get_header
73+
/// [`get_header`]: Self::get_header
7474
fn get_best_block<'a>(&'a mut self) -> AsyncBlockSourceResult<(BlockHash, Option<u32>)>;
7575
}
7676

@@ -176,8 +176,6 @@ where L::Target: chain::Listen {
176176
/// Implementations may define how long to retain headers such that it's unlikely they will ever be
177177
/// needed to disconnect a block. In cases where block sources provide access to headers on stale
178178
/// forks reliably, caches may be entirely unnecessary.
179-
///
180-
/// [`ChainNotifier`]: struct.ChainNotifier.html
181179
pub trait Cache {
182180
/// Retrieves the block header keyed by the given block hash.
183181
fn look_up(&self, block_hash: &BlockHash) -> Option<&ValidatedBlockHeader>;
@@ -218,7 +216,7 @@ impl<'a, P: Poll, C: Cache, L: Deref> SpvClient<'a, P, C, L> where L::Target: ch
218216
/// * `header_cache` is used to look up and store headers on the best chain
219217
/// * `chain_listener` is notified of any blocks connected or disconnected
220218
///
221-
/// [`poll_best_tip`]: struct.SpvClient.html#method.poll_best_tip
219+
/// [`poll_best_tip`]: SpvClient::poll_best_tip
222220
pub fn new(
223221
chain_tip: ValidatedBlockHeader,
224222
chain_poller: P,
@@ -273,7 +271,7 @@ impl<'a, P: Poll, C: Cache, L: Deref> SpvClient<'a, P, C, L> where L::Target: ch
273271

274272
/// Notifies [listeners] of blocks that have been connected or disconnected from the chain.
275273
///
276-
/// [listeners]: ../../lightning/chain/trait.Listen.html
274+
/// [listeners]: lightning::chain::Listen
277275
pub struct ChainNotifier<'a, C: Cache, L: Deref> where L::Target: chain::Listen {
278276
/// Cache for looking up headers before fetching from a block source.
279277
header_cache: &'a mut C,

lightning-block-sync/src/poll.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Adapters that make one or more [`BlockSource`]s simpler to poll for new chain tip transitions.
2+
13
use crate::{AsyncBlockSourceResult, BlockHeaderData, BlockSource, BlockSourceError, BlockSourceResult};
24

35
use bitcoin::blockdata::block::Block;

lightning-block-sync/src/rest.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! Simple REST client implementation which implements [`BlockSource`] against a Bitcoin Core REST
2+
//! endpoint.
3+
14
use crate::{BlockHeaderData, BlockSource, AsyncBlockSourceResult};
25
use crate::http::{BinaryResponse, HttpEndpoint, HttpClient, JsonResponse};
36

lightning-block-sync/src/rpc.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! Simple RPC client implementation which implements [`BlockSource`] against a Bitcoin Core RPC
2+
//! endpoint.
3+
14
use crate::{BlockHeaderData, BlockSource, AsyncBlockSourceResult};
25
use crate::http::{HttpClient, HttpEndpoint, JsonResponse};
36

lightning-net-tokio/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@
7272
//! }
7373
//! ```
7474
75+
#![deny(broken_intra_doc_links)]
76+
#![deny(missing_docs)]
77+
7578
use bitcoin::secp256k1::key::PublicKey;
7679

7780
use tokio::net::TcpStream;

lightning-persister/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
//! Utilities that handle persisting Rust-Lightning data to disk via standard filesystem APIs.
2+
3+
#![deny(broken_intra_doc_links)]
4+
#![deny(missing_docs)]
5+
16
mod util;
27

38
extern crate lightning;
@@ -72,6 +77,7 @@ impl FilesystemPersister {
7277
}
7378
}
7479

80+
/// Get the directory which was provided when this persister was initialized.
7581
pub fn get_data_dir(&self) -> String {
7682
self.path_to_channel_data.clone()
7783
}

0 commit comments

Comments
 (0)