Skip to content
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

Merged
merged 6 commits into from
Nov 22, 2019

Conversation

ifraixedes
Copy link
Member

@ifraixedes ifraixedes commented Nov 21, 2019

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)

  • NEW: Are there any Satellite database migrations? Are they forwards and backwards compatible?
  • Does the PR describe what changes are being made?
  • Does the PR describe why the changes are being made?
  • Does the code follow our style guide?
  • Does the code follow our testing guide?
  • Is the PR appropriately sized? (If it could be broken into smaller PRs it should be)
  • Does the new code have enough tests? (every PR should have tests or justification otherwise. Bug-fix PRs especially)
  • Does the new code have enough documentation that answers "how do I use it?" and "what does it do?"? (both source documentation and higher level, diagrams?)
  • Does any documentation need updating?
  • Do the database access patterns make sense?

Define a bitmask type for implementing its logic to detect if an index
is set or not.
@ifraixedes ifraixedes self-assigned this Nov 21, 2019
@cla-bot cla-bot bot added the cla-signed label Nov 21, 2019
@ifraixedes ifraixedes added Request Code Review Code review requested Reviewer Can Merge If all checks have passed, non-owner can merge PR labels Nov 21, 2019
@ifraixedes ifraixedes marked this pull request as ready for review November 21, 2019 12:05
@ifraixedes ifraixedes requested a review from a team November 21, 2019 12:05
@ghost ghost requested review from isaachess and zeebo and removed request for a team November 21, 2019 12:05

// Count returns the number of tracked indexes.
func (mask *bitmask) Count() int {
return bits.OnesCount64(uint64(*mask))
Copy link
Member

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.

Copy link
Contributor

@mniewrzal mniewrzal left a 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.

@ifraixedes
Copy link
Member Author

Nice! I'm just wondering if this shouldn't be placed somewhere in private package but we can move it later.

Currently, the bitmask type is unexported, so moving to private won't benefit in anything.

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.

@ifraixedes ifraixedes merged commit 77d4add into master Nov 22, 2019
@ifraixedes ifraixedes deleted the orange/segment-reaper-bitmask branch November 22, 2019 10:53
bryanchriswhite added a commit that referenced this pull request Nov 25, 2019
* 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)
  ...
bryanchriswhite pushed a commit to bryanchriswhite/storj that referenced this pull request Oct 29, 2020
Define a bitmask type for implementing its logic to detect if an index
is set or not.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed Request Code Review Code review requested Reviewer Can Merge If all checks have passed, non-owner can merge PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants