@@ -825,6 +825,80 @@ impl BlockBasedOptions {
825
825
) ;
826
826
}
827
827
}
828
+
829
+ /// Set the top-level index pinning tier.
830
+ ///
831
+ /// Controls when top-level index blocks are pinned in block cache memory.
832
+ /// This affects memory usage and lookup performance for large databases with
833
+ /// multiple levels.
834
+ ///
835
+ /// Default: `BlockBasedTablePinningTier::Fallback`
836
+ ///
837
+ /// # Examples
838
+ ///
839
+ /// ```
840
+ /// use rocksdb::{BlockBasedOptions, BlockBasedTablePinningTier};
841
+ ///
842
+ /// let mut opts = BlockBasedOptions::default();
843
+ /// opts.set_top_level_index_pinning_tier(BlockBasedTablePinningTier::FlushAndSimilar);
844
+ /// ```
845
+ pub fn set_top_level_index_pinning_tier ( & mut self , pinning_tier : BlockBasedTablePinningTier ) {
846
+ unsafe {
847
+ ffi:: rocksdb_block_based_options_set_top_level_index_pinning_tier (
848
+ self . inner ,
849
+ pinning_tier as c_int ,
850
+ ) ;
851
+ }
852
+ }
853
+
854
+ /// Set the partition pinning tier.
855
+ ///
856
+ /// Controls when partition blocks (used in partitioned indexes and filters)
857
+ /// are pinned in block cache memory. This affects performance for databases
858
+ /// using partitioned metadata.
859
+ ///
860
+ /// Default: `BlockBasedTablePinningTier::Fallback`
861
+ ///
862
+ /// # Examples
863
+ ///
864
+ /// ```
865
+ /// use rocksdb::{BlockBasedOptions, BlockBasedTablePinningTier};
866
+ ///
867
+ /// let mut opts = BlockBasedOptions::default();
868
+ /// opts.set_partition_pinning_tier(BlockBasedTablePinningTier::All);
869
+ /// ```
870
+ pub fn set_partition_pinning_tier ( & mut self , pinning_tier : BlockBasedTablePinningTier ) {
871
+ unsafe {
872
+ ffi:: rocksdb_block_based_options_set_partition_pinning_tier (
873
+ self . inner ,
874
+ pinning_tier as c_int ,
875
+ ) ;
876
+ }
877
+ }
878
+
879
+ /// Set the unpartitioned pinning tier.
880
+ ///
881
+ /// Controls when unpartitioned metadata blocks (index and filter blocks that
882
+ /// are not partitioned) are pinned in block cache memory.
883
+ ///
884
+ /// Default: `BlockBasedTablePinningTier::Fallback`
885
+ ///
886
+ /// # Examples
887
+ ///
888
+ /// ```
889
+ /// use rocksdb::{BlockBasedOptions, BlockBasedTablePinningTier};
890
+ ///
891
+ /// let mut opts = BlockBasedOptions::default();
892
+ /// opts.set_unpartitioned_pinning_tier(BlockBasedTablePinningTier::None);
893
+ /// ```
894
+ pub fn set_unpartitioned_pinning_tier ( & mut self , pinning_tier : BlockBasedTablePinningTier ) {
895
+ unsafe {
896
+ ffi:: rocksdb_block_based_options_set_unpartitioned_pinning_tier (
897
+ self . inner ,
898
+ pinning_tier as c_int ,
899
+ ) ;
900
+ }
901
+ }
828
902
}
829
903
830
904
impl Default for BlockBasedOptions {
@@ -4232,6 +4306,20 @@ pub enum DataBlockIndexType {
4232
4306
BinaryAndHash = 1 ,
4233
4307
}
4234
4308
4309
+ /// Used by BlockBasedOptions for setting metadata cache pinning tiers.
4310
+ /// Controls how metadata blocks (index, filter, etc.) are pinned in block cache.
4311
+ #[ repr( C ) ]
4312
+ pub enum BlockBasedTablePinningTier {
4313
+ /// Use fallback pinning tier (context-dependent)
4314
+ Fallback = ffi:: rocksdb_block_based_k_fallback_pinning_tier as isize ,
4315
+ /// No pinning - blocks can be evicted at any time
4316
+ None = ffi:: rocksdb_block_based_k_none_pinning_tier as isize ,
4317
+ /// Pin blocks for flushed files and similar scenarios
4318
+ FlushAndSimilar = ffi:: rocksdb_block_based_k_flush_and_similar_pinning_tier as isize ,
4319
+ /// Pin all blocks (highest priority)
4320
+ All = ffi:: rocksdb_block_based_k_all_pinning_tier as isize ,
4321
+ }
4322
+
4235
4323
/// Defines the underlying memtable implementation.
4236
4324
/// See official [wiki](https://github.com/facebook/rocksdb/wiki/MemTable) for more information.
4237
4325
pub enum MemtableFactory {
0 commit comments