@@ -1395,7 +1395,9 @@ impl Options {
1395
1395
///
1396
1396
/// Leveled: files older than `periodic_compaction_seconds` will be picked up
1397
1397
/// for compaction and will be re-written to the same level as they were
1398
- /// before.
1398
+ /// before if level_compaction_dynamic_level_bytes is disabled. Otherwise,
1399
+ /// it will rewrite files to the next level except for the last level files
1400
+ /// to the same level.
1399
1401
///
1400
1402
/// FIFO: not supported. Setting this option has no effect for FIFO compaction.
1401
1403
///
@@ -1440,6 +1442,44 @@ impl Options {
1440
1442
}
1441
1443
}
1442
1444
1445
+ /// This option has different meanings for different compaction styles:
1446
+ ///
1447
+ /// Leveled: Non-bottom-level files with all keys older than TTL will go
1448
+ /// through the compaction process. This usually happens in a cascading
1449
+ /// way so that those entries will be compacted to bottommost level/file.
1450
+ /// The feature is used to remove stale entries that have been deleted or
1451
+ /// updated from the file system.
1452
+ ///
1453
+ /// FIFO: Files with all keys older than TTL will be deleted. TTL is only
1454
+ /// supported if option max_open_files is set to -1.
1455
+ ///
1456
+ /// Universal: users should only set the option `periodic_compaction_seconds`
1457
+ /// instead. For backward compatibility, this option has the same
1458
+ /// meaning as `periodic_compaction_seconds`. See more in comments for
1459
+ /// `periodic_compaction_seconds` on the interaction between these two
1460
+ /// options.
1461
+ ///
1462
+ /// This option only supports block based table format for any compaction
1463
+ /// style.
1464
+ ///
1465
+ /// unit: seconds. Ex: 1 day = 1 * 24 * 60 * 60
1466
+ /// 0 means disabling.
1467
+ /// UINT64_MAX - 1 (0xfffffffffffffffe) is special flag to allow RocksDB to
1468
+ /// pick default.
1469
+ ///
1470
+ /// Default: 30 days if using block based table. 0 (disable) otherwise.
1471
+ ///
1472
+ /// Dynamically changeable
1473
+ /// Note that dynamically changing this option only works for leveled and FIFO
1474
+ /// compaction. For universal compaction, dynamically changing this option has
1475
+ /// no effect, users should dynamically change `periodic_compaction_seconds`
1476
+ /// instead.
1477
+ pub fn set_ttl ( & mut self , secs : u64 ) {
1478
+ unsafe {
1479
+ ffi:: rocksdb_options_set_ttl ( self . inner , secs) ;
1480
+ }
1481
+ }
1482
+
1443
1483
pub fn set_merge_operator_associative < F : MergeFn + Clone > (
1444
1484
& mut self ,
1445
1485
name : impl CStrLike ,
0 commit comments