-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add SQLite support #9
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
skatkov
reviewed
Jan 3, 2024
This is very (and i mean _very_ WIP - but yes)
… On 3 Jan 2024, at 13:50, Stanislav (Stas) Katkov ***@***.***> wrote:
should we maybe figure out autoloading or selectively require those?
|
Since we need the model class anyway - let's pass it into the DB implementation
There is a bit I don't like that much - that we create one |
although I must admit I don't like them all that much
skatkov
reviewed
Jan 8, 2024
skatkov
reviewed
Jan 8, 2024
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.
Allow Pecorino throttles and leaky buckets to be defined using SQLite. Note that it is not the SQLite "time" value that we use, but the Ruby value - it has a finer resolution and is easier to work with, and should be harmless since SQLite is in-process anyway.
The same could potentially be done with SQLite date and time functions, but I found them very hard to work with for getting time intervals - and the best resolution I could obtain was milliseconds, whereas Pecorino benefits from time resolution being finer than that.
The change moves the DB statements used into separate modules, one per DB. Since we only got 2 now I opted for inheritance in tests - to avoid duplication. Once we get a third one in we might switch to using a module.
Closes #4