6 #include <spdlog/sinks/stdout_color_sinks.h> 11 static const char* default_conf_file =
"derecho.cfg";
15 "max_reply_payload_size",
16 "max_smc_payload_size",
25 #define CONF_UNINITIALIZED (0) 26 #define CONF_INITIALIZING (1) 27 #define CONF_INITIALIZED (2) 29 #define MAKE_LONG_OPT_ENTRY(x) \ 30 { x, required_argument, 0, 0 } 31 struct option Conf::long_options[] = {
70 if(Conf::singleton_initialized_flag.compare_exchange_strong(
73 std::string real_conf_file;
76 real_conf_file = conf_file;
77 else if(std::getenv(
"DERECHO_CONF_FILE"))
79 real_conf_file = std::getenv(
"DERECHO_CONF_FILE");
80 else if(
stat(default_conf_file, &buffer) == 0) {
81 if(S_ISREG(buffer.st_mode) && (S_IRUSR | buffer.st_mode)) {
82 real_conf_file = default_conf_file;
85 real_conf_file.clear();
89 if(!real_conf_file.empty()) {
90 cfg =
new GetPot(real_conf_file);
92 Conf::singleton = std::make_unique<Conf>(
argc,
argv, cfg);
96 Conf::singleton_initialized_flag.store(
CONF_INITIALIZED, std::memory_order_acq_rel);
103 while(Conf::singleton_initialized_flag.load(std::memory_order_acquire) !=
CONF_INITIALIZED) {
104 char *empty_arg[1] = {
nullptr};
107 return Conf::singleton.get();
#define CONF_SUBGROUP_DEFAULT_MAX_SMC_PAYLOAD_SIZE
#define CONF_SUBGROUP_DEFAULT_MAX_PAYLOAD_SIZE
const uint16_t getUInt16(const std::string &key) const
const uint16_t getConfUInt16(const std::string &key)
#define CONF_SUBGROUP_DEFAULT_RDMC_SEND_ALGORITHM
const int32_t getInt32(const std::string &key) const
static const std::vector< std::string > subgroupProfileFields
const std::string & getConfString(const std::string &key)
const bool hasCustomizedKey(const std::string &key) const
#define CONF_PERS_MAX_DATA_SIZE
const int32_t getConfInt32(const std::string &key)
#define CONF_DERECHO_MAX_P2P_REPLY_PAYLOAD_SIZE
const int16_t getConfInt16(const std::string &key)
const float getFloat(const std::string &key) const
const uint32_t getConfUInt32(const std::string &key)
#define CONF_SUBGROUP_DEFAULT_MAX_REPLY_PAYLOAD_SIZE
#define CONF_SUBGROUP_DEFAULT_WINDOW_SIZE
#define CONF_DERECHO_SST_POLL_CQ_TIMEOUT_MS
#define CONF_DERECHO_SST_PORT
#define CONF_RDMA_PROVIDER
static const Conf * get() noexcept
static void initialize(int argc, char *argv[], const char *conf_file=nullptr)
const uint32_t getUInt32(const std::string &key) const
#define CONF_DERECHO_DISABLE_PARTITIONING_SAFETY
#define CONF_DERECHO_LEADER_GMS_PORT
const bool getBoolean(const std::string &key) const
const int64_t getInt64(const std::string &key) const
const uint64_t getUInt64(const std::string &key) const
#define CONF_RDMA_RX_DEPTH
#define CONF_DERECHO_LOCAL_IP
#define CONF_DERECHO_HEARTBEAT_MS
const int16_t getInt16(const std::string &key) const
#define CONF_DERECHO_RPC_PORT
#define CONF_DERECHO_P2P_WINDOW_SIZE
const int64_t getConfInt64(const std::string &key)
static std::atomic< uint32_t > singleton_initialized_flag
#define CONF_DERECHO_GMS_PORT
The single configuration file for derecho.
#define CONF_DERECHO_MAX_P2P_REQUEST_PAYLOAD_SIZE
#define CONF_RDMA_TX_DEPTH
const bool getConfBoolean(const std::string &key)
#define CONF_INITIALIZING
#define CONF_SUBGROUP_DEFAULT_BLOCK_SIZE
#define CONF_DERECHO_RDMC_PORT
#define CONF_PERS_MAX_LOG_ENTRY
#define CONF_DERECHO_LOCAL_ID
#define CONF_PERS_RAMDISK_PATH
static std::unique_ptr< Conf > singleton
const double getDouble(const std::string &key) const
const float getConfFloat(const std::string &key)
const double getConfDouble(const std::string &key)
#define CONF_PERS_FILE_PATH
#define CONF_DERECHO_LEADER_IP
#define CONF_UNINITIALIZED
const uint64_t getConfUInt64(const std::string &key)
const bool hasCustomizedConfKey(const std::string &key)
#define MAKE_LONG_OPT_ENTRY(x)
const std::string & getString(const std::string &key) const
get configuration