configuration: refactor configuration related APIs #54
Conversation
shengofsun
commented
May 17, 2018
- move configuration related APIs from c interface to utility,
- add comments for these APIs
- remove API: dsn_config_dump
move configuration related APIs from c interface to utility, add comments for these APIs
src/core/core/rpc_engine.h
Outdated
@@ -141,7 +140,7 @@ class rpc_server_dispatcher | |||
class rpc_engine | |||
{ | |||
public: | |||
rpc_engine(configuration_ptr config, service_node *node); | |||
rpc_engine(service_node *node); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explicit
include/dsn/utility/config_api.h
Outdated
/// dsn_config_xxx function works | ||
/// | ||
/// the function is not thread safe. | ||
bool load_config(const char *file, const char *arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
改成 dsn_config_load 吧,和后面的都保持一致
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/core/core/global_config.cpp
Outdated
|
||
for (int i = 0; i < kcapacity; i++) { | ||
for (unsigned int i = 0; i < keys.size(); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些循环用range based loop?
|
||
/// get the names of all sections | ||
/// this function is not thread safe if dsn_config_set is concurrently called | ||
void dsn_config_get_all_sections(/*out*/ std::vector<const char *> §ions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这两个接口比较冗余,看了下后面使用的地方,都是在用不同的方式做一样的事情,应该可以干掉一个
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
一个是把值拷出了,更安全。一个是直接用config里面的内存,不安全,但性能好。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM