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

feat: Add P Counter CRDT #2482

Merged

Conversation

fredcarle
Copy link
Collaborator

Relevant issue(s)

Resolves #2116

Description

This PR adds a Positive Counter CRDT type. It converts the PNCounter implementation to a Counter implementation that supports both PN and P counters.

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

make test

Specify the platform(s) on which this was tested:

  • MacOS

@fredcarle fredcarle added feature New feature or request area/crdt Related to the (Merkle) CRDT system labels Apr 2, 2024
@fredcarle fredcarle added this to the DefraDB v0.11 milestone Apr 2, 2024
@fredcarle fredcarle requested a review from a team April 2, 2024 19:40
@fredcarle fredcarle self-assigned this Apr 2, 2024
Copy link

codecov bot commented Apr 2, 2024

Codecov Report

Attention: Patch coverage is 82.45614% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 75.59%. Comparing base (9938518) to head (916729d).

❗ Current head 916729d differs from pull request most recent head 204fdc9. Consider uploading reports for the commit 204fdc9 to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2482      +/-   ##
===========================================
- Coverage    75.66%   75.59%   -0.08%     
===========================================
  Files          291      291              
  Lines        28072    28086      +14     
===========================================
- Hits         21240    21229      -11     
- Misses        5478     5498      +20     
- Partials      1354     1359       +5     
Flag Coverage Δ
all-tests 75.59% <82.46%> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
client/ctype.go 93.55% <100.00%> (+0.44%) ⬆️
core/crdt/errors.go 33.33% <100.00%> (-16.67%) ⬇️
db/base/collection_keys.go 84.62% <100.00%> (ø)
request/graphql/schema/types/types.go 100.00% <ø> (ø)
merkle/crdt/counter.go 68.42% <85.71%> (ø)
merkle/crdt/merklecrdt.go 88.37% <85.71%> (+0.57%) ⬆️
core/crdt/counter.go 55.86% <77.78%> (ø)

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9938518...204fdc9. Read the comment docs.

Copy link
Member

@shahzadlone shahzadlone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Praise: Nice tests

Mostly questions. Looks good in first pass

merkle/crdt/merklecrdt.go Outdated Show resolved Hide resolved
tests/integration/mutation/update/crdt/pcounter_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@islamaliev islamaliev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just have a few minor comments

@fredcarle fredcarle force-pushed the fredcarle/feat/i2116-p-counter branch from c7a8713 to 916729d Compare April 3, 2024 15:28
@fredcarle fredcarle force-pushed the fredcarle/feat/i2116-p-counter branch from 916729d to 204fdc9 Compare April 8, 2024 16:34
@fredcarle fredcarle merged commit 4811ba9 into sourcenetwork:develop Apr 8, 2024
26 of 28 checks passed
@fredcarle fredcarle deleted the fredcarle/feat/i2116-p-counter branch April 8, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/crdt Related to the (Merkle) CRDT system feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

P Counter CRDT
3 participants