@@ -13,7 +13,9 @@ use pallas::{
1313 network:: miniprotocols:: { MAINNET_MAGIC , PREVIEW_MAGIC , PRE_PRODUCTION_MAGIC , TESTNET_MAGIC } ,
1414} ;
1515
16+ /// Default [`Follower`] block buffer size.
1617const DEFAULT_BLOCK_BUFFER_SIZE : usize = 32 ;
18+ /// Default [`Follower`] max await retries.
1719const DEFAULT_MAX_AWAIT_RETRIES : u32 = 3 ;
1820
1921/// Crate error type.
@@ -98,36 +100,42 @@ pub enum ChainUpdate {
98100 Rollback ( MultiEraBlockData ) ,
99101}
100102
101- /// Builder used to create [Config]s.
103+ /// Builder used to create [` Config` ]s.
102104#[ derive( Default ) ]
103105pub struct ConfigBuilder {
106+ /// Block buffer size option.
104107 block_buffer_size : Option < usize > ,
108+ /// Maximum await retries option.
105109 max_await_retries : Option < u32 > ,
106110}
107111
108112impl ConfigBuilder {
109- /// Sets the size of the block buffer used by the [Follower].
113+ /// Sets the size of the block buffer used by the [` Follower` ].
110114 ///
111115 /// # Arguments
112116 ///
113117 /// * `block_buffer_size`: Size of the block buffer.
118+ #[ must_use]
114119 pub fn with_block_buffer_size ( mut self , block_buffer_size : usize ) -> Self {
115120 self . block_buffer_size = Some ( block_buffer_size) ;
116121 self
117122 }
118123
119- /// Sets the maximum number of retries the [Follower] will execute when remote node sends
120- /// an AWAIT message when the [Follower] is already in the MUST_REPLY state.
124+ /// Sets the maximum number of retries the [`Follower`] will execute when remote node
125+ /// sends an AWAIT message when the [`Follower`] is already in the "must reply"
126+ /// state.
121127 ///
122128 /// # Argument
123129 ///
124130 /// * `max_await_retries`: Maxium number of retries.
131+ #[ must_use]
125132 pub fn with_max_await_retries ( mut self , max_await_retries : u32 ) -> Self {
126133 self . max_await_retries = Some ( max_await_retries) ;
127134 self
128135 }
129136
130- /// Builds a [Config].
137+ /// Builds a [`Config`].
138+ #[ must_use]
131139 pub fn build ( self ) -> Config {
132140 Config {
133141 block_buffer_size : self . block_buffer_size . unwrap_or ( DEFAULT_BLOCK_BUFFER_SIZE ) ,
@@ -138,7 +146,9 @@ impl ConfigBuilder {
138146
139147/// Configuration for the Cardano chain follower.
140148pub struct Config {
149+ /// Configured block buffer size.
141150 block_buffer_size : usize ,
151+ /// Configured maximum await retry count.
142152 max_await_retries : u32 ,
143153}
144154
@@ -152,7 +162,7 @@ impl Follower {
152162 ///
153163 /// * `address`: Address of the node to connect to.
154164 /// * `network`: The [Network] the client is assuming it's connecting to.
155- /// * `config`: Follower's configuration (see [ConfigBuilder]).
165+ /// * `config`: Follower's configuration (see [` ConfigBuilder` ]).
156166 ///
157167 /// # Errors
158168 ///
@@ -183,7 +193,8 @@ impl Follower {
183193 ///
184194 /// # Errors
185195 ///
186- /// Returns Err if the block range was not found or if some communication error ocurred.
196+ /// Returns Err if the block range was not found or if some communication error
197+ /// ocurred.
187198 pub async fn fetch_block_range (
188199 & mut self , _from : Point , _to : Point ,
189200 ) -> Result < Vec < MultiEraBlockData > > {
@@ -201,9 +212,7 @@ impl Follower {
201212 ///
202213 /// Returns Err if something went wrong while communicating with the producer.
203214 pub async fn set_read_pointer < P > ( & mut self , _at : P ) -> Result < Option < Point > >
204- where
205- P : Into < PointOrTip > ,
206- {
215+ where P : Into < PointOrTip > {
207216 todo ! ( )
208217 }
209218
0 commit comments