-
Notifications
You must be signed in to change notification settings - Fork 387
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
cmd/segment-reaper: Implement bitmask type #3626
Conversation
Define a bitmask type for implementing its logic to detect if an index is set or not.
|
||
// Count returns the number of tracked indexes. | ||
func (mask *bitmask) Count() int { | ||
return bits.OnesCount64(uint64(*mask)) |
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.
Fantastic! I didn't know there is a built-in library with efficient algorithms for this kind of operations.
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.
Nice! I'm just wondering if this shouldn't be placed somewhere in private
package but we can move it later.
Currently, the I'd prefer to move it when we have the need of using the type in other packages considering that refactoring tasks won't be that much. |
* storj/master: (63 commits) web/satellite: token payments logic (#3581) satellite/metainfo: reduce pointerDB access for CommitObject (#3589) satellite/metainfo: Fix misspelling in comment (#3636) argon2: choose a steady parallelism value (#3630) satellitedb: add support to testplanet for cockroachdb (#3634) satellite/console/auth: return in error handle added (#3639) Make sed a little more cross platformable (#3629) web: ms edge support bug fixed (#3638) web/satellite: registration/welcome message fixed, usage-report url fixed, storj-sim fixed (#3622) web/satellite: fonts changed to Inter (#3620) storagenode/updater: read identity location from storagenode's config.yaml (#3607) cmd/segment-reaper: Implement bitmask type (#3626) storagenode/gracefulexit: improve logging (#3633) private/testplanet: add a mock referral manager server into testplanet (#3631) satellite/gracefulexit: refactor concurrency (#3624) pkg/pb/referralmanager: update to add satellite ID to Get Tokens request (#3625) satellite/metainfo: improve Loop comments (#3595) storagenode: add bandwidth metrics (#3623) satellite/console: Add security headers (#3615) satellite/payments: token deposit accept cents (#3628) ...
Define a bitmask type for implementing its logic to detect if an index is set or not.
What: Define a bitmask type.
Why: Because we want to encapsulate the logic around the bitmask segment index tracking.
Ticket: https://storjlabs.atlassian.net/browse/V3-3235
Please describe the tests: Created tests for the methods of the new type.
Please describe the performance impact: N/A
Code Review Checklist (to be filled out by reviewer)