Introduce data store abstraction layer#1
Open
tomjaguarpaw wants to merge 33 commits into
Open
Conversation
Owner
Author
|
OK, now updated to deal with that. |
tomjaguarpaw
force-pushed
the
abstraction
branch
2 times, most recently
from
July 14, 2026 18:53
c3d45b7 to
104378b
Compare
tomjaguarpaw
force-pushed
the
abstraction
branch
from
July 14, 2026 18:58
104378b to
85ab3aa
Compare
The former returns a smaller result.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are conflicting opinions about whether an incremental rewrite of
hackage-serveris feasible (see Expressed opinions). This PR starts moving in one possible direction by abstracting out the functions that deal with theacid-statedata store. Specifically, for a subset (see Subset) ofhackage-server's components it does the following:<component>StateComponentfunction into the component'sAcidmoduleBackendandStoreBackendfrom the existing acid-state implementation in a function calledacidStoreThis PR is a pure refactoring with no change in behaviour. It seems to me that after this refactoring we could, for each component in the subset, subsequently swap out
acid-stateas the data store and replace it, with, for example, Postgres, by defining an appropriate value of typeBackend. I'm not sure that would get us to "good design" but as far as I can tell it would work.The branch is structured as a sequence of trivial refactoring commits.
Is there something I've missed that makes this approach unviable?
I would welcome any clear explanation of why this approach is unviable, because I don't understand why yet. If it is unviable then it will be very helpful to have an explanation written down clearly.
Specific improvement example
This replaces several direct uses of the following, where consumers first fetch the entire package index and then operate on a smaller piece of it:
with these new fields of
CoreFeature, which only return the subset of the package index actually required to implement a particular piece of functionality:backed by the following fields of the Core
Store:The current acid-state implementation defines these in terms of its existing
PackageIndex, but consumers no longer need to fetch the wholePackageIndexjust to perform package-name lookup, package-id lookup, or latest-version-per-package selection. A future alternativeBackendcould take advantage of these new methods to load less into memory.In particular, I am more optimistic than the "Why Incremental Refactoring is not Feasible" section of the Modernising Hackage Server proposal.
Subset
This PR deals with these components:
AnalyticsPixels,Core,HaskellPlatform,Mirror,TarIndexCache,VotesExpressed opinions
For example:
qnikst haskellfoundation/tech-proposals#67 (comment)
dcoutts haskellfoundation/tech-proposals#67 (comment)