@@ -777,6 +777,81 @@ impl BlockBasedOptions {
777
777
) ;
778
778
}
779
779
}
780
+
781
+ /// The tier of block-based tables whose top-level index into metadata
782
+ /// partitions will be pinned. Currently indexes and filters may be
783
+ /// partitioned.
784
+ ///
785
+ /// Note `cache_index_and_filter_blocks` must be true for this option to have
786
+ /// any effect. Otherwise any top-level index into metadata partitions would be
787
+ /// held in table reader memory, outside the block cache.
788
+ ///
789
+ /// Default: `BlockBasedPinningTier:Fallback`
790
+ ///
791
+ /// # Example
792
+ ///
793
+ /// ```
794
+ /// use rust_rocksdb::{BlockBasedOptions, BlockBasedPinningTier, Options};
795
+ ///
796
+ /// let mut opts = Options::default();
797
+ /// let mut block_opts = BlockBasedOptions::default();
798
+ /// block_opts.set_top_level_index_pinning_tier(BlockBasedPinningTier::FlushAndSimilar);
799
+ /// ```
800
+ pub fn set_top_level_index_pinning_tier ( & mut self , tier : BlockBasedPinningTier ) {
801
+ unsafe {
802
+ ffi:: rocksdb_block_based_options_set_top_level_index_pinning_tier (
803
+ self . inner ,
804
+ tier as c_int ,
805
+ ) ;
806
+ }
807
+ }
808
+
809
+ /// The tier of block-based tables whose metadata partitions will be pinned.
810
+ /// Currently indexes and filters may be partitioned.
811
+ ///
812
+ /// Default: `BlockBasedPinningTier:Fallback`
813
+ ///
814
+ /// # Example
815
+ ///
816
+ /// ```
817
+ /// use rust_rocksdb::{BlockBasedOptions, BlockBasedPinningTier, Options};
818
+ ///
819
+ /// let mut opts = Options::default();
820
+ /// let mut block_opts = BlockBasedOptions::default();
821
+ /// block_opts.set_partition_pinning_tier(BlockBasedPinningTier::FlushAndSimilar);
822
+ /// ```
823
+ pub fn set_partition_pinning_tier ( & mut self , tier : BlockBasedPinningTier ) {
824
+ unsafe {
825
+ ffi:: rocksdb_block_based_options_set_partition_pinning_tier ( self . inner , tier as c_int ) ;
826
+ }
827
+ }
828
+
829
+ /// The tier of block-based tables whose unpartitioned metadata blocks will be
830
+ /// pinned.
831
+ ///
832
+ /// Note `cache_index_and_filter_blocks` must be true for this option to have
833
+ /// any effect. Otherwise the unpartitioned meta-blocks would be held in table
834
+ /// reader memory, outside the block cache.
835
+ ///
836
+ /// Default: `BlockBasedPinningTier:Fallback`
837
+ ///
838
+ /// # Example
839
+ ///
840
+ /// ```
841
+ /// use rust_rocksdb::{BlockBasedOptions, BlockBasedPinningTier, Options};
842
+ ///
843
+ /// let mut opts = Options::default();
844
+ /// let mut block_opts = BlockBasedOptions::default();
845
+ /// block_opts.set_unpartitioned_pinning_tier(BlockBasedPinningTier::FlushAndSimilar);
846
+ /// ```
847
+ pub fn set_unpartitioned_pinning_tier ( & mut self , tier : BlockBasedPinningTier ) {
848
+ unsafe {
849
+ ffi:: rocksdb_block_based_options_set_unpartitioned_pinning_tier (
850
+ self . inner ,
851
+ tier as c_int ,
852
+ ) ;
853
+ }
854
+ }
780
855
}
781
856
782
857
impl Default for BlockBasedOptions {
@@ -4198,6 +4273,15 @@ pub enum DBCompactionPri {
4198
4273
RoundRobin = ffi:: rocksdb_k_round_robin_compaction_pri as isize ,
4199
4274
}
4200
4275
4276
+ #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
4277
+ #[ cfg_attr( feature = "serde1" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
4278
+ pub enum BlockBasedPinningTier {
4279
+ Fallback = ffi:: rocksdb_block_based_k_fallback_pinning_tier as isize ,
4280
+ None = ffi:: rocksdb_block_based_k_none_pinning_tier as isize ,
4281
+ FlushAndSimilar = ffi:: rocksdb_block_based_k_flush_and_similar_pinning_tier as isize ,
4282
+ All = ffi:: rocksdb_block_based_k_all_pinning_tier as isize ,
4283
+ }
4284
+
4201
4285
pub struct FifoCompactOptions {
4202
4286
pub ( crate ) inner : * mut ffi:: rocksdb_fifo_compaction_options_t ,
4203
4287
}
0 commit comments