@@ -3,11 +3,14 @@ use std::collections::HashMap;
33const RATE_LIMIT_ERROR_EXTENSION : & str = "SCYLLA_RATE_LIMIT_ERROR" ;
44pub const SCYLLA_LWT_ADD_METADATA_MARK_EXTENSION : & str = "SCYLLA_LWT_ADD_METADATA_MARK" ;
55pub const LWT_OPTIMIZATION_META_BIT_MASK_KEY : & str = "LWT_OPTIMIZATION_META_BIT_MASK" ;
6+ const TABLETS_ROUTING_V1_KEY : & str = "TABLETS_ROUTING_V1" ;
7+
68#[ derive( Default , Clone , Copy , Debug , PartialEq , Eq ) ]
79#[ non_exhaustive]
810pub struct ProtocolFeatures {
911 pub rate_limit_error : Option < i32 > ,
1012 pub lwt_optimization_meta_bit_mask : Option < u32 > ,
13+ pub tablets_v1_supported : bool ,
1114}
1215
1316// TODO: Log information about options which failed to parse
@@ -19,6 +22,7 @@ impl ProtocolFeatures {
1922 lwt_optimization_meta_bit_mask : Self :: maybe_parse_lwt_optimization_meta_bit_mask (
2023 supported,
2124 ) ,
25+ tablets_v1_supported : Self :: check_tablets_routing_v1_support ( supported) ,
2226 }
2327 }
2428
@@ -37,6 +41,10 @@ impl ProtocolFeatures {
3741 mask_str. parse :: < u32 > ( ) . ok ( )
3842 }
3943
44+ fn check_tablets_routing_v1_support ( supported : & HashMap < String , Vec < String > > ) -> bool {
45+ supported. contains_key ( TABLETS_ROUTING_V1_KEY )
46+ }
47+
4048 // Looks up a field which starts with `key=` and returns the rest
4149 fn get_cql_extension_field < ' a > ( vals : & ' a [ String ] , key : & str ) -> Option < & ' a str > {
4250 vals. iter ( )
@@ -53,6 +61,10 @@ impl ProtocolFeatures {
5361 format ! ( "{}={}" , LWT_OPTIMIZATION_META_BIT_MASK_KEY , mask) ,
5462 ) ;
5563 }
64+
65+ if self . tablets_v1_supported {
66+ options. insert ( TABLETS_ROUTING_V1_KEY . to_string ( ) , String :: new ( ) ) ;
67+ }
5668 }
5769
5870 pub fn prepared_flags_contain_lwt_mark ( & self , flags : u32 ) -> bool {
0 commit comments