From 6501ce29560b6277dc596c7f77f618fbfeda6819 Mon Sep 17 00:00:00 2001 From: Roman Krasiuk Date: Thu, 2 Mar 2023 16:29:00 +0200 Subject: [PATCH] chore: expose methods and structs (#1607) --- bin/reth/src/cli.rs | 10 ++++++---- bin/reth/src/dirs.rs | 3 ++- crates/stages/src/stages/headers.rs | 11 +++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/bin/reth/src/cli.rs b/bin/reth/src/cli.rs index e984a0b93..9f6a5e463 100644 --- a/bin/reth/src/cli.rs +++ b/bin/reth/src/cli.rs @@ -88,9 +88,10 @@ struct Cli { verbosity: Verbosity, } +/// The log configuration. #[derive(Args)] #[command(next_help_heading = "Logging")] -struct Logs { +pub struct Logs { /// The path to put log files in. #[arg( long = "log.directory", @@ -112,7 +113,7 @@ struct Logs { impl Logs { /// Builds a tracing layer from the current log options. - fn layer(&self) -> (BoxedLayer, Option) + pub fn layer(&self) -> (BoxedLayer, Option) where S: Subscriber, for<'a> S: LookupSpan<'a>, @@ -129,9 +130,10 @@ impl Logs { } } +/// The verbosity settings for the cli. #[derive(Args)] #[command(next_help_heading = "Display")] -struct Verbosity { +pub struct Verbosity { /// Set the minimum log level. /// /// -v Errors @@ -150,7 +152,7 @@ struct Verbosity { impl Verbosity { /// Get the corresponding [Directive] for the given verbosity, or none if the verbosity /// corresponds to silent. - fn directive(&self) -> Directive { + pub fn directive(&self) -> Directive { if self.quiet { LevelFilter::OFF.into() } else { diff --git a/bin/reth/src/dirs.rs b/bin/reth/src/dirs.rs index b1a8aa575..c5ac09bbc 100644 --- a/bin/reth/src/dirs.rs +++ b/bin/reth/src/dirs.rs @@ -116,7 +116,8 @@ impl XdgPath for LogsDir { /// A small helper trait for unit structs that represent a standard path following the XDG /// path specification. -trait XdgPath { +pub trait XdgPath { + /// Resolve the standard path. fn resolve() -> Option; } diff --git a/crates/stages/src/stages/headers.rs b/crates/stages/src/stages/headers.rs index ef258ce2c..b65665213 100644 --- a/crates/stages/src/stages/headers.rs +++ b/crates/stages/src/stages/headers.rs @@ -236,9 +236,12 @@ where /// Represents a gap to sync: from `local_head` to `target` #[derive(Debug)] -struct SyncGap { - local_head: SealedHeader, - target: SyncTarget, +pub struct SyncGap { + /// The local head block. Represents lower bound of sync range. + pub local_head: SealedHeader, + + /// The sync target. Represents upper bound of sync range. + pub target: SyncTarget, } // === impl SyncGap === @@ -246,7 +249,7 @@ struct SyncGap { impl SyncGap { /// Returns `true` if the gap from the head to the target was closed #[inline] - fn is_closed(&self) -> bool { + pub fn is_closed(&self) -> bool { self.local_head.hash() == self.target.tip() } }