@@ -106,7 +106,7 @@ const MAX_TCP_MSG_BYTE_LEN: u16 = u16::MAX;
106
106
///
107
107
/// [module documentation]: crate::net::server::middleware::xfr
108
108
#[ derive( Clone , Debug ) ]
109
- pub struct XfrMiddlewareSvc < RequestOctets , NextSvc , XDP , Metadata = ( ) > {
109
+ pub struct XfrMiddlewareSvc < RequestOctets , NextSvc , RequestMeta , XDP > {
110
110
/// The upstream [`Service`] to pass requests to and receive responses
111
111
/// from.
112
112
next_svc : NextSvc ,
@@ -123,13 +123,13 @@ pub struct XfrMiddlewareSvc<RequestOctets, NextSvc, XDP, Metadata = ()> {
123
123
/// may run concurrently.
124
124
batcher_semaphore : Arc < Semaphore > ,
125
125
126
- _phantom : PhantomData < ( RequestOctets , Metadata ) > ,
126
+ _phantom : PhantomData < ( RequestOctets , RequestMeta ) > ,
127
127
}
128
128
129
- impl < RequestOctets , NextSvc , XDP , Metadata >
130
- XfrMiddlewareSvc < RequestOctets , NextSvc , XDP , Metadata >
129
+ impl < RequestOctets , NextSvc , RequestMeta , XDP >
130
+ XfrMiddlewareSvc < RequestOctets , NextSvc , RequestMeta , XDP >
131
131
where
132
- XDP : XfrDataProvider < Metadata > ,
132
+ XDP : XfrDataProvider < RequestMeta > ,
133
133
{
134
134
/// Creates a new instance of this middleware.
135
135
///
@@ -158,16 +158,16 @@ where
158
158
}
159
159
}
160
160
161
- impl < RequestOctets , NextSvc , XDP , Metadata >
162
- XfrMiddlewareSvc < RequestOctets , NextSvc , XDP , Metadata >
161
+ impl < RequestOctets , NextSvc , RequestMeta , XDP >
162
+ XfrMiddlewareSvc < RequestOctets , NextSvc , RequestMeta , XDP >
163
163
where
164
164
RequestOctets : Octets + Send + Sync + ' static + Unpin ,
165
165
for < ' a > <RequestOctets as octseq:: Octets >:: Range < ' a > : Send + Sync ,
166
166
NextSvc : Service < RequestOctets , ( ) > + Clone + Send + Sync + ' static ,
167
167
NextSvc :: Future : Send + Sync + Unpin ,
168
168
NextSvc :: Target : Composer + Default + Send + Sync ,
169
169
NextSvc :: Stream : Send + Sync ,
170
- XDP : XfrDataProvider < Metadata > ,
170
+ XDP : XfrDataProvider < RequestMeta > ,
171
171
XDP :: Diff : Debug + ' static ,
172
172
for < ' a > <XDP :: Diff as ZoneDiff >:: Stream < ' a > : Send ,
173
173
{
@@ -178,7 +178,7 @@ where
178
178
pub async fn preprocess (
179
179
zone_walking_semaphore : Arc < Semaphore > ,
180
180
batcher_semaphore : Arc < Semaphore > ,
181
- req : & Request < RequestOctets , Metadata > ,
181
+ req : & Request < RequestOctets , RequestMeta > ,
182
182
xfr_data_provider : XDP ,
183
183
) -> Result <
184
184
ControlFlow <
@@ -807,19 +807,19 @@ where
807
807
808
808
//--- impl Service
809
809
810
- impl < RequestOctets , NextSvc , XDP , Metadata > Service < RequestOctets , Metadata >
811
- for XfrMiddlewareSvc < RequestOctets , NextSvc , XDP , Metadata >
810
+ impl < RequestOctets , NextSvc , RequestMeta , XDP >
811
+ Service < RequestOctets , RequestMeta >
812
+ for XfrMiddlewareSvc < RequestOctets , NextSvc , RequestMeta , XDP >
812
813
where
813
814
RequestOctets : Octets + Send + Sync + Unpin + ' static ,
814
815
for < ' a > <RequestOctets as octseq:: Octets >:: Range < ' a > : Send + Sync ,
815
816
NextSvc : Service < RequestOctets , ( ) > + Clone + Send + Sync + ' static ,
816
817
NextSvc :: Future : Send + Sync + Unpin ,
817
818
NextSvc :: Target : Composer + Default + Send + Sync ,
818
819
NextSvc :: Stream : Send + Sync ,
819
- XDP : XfrDataProvider < Metadata > + Clone + Sync + Send + ' static ,
820
+ XDP : XfrDataProvider < RequestMeta > + Clone + Sync + Send + ' static ,
820
821
XDP :: Diff : Debug + Sync ,
821
- for < ' a > <XDP :: Diff as ZoneDiff >:: Stream < ' a > : Send ,
822
- Metadata : Clone + Default + Sync + Send + ' static ,
822
+ RequestMeta : Clone + Default + Sync + Send + ' static ,
823
823
{
824
824
type Target = NextSvc :: Target ;
825
825
type Stream = XfrMiddlewareStream <
@@ -831,7 +831,7 @@ where
831
831
832
832
fn call (
833
833
& self ,
834
- request : Request < RequestOctets , Metadata > ,
834
+ request : Request < RequestOctets , RequestMeta > ,
835
835
) -> Self :: Future {
836
836
let request = request. clone ( ) ;
837
837
let next_svc = self . next_svc . clone ( ) ;
@@ -902,8 +902,8 @@ pub enum XfrDataProviderError {
902
902
//------------ Transferable ---------------------------------------------------
903
903
904
904
/// A provider of data needed for responding to XFR requests.
905
- pub trait XfrDataProvider < Metadata = ( ) > {
906
- type Diff : ZoneDiff + Send ;
905
+ pub trait XfrDataProvider < RequestMeta = ( ) > {
906
+ type Diff : ZoneDiff + Send + Sync ;
907
907
908
908
/// Request data needed to respond to an XFR request.
909
909
///
@@ -918,7 +918,7 @@ pub trait XfrDataProvider<Metadata = ()> {
918
918
#[ allow( clippy:: type_complexity) ]
919
919
fn request < Octs > (
920
920
& self ,
921
- req : & Request < Octs , Metadata > ,
921
+ req : & Request < Octs , RequestMeta > ,
922
922
diff_from : Option < Serial > ,
923
923
) -> Pin <
924
924
Box <
@@ -938,16 +938,16 @@ pub trait XfrDataProvider<Metadata = ()> {
938
938
939
939
//--- impl XfrDataProvider for Deref<XfrDataProvider>
940
940
941
- impl < Metadata , T , U > XfrDataProvider < Metadata > for U
941
+ impl < RequestMeta , T , U > XfrDataProvider < RequestMeta > for U
942
942
where
943
- T : XfrDataProvider < Metadata > + ' static ,
943
+ T : XfrDataProvider < RequestMeta > + ' static ,
944
944
U : Deref < Target = T > ,
945
945
{
946
946
type Diff = T :: Diff ;
947
947
948
948
fn request < Octs > (
949
949
& self ,
950
- req : & Request < Octs , Metadata > ,
950
+ req : & Request < Octs , RequestMeta > ,
951
951
diff_from : Option < Serial > ,
952
952
) -> Pin <
953
953
Box <
@@ -970,7 +970,7 @@ where
970
970
971
971
//--- impl XfrDataProvider for Zone
972
972
973
- impl < Metadata > XfrDataProvider < Metadata > for Zone {
973
+ impl < RequestMeta > XfrDataProvider < RequestMeta > for Zone {
974
974
type Diff = EmptyZoneDiff ;
975
975
976
976
/// Request data needed to respond to an XFR request.
@@ -981,7 +981,7 @@ impl<Metadata> XfrDataProvider<Metadata> for Zone {
981
981
/// Returns Err if the requested zone is not this zone.
982
982
fn request < Octs > (
983
983
& self ,
984
- req : & Request < Octs , Metadata > ,
984
+ req : & Request < Octs , RequestMeta > ,
985
985
_diff_from : Option < Serial > ,
986
986
) -> Pin <
987
987
Box <
@@ -1013,7 +1013,7 @@ impl<Metadata> XfrDataProvider<Metadata> for Zone {
1013
1013
1014
1014
//--- impl XfrDataProvider for ZoneTree
1015
1015
1016
- impl < Metadata > XfrDataProvider < Metadata > for ZoneTree {
1016
+ impl < RequestMeta > XfrDataProvider < RequestMeta > for ZoneTree {
1017
1017
type Diff = EmptyZoneDiff ;
1018
1018
1019
1019
/// Request data needed to respond to an XFR request.
@@ -1024,7 +1024,7 @@ impl<Metadata> XfrDataProvider<Metadata> for ZoneTree {
1024
1024
/// Returns Err if the requested zone is not this zone tree.
1025
1025
fn request < Octs > (
1026
1026
& self ,
1027
- req : & Request < Octs , Metadata > ,
1027
+ req : & Request < Octs , RequestMeta > ,
1028
1028
_diff_from : Option < Serial > ,
1029
1029
) -> Pin <
1030
1030
Box <
@@ -2057,7 +2057,7 @@ JAIN-BB.JAIN.AD.JP. IN A 192.41.197.2
2057
2057
async fn get_zone_soa ( zone : & Zone ) -> Soa < Name < Bytes > > {
2058
2058
let read = zone. read ( ) ;
2059
2059
let zone_soa_answer =
2060
- XfrMiddlewareSvc :: < Vec < u8 > , TestNextSvc , Zone > :: read_soa (
2060
+ XfrMiddlewareSvc :: < Vec < u8 > , TestNextSvc , ( ) , Zone > :: read_soa (
2061
2061
& read,
2062
2062
zone. apex_name ( ) . to_owned ( ) ,
2063
2063
)
@@ -2176,9 +2176,9 @@ JAIN-BB.JAIN.AD.JP. IN A 192.41.197.2
2176
2176
)
2177
2177
}
2178
2178
2179
- async fn do_preprocess < Metadata , XDP : XfrDataProvider < Metadata > > (
2179
+ async fn do_preprocess < RequestMeta , XDP : XfrDataProvider < RequestMeta > > (
2180
2180
zone : XDP ,
2181
- req : & Request < Vec < u8 > , Metadata > ,
2181
+ req : & Request < Vec < u8 > , RequestMeta > ,
2182
2182
) -> Result <
2183
2183
ControlFlow <
2184
2184
XfrMiddlewareStream <
@@ -2193,7 +2193,7 @@ JAIN-BB.JAIN.AD.JP. IN A 192.41.197.2
2193
2193
XDP :: Diff : Debug + ' static ,
2194
2194
for < ' a > <XDP :: Diff as ZoneDiff >:: Stream < ' a > : Send ,
2195
2195
{
2196
- XfrMiddlewareSvc :: < Vec < u8 > , TestNextSvc , XDP , Metadata > :: preprocess (
2196
+ XfrMiddlewareSvc :: < Vec < u8 > , TestNextSvc , RequestMeta , XDP > :: preprocess (
2197
2197
Arc :: new ( Semaphore :: new ( 1 ) ) ,
2198
2198
Arc :: new ( Semaphore :: new ( 1 ) ) ,
2199
2199
req,
0 commit comments