Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adjust the UnboundedBuffer::PushData() function to C++ style. #234

Closed
KKorpse opened this issue Mar 25, 2024 · 7 comments · Fixed by #235
Closed

feat: Adjust the UnboundedBuffer::PushData() function to C++ style. #234

KKorpse opened this issue Mar 25, 2024 · 7 comments · Fixed by #235
Assignees
Labels
✏️ Feature New feature or request good first issue Good for newcomers

Comments

@KKorpse
Copy link
Collaborator

KKorpse commented Mar 25, 2024

Which PikiwiDB functionalities are relevant/related to the feature request?

No response

Description

这个接口有点太过于原始了,用起来很别扭,字符数量是靠人来数的:
image

Proposed solution

其实可以简单封装一下,提供一个这样的接口,使用起来合理一点。

std::size_t UnboundedBuffer::PushData(const std::string_view& data) {
  return PushData(data.data(), data.size());
}

新接口使用方式:

  UnboundedBuffer req;
  req.PushData("RAFT.NODE ADD ");

Alternatives considered

现在总共需要修改的地方也不多,总共 36 处左右,可以考虑换一下?
image

@KKorpse KKorpse added ✏️ Feature New feature or request good first issue Good for newcomers labels Mar 25, 2024
@hnwyllmm
Copy link
Contributor

给我试一下?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Give me a try?

@KKorpse
Copy link
Collaborator Author

KKorpse commented Mar 25, 2024

给我试一下?

ok

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Give me a try?

OK

@hnwyllmm
Copy link
Contributor

string_view 是C++17才支持的,但是pikiwidb希望使用的是C++11。
替代方案是实现 const char *版本的函数,但是使用const char *版本会降低性能。
有什么建议吗?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


string_view is only supported by C++17, but pikiwidb hopes to use C++11.
The alternative is to implement a const char* version of the function, but using the const char* version will reduce performance.
Any suggestions?

@KKorpse
Copy link
Collaborator Author

KKorpse commented Mar 25, 2024

string_view 是C++17才支持的,但是pikiwidb希望使用的是C++11。 替代方案是实现 const char *版本的函数,但是使用const char *版本会降低性能。 有什么建议吗?

README 有点过时了,正在重新写。
其实最高用到 C++ 20 都行,不一定限制在 11。

Cmake 文件有这么一行

SET(CMAKE_CXX_STANDARD 20)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✏️ Feature New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants