-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Split out VisibleStore
and ReferrersStore
from Store
#8213
base: master
Are you sure you want to change the base?
Conversation
I'm not sure if moving this stuff to the type level really makes life easier. It feels over-engineered, especially because it requires multiple inheritance which often introduces weird problems. Much easier for unsupported methods to either throw an error or return |
Multiple inheritance is perfectly fine for method-only "interface" types (with a unique We did this same thing for |
That is only good when you can then pass around the result of that method call. E.g. But you want to only have this fallibility, whether it is down-casting or calling method that might fail, at the boundary of the system (CLI or entry points). Internally everything should be infallible so the types actually mean something. |
Finally, I think it is very advantageous to split these out of the main For I think that's a fruitful direction to explore, and splitting out an interface like this is a very simple and easy thing that allows doing so in the future. (To the extent that Nix is "functionality" capability-based security is the natural way of doing things too.) |
4a7f9b7
to
b1ac6b5
Compare
The second commit cleans up the use of |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-05-05-nix-team-meeting-minutes-52/27893/1 |
b1ac6b5
to
db7a513
Compare
Discussed in Nix team meeting 2023-07-07:
No decision taken |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-07-07-nix-team-meeting-minutes-69/30470/1 |
db7a513
to
83ed2d1
Compare
83ed2d1
to
d96b1c1
Compare
d96b1c1
to
8cdccbb
Compare
More progress on issue NixOS#5729 `queryAllValidPaths` and `queryReferrers` were two methods that failing `unsupported` default implementation. This is not type safe. Now, those methods are in their own classes, and there is no more `unsupported` default instances of them. (I thought we could get away with one class for both, but sadly that is not quite the case: `LocalBinaryCacheStore` and `S3BinaryCacheStore` implement the former but the latter.) `require<StoreSubClass` should only be used in "entry point" code, like the UI or protocol handlers. That means the usage we made in `misc.cc` is no good. That will be fixed in the next commit.
As remarked in the previous commit, it is bad to call `require` except for on the boundary of the code base, yet we were in `Store::computeFSClosure.` The solution is to have more methods instead of the `flipDirection parameter. The referrers not reference methods are moved to `ReferrersStore`. This solves the issue.
8cdccbb
to
62ef024
Compare
Motivation
More progress on issue #5729
queryAllValidPaths
andqueryReferrers
were two methods that failingunsupported
default implementation. This is not type safe. Now, those methods are in their own classes, and there is no moreunsupported
default instances of them.computeFSClosure
withflipDirection = true
also exposes the concept of referrers (and its default implementation usesqueryReferrers
) so I moved it toReferrersStore
. That is;computeFSClosure
now no longer takes theflipDirection
argument, andReferrersStore
has acomputeFSCoClosure
method.Context
(I thought we could get away with one class for both, but sadly that is not quite the case:
LocalBinaryCacheStore
andS3BinaryCacheStore
implement the former but the latter.)Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.sh
src/*/tests
tests/nixos/*
Priorities
Add 👍 to pull requests you find important.