33mod vlen_v2_codec;
44mod vlen_v2_partial_decoder;
55
6+ pub ( crate ) mod vlen_v2_macros;
7+
68use std:: { mem:: size_of, sync:: Arc } ;
79
8- pub use vlen_v2:: IDENTIFIER ;
10+ /// The identifier for the `vlen_v2` codec.
11+ pub ( crate ) const IDENTIFIER : & str = "vlen_v2" ;
12+ // pub use vlen_v2::IDENTIFIER;
913
10- pub use crate :: metadata:: v3:: array:: codec:: vlen_v2:: {
11- VlenV2CodecConfiguration , VlenV2CodecConfigurationV1 ,
12- } ;
13- use crate :: {
14- array:: { codec:: CodecError , RawBytes } ,
15- config:: global_config,
16- metadata:: v3:: array:: codec:: vlen_v2,
17- } ;
14+ use crate :: array:: { codec:: CodecError , RawBytes } ;
1815
19- pub use vlen_v2_codec:: VlenV2Codec ;
16+ pub ( crate ) use vlen_v2_codec:: VlenV2Codec ;
2017
2118use crate :: {
2219 array:: codec:: { Codec , CodecPlugin } ,
@@ -40,11 +37,6 @@ inventory::submit! {
4037
4138fn is_name_vlen_v2 ( name : & str ) -> bool {
4239 name. eq ( IDENTIFIER )
43- || name
44- == global_config ( )
45- . experimental_codec_names ( )
46- . get ( IDENTIFIER )
47- . expect ( "experimental codec identifier in global map" )
4840}
4941
5042fn is_name_vlen_array ( name : & str ) -> bool {
@@ -60,14 +52,12 @@ fn is_name_vlen_utf8(name: &str) -> bool {
6052}
6153
6254pub ( crate ) fn create_codec_vlen_v2 ( metadata : & MetadataV3 ) -> Result < Codec , PluginCreateError > {
63- let configuration: VlenV2CodecConfiguration = metadata
64- . to_configuration ( )
65- . map_err ( |_| PluginMetadataInvalidError :: new ( IDENTIFIER , "codec" , metadata. clone ( ) ) ) ?;
66- let codec = Arc :: new ( VlenV2Codec :: new_with_name_configuration (
67- metadata. name ( ) . to_string ( ) ,
68- & configuration,
69- ) ) ;
70- Ok ( Codec :: ArrayToBytes ( codec) )
55+ if metadata. configuration_is_none_or_empty ( ) {
56+ let codec = Arc :: new ( VlenV2Codec :: new ( metadata. name ( ) . to_string ( ) ) ) ;
57+ Ok ( Codec :: ArrayToBytes ( codec) )
58+ } else {
59+ Err ( PluginMetadataInvalidError :: new ( IDENTIFIER , "codec" , metadata. clone ( ) ) . into ( ) )
60+ }
7161}
7262
7363fn get_interleaved_bytes_and_offsets (
0 commit comments