Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

configuration: refactor configuration related APIs #54

Merged
merged 4 commits into from May 18, 2018

Conversation

shengofsun
Copy link
Contributor

  1. move configuration related APIs from c interface to utility,
  2. add comments for these APIs
  3. remove API: dsn_config_dump

move configuration related APIs from c interface to utility,
add comments for these APIs
@@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explicit

/// dsn_config_xxx function works
///
/// the function is not thread safe.
bool load_config(const char *file, const char *arguments);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改成 dsn_config_load 吧,和后面的都保持一致

qinzuoyan
qinzuoyan previously approved these changes May 18, 2018
Copy link
Member

@qinzuoyan qinzuoyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

LoveHeat
LoveHeat previously approved these changes May 18, 2018

for (int i = 0; i < kcapacity; i++) {
for (unsigned int i = 0; i < keys.size(); i++) {
Copy link
Member

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 *> &sections);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两个接口比较冗余,看了下后面使用的地方,都是在用不同的方式做一样的事情,应该可以干掉一个

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一个是把值拷出了,更安全。一个是直接用config里面的内存,不安全,但性能好。

@shengofsun shengofsun dismissed stale reviews from LoveHeat and qinzuoyan via 71324f6 May 18, 2018 08:14
Copy link
Member

@acelyc111 acelyc111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@qinzuoyan qinzuoyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shengofsun shengofsun merged commit bda73a1 into XiaoMi:master May 18, 2018
@qinzuoyan qinzuoyan mentioned this pull request Aug 20, 2018
28 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants