Refactor store/datastore with common interfaces and helpers#1403
Closed
the-glu wants to merge 1 commit intointeruss:masterfrom
Closed
Refactor store/datastore with common interfaces and helpers#1403the-glu wants to merge 1 commit intointeruss:masterfrom
the-glu wants to merge 1 commit intointeruss:masterfrom
Conversation
the-glu
commented
Mar 31, 2026
the-glu
commented
Mar 31, 2026
the-glu
commented
Mar 31, 2026
the-glu
commented
Mar 31, 2026
| base, err := datastore.NewBaseStore(ctx, db, flags.ConnectParameters().MaxRetries, func(q dssql.Queryable) repos.Repository { | ||
| return &repo{ | ||
| Queryable: q, | ||
| clock: s.Clock, |
Contributor
Author
There was a problem hiding this comment.
NB: Tests want to overwrite that, so we create the store, use a pointer there and add the basestore later..
the-glu
commented
Mar 31, 2026
the-glu
commented
Mar 31, 2026
the-glu
commented
Mar 31, 2026
the-glu
commented
Mar 31, 2026
| scdV1Server, err = createSCDServer(ctx, logger) | ||
| if err != nil { | ||
| ridV1Server.Cron.Stop() | ||
| ridV2Server.Cron.Stop() |
Contributor
Author
There was a problem hiding this comment.
'Hidden' changes: crons that print stats are not stopped anymore if scd fails, but I didn't find a real purpose for that (since it's going to stop anyways)
the-glu
commented
Mar 31, 2026
This was referenced Mar 31, 2026
Contributor
Author
|
Moved to smaller PRs |
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.
This PR refactor the store / datastore system into common interfaces and helpers.
(Badly) duplicated code has been removed and everything is now normalized.
There are a few remarks / side effects, noted directly in comments.
Quick summary of changes:
[db]/store/store.go) moved to a generic one, old one just use the common.pkg/datastore/store.gothat handle all generic part of old stores (e.g creation,Interact/Transact). What is left in[db]/datatore/store.gois special elements (eg. the config flag for scd, Cleanup) and call to BaseStorepkg/datastoreutils/dial.gothat create data stores in a generic way for all DB. Replace all store creation that where incore-service/db-manager(and different in both cases).The rest is unchanged, this don't redo the whole system but improve the current one.