-
Notifications
You must be signed in to change notification settings - Fork 23
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
V1 prototype #53
base: master
Are you sure you want to change the base?
V1 prototype #53
Conversation
acc58c1
to
240f3de
Compare
d99b82b
to
01d5ecc
Compare
There was a discussion at caddyserver/caddy#6097 about these upcoming changes. Given our hard experience with Badger (see linked thread) and the transitive dependencies each driver/database pulls, do you think it's possible to break the drivers from the core? Something akin to what the |
With this implementation, the drivers are broken from the core. For example, unless you This however, doesn't mean that you won't end up getting the transitive dependencies. To avoid that, we'd have to convert each driver directory in their own Go module (an option I don't believe we're willing to consider) or extract each driver into their own repo/package (e.x. Your suggestion/request isn't unreasonable, and something that personally I'd like to see addressed, so I'll try to see where the team stands on and take it from there. Hope this helps. |
Thank you for the consideration! I understand the maintenance burden. I'll keep an eye on here 🙂 |
internal/token/token.go
Outdated
// If bucket is set, then the returned value will be utf-8 valid and not contain the zero byte. | ||
func New(t *testing.T, minSize, maxSize int, bucket bool) (tok []byte) { | ||
if minSize == maxSize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit surprising to see the testing
package being used in a package that doesn't look like a test or a test utility package (from a quick skim). I supposed this is used as a test utility?
Also:
// If bucket is set, then the returned value will be utf-8 valid and not contain the zero byte. | |
func New(t *testing.T, minSize, maxSize int, bucket bool) (tok []byte) { | |
if minSize == maxSize { | |
// If bucket is set, then the returned value will be utf-8 valid and not contain the zero byte. | |
func New(t *testing.T, minSize, maxSize int, bucket bool) (tok []byte) { | |
t.Helper() | |
if minSize == maxSize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing surprising here, it's an internal package, used by tests exclusively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proving my point, it is surprising, because it's not clear for someone seeing this code for the first time that it's only used in tests. It would be clear(er) if this were in something like testutils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I avoided a generic testutils
package. I left the token package just for drivers that may want to generate a token in order to test something.
I'd hate to be demanding, but can you at least put badger behind a build tag 🙂 |
Since this PR has been open for quite a while, I'd like to just comment that the plan for it is to be merged. There's internal issues, so we've paused the merge for the time being. |
If you don't
then you don't end up building badger libs. You may add your own build tag in the calling program that decides whether to add said import or not to your builds. Won't that work for you, @mohammed90? |
Oh, I missed that. That is not bad, and works. I was hoping it'd be feasible to de-bundle the storage drivers themselves so they don't end up being transitive deps downstream. The discussion in caddyserver/caddy#6613 (comment) shows another need for slimming the dep tree. I tried my hand at making them more like |
This PR contains an ambitious prototype that aims to serve as the foundation of the next major version of this package.
This iteration tries to ensure that the behavior of the package is consistent across the different data stores we aim to support. In order to achieve this, this implementation enforces validations against the 3 different types of tokens (buckets, keys & values).
Any literal may be considered a valid bucket if it:
Similarly, any literal may be considered a valid key if it:
And, finally, any literal may be considered a valid value if it:
Because of the above, and disregarding the expansion of most functions to also accept a Context, this implementation would only be backwards compatible in scenarios where the above constraints were already respected (even accidentally).