3333
3434use std:: sync:: atomic:: AtomicI32 ;
3535use std:: sync:: atomic:: AtomicI64 ;
36+ use std:: sync:: atomic:: AtomicU64 ;
3637use std:: sync:: Arc ;
3738
3839use rocketmq_remoting:: protocol:: body:: ha_runtime_info:: HARuntimeInfo ;
3940use rocketmq_rust:: ArcMut ;
4041use tracing:: error;
4142
43+ use crate :: ha:: general_ha_client:: GeneralHAClient ;
44+ use crate :: ha:: general_ha_connection:: GeneralHAConnection ;
45+ use crate :: ha:: group_transfer_service:: GroupTransferService ;
4246use crate :: ha:: ha_client:: HAClient ;
4347use crate :: ha:: ha_connection:: HAConnection ;
4448use crate :: ha:: ha_connection_state_notification_request:: HAConnectionStateNotificationRequest ;
49+ use crate :: ha:: ha_connection_state_notification_service:: HAConnectionStateNotificationService ;
4550use crate :: ha:: ha_service:: HAService ;
4651use crate :: ha:: wait_notify_object:: WaitNotifyObject ;
4752use crate :: log_file:: flush_manager_impl:: group_commit_request:: GroupCommitRequest ;
4853use crate :: message_store:: local_file_message_store:: LocalFileMessageStore ;
4954use crate :: store_error:: HAResult ;
5055
51- #[ derive( Default ) ]
52- pub struct DefaultHAService { }
56+ pub struct DefaultHAService {
57+ connection_count : Arc < AtomicU64 > ,
58+ connection_list : Vec < GeneralHAConnection > ,
59+ accept_socket_service : AcceptSocketService ,
60+ default_message_store : ArcMut < LocalFileMessageStore > ,
61+ wait_notify_object : Arc < WaitNotifyObject > ,
62+ push2_slave_max_offset : Arc < AtomicU64 > ,
63+ group_transfer_service : Option < GroupTransferService > ,
64+ ha_client : GeneralHAClient ,
65+ ha_connection_state_notification_service : HAConnectionStateNotificationService ,
66+ }
5367
5468impl DefaultHAService {
69+ pub fn new ( message_store : ArcMut < LocalFileMessageStore > ) -> Self {
70+ DefaultHAService {
71+ connection_count : Arc :: new ( AtomicU64 :: new ( 0 ) ) ,
72+ connection_list : Vec :: new ( ) ,
73+ accept_socket_service : AcceptSocketService ,
74+ default_message_store : message_store,
75+ wait_notify_object : Arc :: new ( WaitNotifyObject ) ,
76+ push2_slave_max_offset : Arc :: new ( AtomicU64 :: new ( 0 ) ) ,
77+ group_transfer_service : None ,
78+ ha_client : GeneralHAClient :: new ( ) ,
79+ ha_connection_state_notification_service : HAConnectionStateNotificationService ,
80+ }
81+ }
82+
5583 // Add any necessary fields here
5684 pub fn get_default_message_store ( & self ) -> & LocalFileMessageStore {
5785 unimplemented ! ( " get_default_message_store method is not implemented" ) ;
@@ -63,7 +91,7 @@ impl DefaultHAService {
6391 unimplemented ! ( " notify_transfer_some method is not implemented" ) ;
6492 }
6593
66- pub ( crate ) fn init ( & mut self , message_store : ArcMut < LocalFileMessageStore > ) -> HAResult < ( ) > {
94+ pub ( crate ) fn init ( & mut self ) -> HAResult < ( ) > {
6795 // Initialize the DefaultHAService with the provided message store.
6896 Ok ( ( ) )
6997 }
@@ -152,3 +180,5 @@ impl HAService for DefaultHAService {
152180 todo ! ( )
153181 }
154182}
183+
184+ struct AcceptSocketService ;
0 commit comments