-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
Also rework -[FSTPersistence start] to return Status
namespace { | ||
|
||
FirestoreErrorCode ConvertStatusCode(const leveldb::Status& status) { | ||
if (status.ok()) return FirestoreErrorCode::Ok; |
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.
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. :(
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.
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); |
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.
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.
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.
Yep. Fixing this is something we should do as a part of macOS support.
This is a stepping stone toward moving most of FSTLevelDB to C++. This PR focuses mostly on rearranging the callers of
-[FSTPersistence start]
to useutil::Status
and moves the guts to C++ where possible.