-
Notifications
You must be signed in to change notification settings - Fork 137
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
metadb: split backends into packages, add metadb #151
Merged
Merged
Conversation
This file contains 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
The old structure was a single huge package with all the DB backends in it. Since tm-db users often want just one or two DB backends, and building plus linking all of them is very heavy, build tags were used to opt into some of the backends. This same mechanism is now in metadb, for those who want it; it allows opting into DB backends via build tags, without having to edit the code directly. Note that the old package included the memdb and goleveldb backends by default. The new metadb does not include any by default, to make backends explicit and more consistent. This required using more build tags in CI. Most users will want to statically use one DB implementation, without metadb. Each separate sub-package does just that. They are direct moves of the old code; the only major change is that constructors like db.NewBadgerDB are now called badger.NewDB, to avoid the repetition of badger.NewBadgerDB. The root package error types are also exported now, to allow being used by all separate packages. Note that this means they're now part of the public API too; this should be fine. Some test code also had to be shuffled around. All the tests which dealt with backends were moved to metadb. The shared test helper code had to be moved to an internal package, to remain reachable. Finally, note that we consistently use "tmdb" as the imported package name for the root package, since "db" is often used as a variable name. This prevents confusion and common build errors. Fixes #113.
Codecov Report
@@ Coverage Diff @@
## master #151 +/- ##
===========================================
- Coverage 68.78% 11.38% -57.41%
===========================================
Files 27 31 +4
Lines 1448 1309 -139
===========================================
- Hits 996 149 -847
- Misses 377 1127 +750
+ Partials 75 33 -42
|
tac0turtle
changed the title
metadb: ci fixes
metadb: split backends into packages, add metadb
Feb 11, 2021
melekes
approved these changes
Feb 11, 2021
So the tests pass here but not on master, will dig into it |
I think this change should have tag v0.7.0 |
you are correct! ill see if the tag is still around |
creachadair
added a commit
that referenced
this pull request
Nov 8, 2021
This reverts commit 71bc5d8.
creachadair
pushed a commit
that referenced
this pull request
Nov 9, 2021
authored-by: Daniel Martí <[email protected]>
creachadair
added a commit
that referenced
this pull request
Nov 9, 2021
This reverts commit 71bc5d8.
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.
The old structure was a single huge package with all the DB backends in
it. Since tm-db users often want just one or two DB backends, and
building plus linking all of them is very heavy, build tags were used to
opt into some of the backends.
This same mechanism is now in metadb, for those who want it; it allows
opting into DB backends via build tags, without having to edit the code
directly.
Note that the old package included the memdb and goleveldb backends by
default. The new metadb does not include any by default, to make
backends explicit and more consistent. This required using more build
tags in CI.
Most users will want to statically use one DB implementation, without
metadb. Each separate sub-package does just that. They are direct moves
of the old code; the only major change is that constructors like
db.NewBadgerDB are now called badger.NewDB, to avoid the repetition of
badger.NewBadgerDB.
The root package error types are also exported now, to allow being used
by all separate packages. Note that this means they're now part of the
public API too; this should be fine.
Some test code also had to be shuffled around. All the tests which dealt
with backends were moved to metadb. The shared test helper code had to
be moved to an internal package, to remain reachable.
Finally, note that we consistently use "tmdb" as the imported package
name for the root package, since "db" is often used as a variable name.
This prevents confusion and common build errors.
Fixes #113.
Thank you @mvdan for the contribution.