Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/config/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ Config::Config() {
{"dir", true, new StringField(&dir, kDefaultDir)},
{"backup-dir", false, new StringField(&backup_dir, kDefaultBackupDir)},
{"log-dir", true, new StringField(&log_dir, "")},
{"cloud-storage-type", false, new StringField(&cloud_storage_type, "")},
{"cloud-storage-bucket", false, new StringField(&cloud_storage_bucket, "")},
{"cloud-storage-access-key", false, new StringField(&cloud_storage_access_key, "")},
{"cloud-storage-secret-key", false, new StringField(&cloud_storage_secret_key, "")},
{"cloud-storage-endpoint", false, new StringField(&cloud_storage_endpoint, "")},
{"log-level", false, new EnumField<spdlog::level::level_enum>(&log_level, log_levels, spdlog::level::info)},
{"pidfile", true, new StringField(&pidfile, kDefaultPidfile)},
{"max-io-mb", false, new IntField(&max_io_mb, 0, 0, INT_MAX)},
Expand Down Expand Up @@ -411,6 +416,16 @@ void Config::initFieldValidator() {
}
return Status::OK();
}},
// <--- Ensure this comma is here!
{"cloud-storage-type",
[]([[maybe_unused]] const std::string &k, const std::string &v) -> Status {
if (v.empty()) return Status::OK();
static std::vector<std::string> supported = {"s3", "gcs", "azblob", "oss", "obs", "fs"};
if (std::find(supported.begin(), supported.end(), v) == supported.end()) {
return {Status::NotOK, "Unsupported cloud storage type: " + v};
}
return Status::OK();
}} // Last entry doesn't need a comma
};
for (const auto &iter : validators) {
auto field_iter = fields_.find(iter.first);
Expand Down
7 changes: 7 additions & 0 deletions src/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ struct Config {
std::string dir;
std::string db_dir;
std::string backup_dir; // GUARD_BY(backup_mu_)
/* Cloud Backup Configurations */
std::string cloud_storage_type;
std::string cloud_storage_bucket;
std::string cloud_storage_access_key;
std::string cloud_storage_secret_key;
std::string cloud_storage_endpoint;
/* End of Cloud Backup Configurations */
std::string pidfile;
std::string backup_sync_dir;
std::string checkpoint_dir;
Expand Down