@@ -17,7 +17,7 @@ pub use slatedb::db_cache::foyer_hybrid::FoyerHybridCache;
1717pub use slatedb:: db_cache:: { CachedEntry , CachedKey , SplitCache } ;
1818use slatedb:: object_store:: { self , ObjectStore } ;
1919pub use slatedb:: { CompactorBuilder , DbBuilder } ;
20- use slatedb:: { DbReader , FilterPolicy , SstReader } ;
20+ use slatedb:: { DbReader , FilterPolicy , PrefixExtractor , SstReader } ;
2121use tracing:: info;
2222use uuid:: Uuid ;
2323
@@ -161,6 +161,9 @@ impl StorageBuilder {
161161 if let Some ( policies) = self . semantics . filter_policies {
162162 db_builder = db_builder. with_filter_policies ( policies) ;
163163 }
164+ if let Some ( extractor) = self . semantics . segment_extractor {
165+ db_builder = db_builder. with_segment_extractor ( extractor) ;
166+ }
164167 let db = db_builder. build ( ) . await . map_err ( |e| {
165168 StorageError :: Storage ( format ! ( "Failed to create SlateDB: {}" , e) )
166169 } ) ?;
@@ -250,6 +253,7 @@ impl StorageReaderRuntime {
250253pub struct StorageSemantics {
251254 pub ( crate ) merge_operator : Option < Arc < dyn MergeOperator > > ,
252255 pub ( crate ) filter_policies : Option < Vec < Arc < dyn FilterPolicy > > > ,
256+ pub ( crate ) segment_extractor : Option < Arc < dyn PrefixExtractor > > ,
253257}
254258
255259impl StorageSemantics {
@@ -275,6 +279,17 @@ impl StorageSemantics {
275279 self . filter_policies = Some ( policies) ;
276280 self
277281 }
282+
283+ /// Sets the segment extractor (SlateDB RFC-0024) for writers and readers.
284+ ///
285+ /// SlateDB 0.14 persists the extractor's name in the manifest and refuses
286+ /// to open a writer or `DbReader` whose configured extractor doesn't match.
287+ /// Routing this through semantics keeps the writer, compactor, and
288+ /// standalone reader paths aligned on a single extractor.
289+ pub fn with_segment_extractor ( mut self , extractor : Arc < dyn PrefixExtractor > ) -> Self {
290+ self . segment_extractor = Some ( extractor) ;
291+ self
292+ }
278293}
279294
280295pub fn new_slatedb_compactor_builder (
@@ -403,6 +418,9 @@ pub async fn create_storage_read(
403418 if let Some ( policies) = semantics. filter_policies {
404419 builder = builder. with_filter_policies ( policies) ;
405420 }
421+ if let Some ( extractor) = semantics. segment_extractor {
422+ builder = builder. with_segment_extractor ( extractor) ;
423+ }
406424 if let Some ( cache) = cache. clone ( ) {
407425 builder = builder. with_db_cache ( cache) ;
408426 }
0 commit comments