-
Notifications
You must be signed in to change notification settings - Fork 532
leakybucket: refactor queue handling to use an interface #3738
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
base: master
Are you sure you want to change the base?
Conversation
Refactored the ~Queue~ type to introduce a new ~LocalQueue~ implementation and updated all references to use the new interface. This change ensures better type safety and flexibility in queue operations. BREAKING CHANGE: The ~Queue~ type has been replaced with a new ~LocalQueue~ implementation, and a ~Queue~ interface has been introduced. This may require updates to any code directly interacting with the ~Queue~ type.
@sabban: There are no 'kind' label on this PR. You need a 'kind' label to generate the release automatically.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
@sabban: There are no area labels on this PR. You can add as many areas as you see fit.
DetailsI am a bot created to help the crowdsecurity developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository. |
/kind enhancement |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3738 +/- ##
==========================================
+ Coverage 60.68% 61.60% +0.91%
==========================================
Files 375 405 +30
Lines 41345 41578 +233
==========================================
+ Hits 25091 25613 +522
+ Misses 14179 13855 -324
- Partials 2075 2110 +35
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.2 to 3.29.4. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@181d5ee...4e828ff) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.29.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* enhance: Add averagetime function which allows to compute averagetime span * enhance: lint * enhance: Add median function and act on @mmetc feedback * enhance: NIT on tests * enhance: switch to []time.Time instead and handle using expr map which returns interfaces * enhance: Add a bunch of test cases * enhance: Rename *duration to *interval
--- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-version: 1.74.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
) Bumps [github.com/r3labs/diff/v2](https://github.com/r3labs/diff) from 2.14.1 to 2.15.1. - [Commits](r3labs/diff@v2.14.1...v2.15.1) --- updated-dependencies: - dependency-name: github.com/r3labs/diff/v2 dependency-version: 2.15.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* refactor without label * fix the deadlock
#3760) Bumps [github.com/alexliesenfeld/health](https://github.com/alexliesenfeld/health) from 0.8.0 to 0.8.1. - [Release notes](https://github.com/alexliesenfeld/health/releases) - [Changelog](https://github.com/alexliesenfeld/health/blob/main/CHANGELOG.md) - [Commits](alexliesenfeld/health@v0.8.0...v0.8.1) --- updated-dependencies: - dependency-name: github.com/alexliesenfeld/health dependency-version: 0.8.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.29.4 to 3.29.5. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@4e828ff...51f7732) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 3.29.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…#3764) Bumps [github.com/hashicorp/go-version](https://github.com/hashicorp/go-version) from 1.2.1 to 1.7.0. - [Release notes](https://github.com/hashicorp/go-version/releases) - [Changelog](https://github.com/hashicorp/go-version/blob/main/CHANGELOG.md) - [Commits](hashicorp/go-version@v1.2.1...v1.7.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/go-version dependency-version: 1.7.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…3763) Bumps [github.com/go-openapi/swag](https://github.com/go-openapi/swag) from 0.23.0 to 0.23.1. - [Commits](go-openapi/swag@v0.23.0...v0.23.1) --- updated-dependencies: - dependency-name: github.com/go-openapi/swag dependency-version: 0.23.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…3761) Bumps [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql) from 1.6.0 to 1.9.3. - [Release notes](https://github.com/go-sql-driver/mysql/releases) - [Changelog](https://github.com/go-sql-driver/mysql/blob/v1.9.3/CHANGELOG.md) - [Commits](go-sql-driver/mysql@v1.6.0...v1.9.3) --- updated-dependencies: - dependency-name: github.com/go-sql-driver/mysql dependency-version: 1.9.3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* feat: add swarm support to docker acquistion * format * merge issue * test issue * lint * enhance: extract some functions for @mmetc * test with regexp * enhance: Handle invalid regexp instead of panic and add some test cases * fix text + shorten error messages * enhance: Disable context check --------- Co-authored-by: marco <[email protected]> Co-authored-by: Sebastien Blot <[email protected]>
* clean up buckets serialization code
120 seconds may not be enough to download data files.
This was never used outside testing, should not impact anyone. If someone really used the feature, it's not compatible anyway with the previous version and they'll get an error at runtime.
* dry root check * dry plugin install * log info, warnings to stderr
* cscli setup: - remove redundant detect options, keep only --force and --ignore - use gopsutil instead of osinfo - it can recognize derived distributions - detect systemd units even if masked or disabled The goal is to detect what's installed and potentially configurable, regardless if it's running, temporary disabled or not yet configured * lint * rename UnitEnabled -> UnitInstalled * detect.yaml * change Path.Exists("/etc/...") -> Host.PlatformFamily == "..."
…are hard to read (#3791)
Bumps [docker/login-action](https://github.com/docker/login-action) from 3.4.0 to 3.5.0. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](docker/login-action@74a5d14...184bdaa) --- updated-dependencies: - dependency-name: docker/login-action dependency-version: 3.5.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…0.3 (#3769) Bumps [github.com/crowdsecurity/machineid](https://github.com/crowdsecurity/machineid) from 1.0.2 to 1.0.3. - [Commits](crowdsecurity/machineid@v1.0.2...v1.0.3) --- updated-dependencies: - dependency-name: github.com/crowdsecurity/machineid dependency-version: 1.0.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Refactored the ~Queue~ type to introduce a new ~LocalQueue~ implementation and updated all references to use the new interface. This change ensures better type safety and flexibility in queue operations. BREAKING CHANGE: The ~Queue~ type has been replaced with a new ~LocalQueue~ implementation, and a ~Queue~ interface has been introduced. This may require updates to any code directly interacting with the ~Queue~ type.
…to abstract/queue
- Updated go.mod to include valkey-go dependency - Replaced NewQueue with CreateQueue in types/queue.go for improved functionality - Updated leakybucket/bucket.go to use the new CreateQueue function with hash parameter
Refactored the Queue type to introduce a new Queue interface with a LocalQueue implementation and updated all references to use the new interface.
The old types.Queue is kept alive to be used in expr expressions, but only there.
For now, this PR definitely breaks the ability to load buckets from bucket state files, but I believe it wasn't in a workable state anyway. If it's worth it, I can write a Marshaller and Unmarshaller for the Leaky types to make the feature work again, if not I can clean all the state-related code. In the meantime, I even deactivated the state loading tests.
Once this PR is accepted and merged, it's possible to add a new backend for Queues.