@@ -266,7 +266,47 @@ pub struct NodeConfig {
266
266
default = "default_grpc_api_config" ,
267
267
skip_serializing_if = "Option::is_none"
268
268
) ]
269
- pub grpc_api_config : Option < iota_grpc_api:: Config > ,
269
+ pub grpc_api_config : Option < GrpcApiConfig > ,
270
+ }
271
+
272
+ /// Configuration for the gRPC API service
273
+ #[ derive( Clone , Debug , serde:: Deserialize , serde:: Serialize ) ]
274
+ #[ serde( rename_all = "kebab-case" ) ]
275
+ pub struct GrpcApiConfig {
276
+ /// The address to bind the gRPC server to
277
+ #[ serde( default = "default_grpc_api_address" ) ]
278
+ pub address : std:: net:: SocketAddr ,
279
+
280
+ /// Buffer size for broadcast channels used for checkpoint streaming
281
+ #[ serde( default = "default_checkpoint_broadcast_buffer_size" ) ]
282
+ pub checkpoint_broadcast_buffer_size : usize ,
283
+
284
+ /// Buffer size for broadcast channels used for event streaming
285
+ #[ serde( default = "default_event_broadcast_buffer_size" ) ]
286
+ pub event_broadcast_buffer_size : usize ,
287
+ }
288
+
289
+ impl Default for GrpcApiConfig {
290
+ fn default ( ) -> Self {
291
+ Self {
292
+ address : default_grpc_api_address ( ) ,
293
+ checkpoint_broadcast_buffer_size : default_checkpoint_broadcast_buffer_size ( ) ,
294
+ event_broadcast_buffer_size : default_event_broadcast_buffer_size ( ) ,
295
+ }
296
+ }
297
+ }
298
+
299
+ fn default_grpc_api_address ( ) -> std:: net:: SocketAddr {
300
+ use std:: net:: { IpAddr , Ipv4Addr } ;
301
+ std:: net:: SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: new ( 0 , 0 , 0 , 0 ) ) , 50051 )
302
+ }
303
+
304
+ fn default_checkpoint_broadcast_buffer_size ( ) -> usize {
305
+ 100
306
+ }
307
+
308
+ fn default_event_broadcast_buffer_size ( ) -> usize {
309
+ 1000
270
310
}
271
311
272
312
#[ derive( Clone , Copy , Debug , Default , Deserialize , Serialize ) ]
@@ -576,7 +616,7 @@ pub fn default_json_rpc_address() -> SocketAddr {
576
616
SocketAddr :: new ( IpAddr :: V4 ( Ipv4Addr :: new ( 0 , 0 , 0 , 0 ) ) , 9000 )
577
617
}
578
618
579
- pub fn default_grpc_api_config ( ) -> Option < iota_grpc_api :: Config > {
619
+ pub fn default_grpc_api_config ( ) -> Option < GrpcApiConfig > {
580
620
None
581
621
}
582
622
0 commit comments