@@ -1517,7 +1517,9 @@ impl Options {
15171517 ///
15181518 /// Leveled: files older than `periodic_compaction_seconds` will be picked up
15191519 /// for compaction and will be re-written to the same level as they were
1520- /// before.
1520+ /// before if level_compaction_dynamic_level_bytes is disabled. Otherwise,
1521+ /// it will rewrite files to the next level except for the last level files
1522+ /// to the same level.
15211523 ///
15221524 /// FIFO: not supported. Setting this option has no effect for FIFO compaction.
15231525 ///
@@ -1529,9 +1531,10 @@ impl Options {
15291531 /// UniversalCompactionBuilder::PickPeriodicCompaction().
15301532 /// For backward compatibility, the effective value of this option takes
15311533 /// into account the value of option `ttl`. The logic is as follows:
1532- /// - both options are set to 30 days if they have the default value.
1533- /// - if both options are zero, zero is picked. Otherwise, we take the min
1534- /// value among non-zero options values (i.e. takes the stricter limit).
1534+ ///
1535+ /// - both options are set to 30 days if they have the default value.
1536+ /// - if both options are zero, zero is picked. Otherwise, we take the min
1537+ /// value among non-zero options values (i.e. takes the stricter limit).
15351538 ///
15361539 /// One main use of the feature is to make sure a file goes through compaction
15371540 /// filters periodically. Users can also use the feature to clear up SST
@@ -1555,13 +1558,50 @@ impl Options {
15551558 /// Default: 30 days if using block based table format + compaction filter +
15561559 /// leveled compaction or block based table format + universal compaction.
15571560 /// 0 (disabled) otherwise.
1558- ///
15591561 pub fn set_periodic_compaction_seconds ( & mut self , secs : u64 ) {
15601562 unsafe {
15611563 ffi:: rocksdb_options_set_periodic_compaction_seconds ( self . inner , secs) ;
15621564 }
15631565 }
15641566
1567+ /// This option has different meanings for different compaction styles:
1568+ ///
1569+ /// Leveled: Non-bottom-level files with all keys older than TTL will go
1570+ /// through the compaction process. This usually happens in a cascading
1571+ /// way so that those entries will be compacted to bottommost level/file.
1572+ /// The feature is used to remove stale entries that have been deleted or
1573+ /// updated from the file system.
1574+ ///
1575+ /// FIFO: Files with all keys older than TTL will be deleted. TTL is only
1576+ /// supported if option max_open_files is set to -1.
1577+ ///
1578+ /// Universal: users should only set the option `periodic_compaction_seconds`
1579+ /// instead. For backward compatibility, this option has the same
1580+ /// meaning as `periodic_compaction_seconds`. See more in comments for
1581+ /// `periodic_compaction_seconds` on the interaction between these two
1582+ /// options.
1583+ ///
1584+ /// This option only supports block based table format for any compaction
1585+ /// style.
1586+ ///
1587+ /// unit: seconds. Ex: 1 day = 1 * 24 * 60 * 60
1588+ /// 0 means disabling.
1589+ /// UINT64_MAX - 1 (0xfffffffffffffffe) is special flag to allow RocksDB to
1590+ /// pick default.
1591+ ///
1592+ /// Default: 30 days if using block based table. 0 (disable) otherwise.
1593+ ///
1594+ /// Dynamically changeable
1595+ /// Note that dynamically changing this option only works for leveled and FIFO
1596+ /// compaction. For universal compaction, dynamically changing this option has
1597+ /// no effect, users should dynamically change `periodic_compaction_seconds`
1598+ /// instead.
1599+ pub fn set_ttl ( & mut self , secs : u64 ) {
1600+ unsafe {
1601+ ffi:: rocksdb_options_set_ttl ( self . inner , secs) ;
1602+ }
1603+ }
1604+
15651605 pub fn set_merge_operator_associative < F : MergeFn + Clone > (
15661606 & mut self ,
15671607 name : impl CStrLike ,
0 commit comments