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
Deduplicate disk abstraction infrastructure #1060
Conversation
Nice! Thanks for doing this! I always felt there was something that could be done, since the two were very similar! |
👍 |
Fix some ManifestParser constructor calls missed by commit 56bab44 (dupe_edge_should_err from bool to enum, 2016-01-27).
6c3ad1f
to
876bc5b
Compare
Rebased on |
Thank you for the patch. All that deleted code is nice to see, and the bonus build fix is much appreciated too :-) I think this makes the codebase better than it was before. I'll explain briefly why I didn't just hit "merge" long ago (sorry for the delay). If after reading this you think this patch as-is is the way to go, then I'll merge it as-is (as I do think it's better than what's there today).
I hope that makes sense :-) As I said, if you prefer to not make any changes, that's fine too. |
Some clients will need only the ability to read files, so provide this as a more narrow interface than the full disk interface.
Return a status so callers can distinguish a missing file from an empty file. This allows our VirtualFileSystem test infrastructure to report as missing any file for which it has no entry.
Avoid having two separate filesystem interfaces. Simplify test infrastructure by avoiding custom `ManifestParser::FileReader` implementations.
876bc5b
to
e74cefa
Compare
@nico, all good comments, thanks. I've rewritten the topic to address them.
I split out a FileReader base class interface from DiskInterface to give to ManifestParser instead. This will restrict what it can use from a DiskInterface implementation.
I changed the interface to return an enumeration as suggested.
I removed the latter in favor of updating the call sites. I had intended it to avoid duplication but there are only two places and a switch on the enumeration value makes the logic more transparent than trying to encode it in a long method name. |
Deduplicate disk abstraction infrastructure
Thanks! |
Currently we have two disk abstractions:
DiskInterface
andManifestParser::FileReader
.Revise
DiskInterface
to support both use cases and then dropFileReader
. This also simplifies test infrastructure by avoiding customFileReader
implementations.