@@ -59,12 +59,12 @@ impl Builder<()> {
5959 auth_token,
6060 connector: None ,
6161 version: None ,
62+ namespace: None ,
6263 } ,
6364 encryption_config: None ,
6465 read_your_writes: true ,
6566 sync_interval: None ,
6667 http_request_callback: None ,
67- namespace: None ,
6868 skip_safety_assert: false ,
6969 #[ cfg( feature = "sync" ) ]
7070 sync_protocol: Default :: default ( ) ,
@@ -102,6 +102,7 @@ impl Builder<()> {
102102 auth_token,
103103 connector: None ,
104104 version: None ,
105+ namespace: None ,
105106 } ,
106107 connector: None ,
107108 read_your_writes: true ,
@@ -122,6 +123,7 @@ impl Builder<()> {
122123 auth_token,
123124 connector: None ,
124125 version: None ,
126+ namespace: None ,
125127 } ,
126128 }
127129 }
@@ -135,6 +137,7 @@ cfg_replication_or_remote_or_sync! {
135137 auth_token: String ,
136138 connector: Option <crate :: util:: ConnectorService >,
137139 version: Option <String >,
140+ namespace: Option <String >,
138141 }
139142}
140143
@@ -223,7 +226,6 @@ cfg_replication! {
223226 read_your_writes: bool ,
224227 sync_interval: Option <std:: time:: Duration >,
225228 http_request_callback: Option <crate :: util:: HttpRequestCallback >,
226- namespace: Option <String >,
227229 skip_safety_assert: bool ,
228230 #[ cfg( feature = "sync" ) ]
229231 sync_protocol: super :: SyncProtocol ,
@@ -300,7 +302,7 @@ cfg_replication! {
300302 /// Set the namespace that will be communicated to remote replica in the http header.
301303 pub fn namespace( mut self , namespace: impl Into <String >) -> Builder <RemoteReplica >
302304 {
303- self . inner. namespace = Some ( namespace. into( ) ) ;
305+ self . inner. remote . namespace = Some ( namespace. into( ) ) ;
304306 self
305307 }
306308
@@ -334,12 +336,12 @@ cfg_replication! {
334336 auth_token,
335337 connector,
336338 version,
339+ namespace,
337340 } ,
338341 encryption_config,
339342 read_your_writes,
340343 sync_interval,
341344 http_request_callback,
342- namespace,
343345 skip_safety_assert,
344346 #[ cfg( feature = "sync" ) ]
345347 sync_protocol,
@@ -500,6 +502,7 @@ cfg_replication! {
500502 auth_token,
501503 connector,
502504 version,
505+ namespace,
503506 } ) = remote
504507 {
505508 let connector = if let Some ( connector) = connector {
@@ -524,6 +527,7 @@ cfg_replication! {
524527 flags,
525528 encryption_config. clone( ) ,
526529 http_request_callback,
530+ namespace,
527531 )
528532 . await ?
529533 } else {
@@ -606,6 +610,7 @@ cfg_sync! {
606610 auth_token,
607611 connector: _,
608612 version: _,
613+ namespace: _,
609614 } ,
610615 connector,
611616 remote_writes,
@@ -730,13 +735,21 @@ cfg_remote! {
730735 self
731736 }
732737
738+ /// Set the namespace that will be communicated to the remote in the http header.
739+ pub fn namespace( mut self , namespace: impl Into <String >) -> Builder <Remote >
740+ {
741+ self . inner. namespace = Some ( namespace. into( ) ) ;
742+ self
743+ }
744+
733745 /// Build the remote database client.
734746 pub async fn build( self ) -> Result <Database > {
735747 let Remote {
736748 url,
737749 auth_token,
738750 connector,
739751 version,
752+ namespace,
740753 } = self . inner;
741754
742755 let connector = if let Some ( connector) = connector {
@@ -758,6 +771,7 @@ cfg_remote! {
758771 auth_token,
759772 connector,
760773 version,
774+ namespace,
761775 } ,
762776 max_write_replication_index: Default :: default ( ) ,
763777 } )
0 commit comments