@@ -6,16 +6,14 @@ use msg_transport::Address;
66use thiserror:: Error ;
77use tokio:: sync:: oneshot;
88
9- use crate :: DEFAULT_BUFFER_SIZE ;
10-
119mod driver;
1210mod socket;
13- mod stats;
14- use crate :: { Profile , stats:: SocketStats } ;
1511pub use socket:: * ;
12+
13+ mod stats;
1614use stats:: RepStats ;
1715
18- const DEFAULT_MIN_COMPRESS_SIZE : usize = 8192 ;
16+ use crate :: { DEFAULT_BUFFER_SIZE , DEFAULT_QUEUE_SIZE , Profile , stats :: SocketStats } ;
1917
2018/// Errors that can occur when using a reply socket.
2119#[ derive( Debug , Error ) ]
@@ -47,23 +45,29 @@ impl RepError {
4745pub struct RepOptions {
4846 /// The maximum number of concurrent clients.
4947 pub ( crate ) max_clients : Option < usize > ,
48+ /// Minimum payload size in bytes for compression to be used.
49+ ///
50+ /// If the payload is smaller than this threshold, it will not be compressed.
5051 pub ( crate ) min_compress_size : usize ,
52+ /// The size of the write buffer in bytes.
5153 pub ( crate ) write_buffer_size : usize ,
54+ /// The maximum duration between flushes to the underlying transport
5255 pub ( crate ) write_buffer_linger : Option < Duration > ,
53- /// High-water mark for pending responses per peer. When this limit is reached,
54- /// new requests will not be read from the underlying connection until pending
55- /// responses are fulfilled.
56+ /// High-water mark for pending responses per peer.
57+ ///
58+ /// When this limit is reached, new requests will not be read from the underlying connection
59+ /// until pending responses are fulfilled.
5660 pub ( crate ) max_pending_responses : usize ,
5761}
5862
5963impl Default for RepOptions {
6064 fn default ( ) -> Self {
6165 Self {
6266 max_clients : None ,
63- min_compress_size : DEFAULT_MIN_COMPRESS_SIZE ,
64- write_buffer_size : 8192 ,
67+ min_compress_size : DEFAULT_BUFFER_SIZE ,
68+ write_buffer_size : DEFAULT_BUFFER_SIZE ,
6569 write_buffer_linger : Some ( Duration :: from_micros ( 100 ) ) ,
66- max_pending_responses : DEFAULT_BUFFER_SIZE ,
70+ max_pending_responses : DEFAULT_QUEUE_SIZE ,
6771 }
6872 }
6973}
@@ -115,6 +119,8 @@ impl RepOptions {
115119
116120 /// Sets the minimum payload size for compression.
117121 /// If the payload is smaller than this value, it will not be compressed.
122+ ///
123+ /// Default: [`DEFAULT_BUFFER_SIZE`]
118124 pub fn with_min_compress_size ( mut self , min_compress_size : usize ) -> Self {
119125 self . min_compress_size = min_compress_size;
120126 self
@@ -123,7 +129,7 @@ impl RepOptions {
123129 /// Sets the size (max capacity) of the write buffer in bytes. When the buffer is full, it will
124130 /// be flushed to the underlying transport.
125131 ///
126- /// Default: 8KiB
132+ /// Default: [`DEFAULT_BUFFER_SIZE`]
127133 pub fn with_write_buffer_size ( mut self , size : usize ) -> Self {
128134 self . write_buffer_size = size;
129135 self
@@ -142,7 +148,7 @@ impl RepOptions {
142148 /// new requests will not be read from the underlying connection until pending
143149 /// responses are fulfilled.
144150 ///
145- /// Default: [`DEFAULT_BUFFER_SIZE `]
151+ /// Default: [`DEFAULT_QUEUE_SIZE `]
146152 pub fn with_max_pending_responses ( mut self , hwm : usize ) -> Self {
147153 self . max_pending_responses = hwm;
148154 self
0 commit comments