1111#include < set>
1212#include < unordered_set>
1313
14+ #include " rocksdb/compression_type.h"
15+
1416#include " pstd/include/base_conf.h"
1517#include " pstd/include/pstd_mutex.h"
1618#include " pstd/include/pstd_string.h"
1719
1820#include " acl.h"
1921#include " include/pika_define.h"
20- #include " include/pika_meta.h"
2122#include " rocksdb/compression_type.h"
2223
2324#define kBinlogReadWinDefaultSize 9000
@@ -76,6 +77,15 @@ class PikaConf : public pstd::BaseConf {
7677 std::shared_lock l (rwlock_);
7778 return db_path_;
7879 }
80+ int db_instance_num () {
81+ return db_instance_num_;
82+ }
83+ uint64_t rocksdb_ttl_second () {
84+ return rocksdb_ttl_second_.load ();
85+ }
86+ uint64_t rocksdb_periodic_compaction_second () {
87+ return rocksdb_periodic_second_.load ();
88+ }
7989 std::string db_sync_path () {
8090 std::shared_lock l (rwlock_);
8191 return db_sync_path_;
@@ -376,7 +386,6 @@ class PikaConf : public pstd::BaseConf {
376386 bool daemonize () { return daemonize_; }
377387 std::string pidfile () { return pidfile_; }
378388 int binlog_file_size () { return binlog_file_size_; }
379- PikaMeta* local_meta () { return local_meta_.get (); }
380389 std::vector<rocksdb::CompressionType> compression_per_level ();
381390 std::string compression_all_levels () const { return compression_per_level_; };
382391 static rocksdb::CompressionType GetCompression (const std::string& value);
@@ -416,6 +425,15 @@ class PikaConf : public pstd::BaseConf {
416425 TryPushDiffCommands (" slaveof" , value);
417426 slaveof_ = value;
418427 }
428+
429+ void SetRocksdbTTLSecond (uint64_t ttl) {
430+ rocksdb_ttl_second_.store (ttl);
431+ }
432+
433+ void SetRocksdbPeriodicSecond (uint64_t value) {
434+ rocksdb_periodic_second_.store (value);
435+ }
436+
419437 void SetReplicationID (const std::string& value) {
420438 std::lock_guard l (rwlock_);
421439 TryPushDiffCommands (" replication-id" , value);
@@ -655,6 +673,7 @@ class PikaConf : public pstd::BaseConf {
655673 int ConfigRewriteReplicationID ();
656674
657675 private:
676+ // TODO: replace mutex with atomic value
658677 int port_ = 0 ;
659678 int slave_priority_ = 0 ;
660679 int thread_num_ = 0 ;
@@ -668,6 +687,7 @@ class PikaConf : public pstd::BaseConf {
668687 std::string log_path_;
669688 std::string log_level_;
670689 std::string db_path_;
690+ int db_instance_num_ = 0 ;
671691 std::string db_sync_path_;
672692 std::string compact_cron_;
673693 std::string compact_interval_;
@@ -719,6 +739,8 @@ class PikaConf : public pstd::BaseConf {
719739 int max_background_compactions_ = 0 ;
720740 int max_background_jobs_ = 0 ;
721741 int max_cache_files_ = 0 ;
742+ std::atomic<uint64_t > rocksdb_ttl_second_ = 0 ;
743+ std::atomic<uint64_t > rocksdb_periodic_second_ = 0 ;
722744 int max_bytes_for_level_multiplier_ = 0 ;
723745 int64_t block_size_ = 0 ;
724746 int64_t block_cache_ = 0 ;
@@ -787,7 +809,6 @@ class PikaConf : public pstd::BaseConf {
787809 int64_t blob_file_size_ = 256 * 1024 * 1024 ; // 256M
788810 std::string blob_compression_type_ = " none" ;
789811
790- std::unique_ptr<PikaMeta> local_meta_;
791812 std::shared_mutex rwlock_;
792813
793814 // Rsync Rate limiting configuration
0 commit comments