@@ -12,6 +12,7 @@ pub struct ClientOptions {
12
12
pub ( crate ) v_host : String ,
13
13
pub ( crate ) heartbeat : u32 ,
14
14
pub ( crate ) max_frame_size : u32 ,
15
+ pub ( crate ) load_balancer_mode : bool ,
15
16
pub ( crate ) tls : TlsConfiguration ,
16
17
pub ( crate ) collector : Arc < dyn MetricsCollector > ,
17
18
}
@@ -39,6 +40,7 @@ impl Default for ClientOptions {
39
40
v_host : "/" . to_owned ( ) ,
40
41
heartbeat : 60 ,
41
42
max_frame_size : 1048576 ,
43
+ load_balancer_mode : false ,
42
44
collector : Arc :: new ( NopMetricsCollector { } ) ,
43
45
tls : TlsConfiguration {
44
46
enabled : false ,
@@ -117,6 +119,11 @@ impl ClientOptionsBuilder {
117
119
self
118
120
}
119
121
122
+ pub fn load_balancer_mode ( mut self , load_balancer_mode : bool ) -> Self {
123
+ self . 0 . load_balancer_mode = load_balancer_mode;
124
+ self
125
+ }
126
+
120
127
pub fn build ( self ) -> ClientOptions {
121
128
self . 0
122
129
}
@@ -145,6 +152,7 @@ mod tests {
145
152
client_keys_path : String :: from ( "" ) ,
146
153
} )
147
154
. collector ( Arc :: new ( NopMetricsCollector { } ) )
155
+ . load_balancer_mode ( true )
148
156
. build ( ) ;
149
157
assert_eq ! ( options. host, "test" ) ;
150
158
assert_eq ! ( options. port, 8888 ) ;
@@ -154,5 +162,6 @@ mod tests {
154
162
assert_eq ! ( options. heartbeat, 10000 ) ;
155
163
assert_eq ! ( options. max_frame_size, 1 ) ;
156
164
assert_eq ! ( options. tls. enabled, true ) ;
165
+ assert_eq ! ( options. load_balancer_mode, true ) ;
157
166
}
158
167
}
0 commit comments