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

Resolves #39: Replacing usage of std::string with StringRef for Datakey and DataValue #194

Merged
merged 3 commits into from
May 30, 2019

Conversation

apkar
Copy link
Contributor

@apkar apkar commented May 27, 2019

For the following reasons its bad to use std::string for bytes

  • Usage of std::string for bytes is confusing
  • Implicit conversion from std::string to StringRef is dangerous, especially if std::string is r-value
  • Implicit conversion from std::string to Standalone<StringRef> is unnecessary extra copy. This is happening a lot.
  • Most of the places std::string is passed back to FDB::Transaction::get() or FDB::Transaction::set(), which convert it to StringRef anyway. Semantics are very confusing.

Resolves #39, even though we still have some bad usages of std::string, the majority are changed.

apkar added 3 commits May 26, 2019 19:30
* This should reduce number of memory copies a lot
* Also it has better semantics `std::string` for human readable and
`StringRef` binary
@apkar apkar requested a review from dongxinEric May 27, 2019 02:35
Copy link
Contributor

@dongxinEric dongxinEric left a comment

Choose a reason for hiding this comment

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

LGTM

@dongxinEric dongxinEric merged commit 3ba6ff4 into FoundationDB:master May 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use std::string for printable strings only
2 participants