@@ -129,11 +129,12 @@ pub(crate) static BLOCKING_RT: Lazy<Runtime> = Lazy::new(|| {
129
129
type Result < T , E = Error > = std:: result:: Result < T , E > ;
130
130
type StatsSender = mpsc:: Sender < ( NamespaceName , MetaStoreHandle , Weak < Stats > ) > ;
131
131
type MakeReplicationSvc = Box <
132
- dyn FnOnce (
132
+ dyn Fn (
133
133
NamespaceStore ,
134
134
Option < Auth > ,
135
135
Option < IdleShutdownKicker > ,
136
136
bool ,
137
+ bool ,
137
138
) -> BoxReplicationService
138
139
+ Send
139
140
+ ' static ,
@@ -620,17 +621,18 @@ where
620
621
621
622
let replication_service = make_replication_svc (
622
623
namespace_store. clone ( ) ,
623
- None ,
624
+ Some ( user_auth_strategy . clone ( ) ) ,
624
625
idle_shutdown_kicker. clone ( ) ,
625
626
false ,
627
+ true ,
626
628
) ;
627
629
628
630
task_manager. spawn_until_shutdown ( run_rpc_server (
629
631
proxy_service,
630
632
config. acceptor ,
631
633
config. tls_config ,
632
634
idle_shutdown_kicker. clone ( ) ,
633
- replication_service,
635
+ replication_service, // internal replicaton service
634
636
) ) ;
635
637
}
636
638
@@ -658,12 +660,12 @@ where
658
660
. await ?;
659
661
}
660
662
661
- let replication_svc = ReplicationLogService :: new (
663
+ let replication_svc = make_replication_svc (
662
664
namespace_store. clone ( ) ,
663
- idle_shutdown_kicker. clone ( ) ,
664
665
Some ( user_auth_strategy. clone ( ) ) ,
665
- self . disable_namespaces ,
666
+ idle_shutdown_kicker . clone ( ) ,
666
667
true ,
668
+ false , // external replication service
667
669
) ;
668
670
669
671
let proxy_svc = ProxyService :: new (
@@ -936,9 +938,9 @@ where
936
938
let make_replication_svc = Box :: new ( {
937
939
let registry = registry. clone ( ) ;
938
940
let disable_namespaces = self . disable_namespaces ;
939
- move |store, user_auth, _, _| -> BoxReplicationService {
941
+ move |store, user_auth, _, _, _ | -> BoxReplicationService {
940
942
Box :: new ( LibsqlReplicationService :: new (
941
- registry,
943
+ registry. clone ( ) ,
942
944
store,
943
945
user_auth,
944
946
disable_namespaces,
@@ -1023,13 +1025,19 @@ where
1023
1025
1024
1026
let make_replication_svc = Box :: new ( {
1025
1027
let disable_namespaces = self . disable_namespaces ;
1026
- move |store, client_auth, idle_shutdown, collect_stats| -> BoxReplicationService {
1028
+ move |store,
1029
+ client_auth,
1030
+ idle_shutdown,
1031
+ collect_stats,
1032
+ is_internal|
1033
+ -> BoxReplicationService {
1027
1034
Box :: new ( ReplicationLogService :: new (
1028
1035
store,
1029
1036
idle_shutdown,
1030
1037
client_auth,
1031
1038
disable_namespaces,
1032
1039
collect_stats,
1040
+ is_internal,
1033
1041
) )
1034
1042
}
1035
1043
} ) ;
@@ -1055,13 +1063,19 @@ where
1055
1063
1056
1064
let make_replication_svc = Box :: new ( {
1057
1065
let disable_namespaces = self . disable_namespaces ;
1058
- move |store, client_auth, idle_shutdown, collect_stats| -> BoxReplicationService {
1066
+ move |store,
1067
+ client_auth,
1068
+ idle_shutdown,
1069
+ collect_stats,
1070
+ is_internal|
1071
+ -> BoxReplicationService {
1059
1072
Box :: new ( ReplicationLogService :: new (
1060
1073
store,
1061
1074
idle_shutdown,
1062
1075
client_auth,
1063
1076
disable_namespaces,
1064
1077
collect_stats,
1078
+ is_internal,
1065
1079
) )
1066
1080
}
1067
1081
} ) ;
0 commit comments