Skip to content

Use new filesystem routines in FSTLevelDB #1707

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

Merged
merged 4 commits into from
Aug 17, 2018
Merged

Conversation

wilhuff
Copy link
Contributor

@wilhuff wilhuff commented Aug 17, 2018

This is a stepping stone toward moving most of FSTLevelDB to C++. This PR focuses mostly on rearranging the callers of -[FSTPersistence start] to use util::Status and moves the guts to C++ where possible.

namespace {

FirestoreErrorCode ConvertStatusCode(const leveldb::Status& status) {
if (status.ok()) return FirestoreErrorCode::Ok;
Copy link
Member

Choose a reason for hiding this comment

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

Alternative would be to switch on status.code(). You could then use the compiler to help enforce exhaustive checks. Optional.

Edit: Oops. status.code() is private. I guess we'll just have to hope leveldb never adds any new error types. :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's where I started, and yes code() is private. There's equivalent code in google3 so I think this is about as good as it gets for now.

NSString *dotPrefixed = [@"." stringByAppendingString:kReservedPathComponent];
return [NSHomeDirectory() stringByAppendingPathComponent:dotPrefixed];
std::string dotPrefixed = absl::StrCat(".", kReservedPathComponent);
return Path::FromNSString(NSHomeDirectory()).AppendUtf8(dotPrefixed);
Copy link
Member

Choose a reason for hiding this comment

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

Completely unrelated to your change, I don't think Apple recommends putting stuff like this directly in the homedir anymore. (xdg doesn't either.)

No action required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Fixing this is something we should do as a part of macOS support.

@wilhuff wilhuff merged commit 2f6ff23 into master Aug 17, 2018
@wilhuff wilhuff deleted the wilhuff/leveldb-filesystem branch August 17, 2018 21:42
@firebase firebase locked and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants