This repository was archived by the owner on Oct 18, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ use crate::rpc::replication_log::rpc::{
2020 replication_log_client:: ReplicationLogClient , HelloRequest , LogOffset ,
2121} ;
2222use crate :: rpc:: replication_log:: NEED_SNAPSHOT_ERROR_MSG ;
23- use crate :: rpc:: NAMESPACE_DOESNT_EXIST ;
23+ use crate :: rpc:: { NAMESPACE_DOESNT_EXIST , NAMESPACE_METADATA_KEY } ;
2424use crate :: ResetOp ;
2525
2626use super :: hook:: { Frames , InjectorHookCtx } ;
@@ -129,7 +129,7 @@ impl Replicator {
129129 fn make_request < T > ( & self , msg : T ) -> Request < T > {
130130 let mut req = Request :: new ( msg) ;
131131 req. metadata_mut ( ) . insert_bin (
132- "x-namespace" ,
132+ NAMESPACE_METADATA_KEY ,
133133 BinaryMetadataValue :: from_bytes ( & self . namespace [ ..] ) ,
134134 ) ;
135135
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ pub mod replication_log_proxy;
2121
2222/// A tonic error code to signify that a namespace doesn't exist.
2323pub const NAMESPACE_DOESNT_EXIST : & str = "NAMESPACE_DOESNT_EXIST" ;
24- pub ( crate ) const NAMESPACE_METADATA_KEY : & str = "x-namespace" ;
24+ pub ( crate ) const NAMESPACE_METADATA_KEY : & str = "x-namespace-bin " ;
2525
2626#[ allow( clippy:: too_many_arguments) ]
2727pub async fn run_rpc_server (
@@ -78,11 +78,11 @@ fn extract_namespace<T>(
7878 return Ok ( Bytes :: from_static ( DEFAULT_NAMESPACE_NAME . as_bytes ( ) ) ) ;
7979 }
8080
81- if let Some ( namespace) = req. metadata ( ) . get_bin ( "x-namespace" ) {
81+ if let Some ( namespace) = req. metadata ( ) . get_bin ( NAMESPACE_METADATA_KEY ) {
8282 namespace
8383 . to_bytes ( )
8484 . map_err ( |_| Status :: invalid_argument ( "Metadata can't be converted into Bytes" ) )
8585 } else {
86- Err ( Status :: invalid_argument ( "Missing x-namespace metadata" ) )
86+ Err ( Status :: invalid_argument ( "Missing x-namespace-bin metadata" ) )
8787 }
8888}
You can’t perform that action at this time.
0 commit comments