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

Implement JsonCounter and change CrdtCounter structure #49

Merged
merged 5 commits into from
Nov 21, 2022
Merged

Conversation

7hong13
Copy link
Contributor

@7hong13 7hong13 commented Nov 18, 2022

What this PR does / why we need it?

Implemented JsonCounter and changed CrdtCounter a bit.
(more test code to be added on JsonCounter)

Any background context you want to provide?

changes on CrdtCounter

  • Double type is not supported.
  • Int and Long overflow is allowed.
  • the counterType is determined right after its creation and cannot be changed.

What are the relevant tickets?

Fixes #

Checklist

  • Added relevant tests or not required
  • Didn't break anything

@7hong13 7hong13 self-assigned this Nov 18, 2022
@codecov
Copy link

codecov bot commented Nov 18, 2022

Codecov Report

Merging #49 (065126f) into main (cff5a7a) will increase coverage by 1.32%.
The diff coverage is 78.18%.

@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
+ Coverage   78.59%   79.92%   +1.32%     
==========================================
  Files          44       45       +1     
  Lines        1733     1758      +25     
  Branches      250      250              
==========================================
+ Hits         1362     1405      +43     
+ Misses        232      206      -26     
- Partials      139      147       +8     
Impacted Files Coverage Δ
...dev/yorkie/document/operation/IncreaseOperation.kt 71.42% <ø> (+35.71%) ⬆️
yorkie/src/main/kotlin/dev/yorkie/util/Trie.kt 100.00% <ø> (ø)
...src/main/kotlin/dev/yorkie/api/ElementConverter.kt 65.38% <44.44%> (+9.90%) ⬆️
...ain/kotlin/dev/yorkie/document/crdt/CrdtCounter.kt 95.12% <92.85%> (+1.24%) ⬆️
...ain/kotlin/dev/yorkie/document/json/JsonCounter.kt 93.33% <93.33%> (ø)
...ain/kotlin/dev/yorkie/document/json/JsonElement.kt 75.00% <100.00%> (+3.57%) ⬆️
...main/kotlin/dev/yorkie/document/json/JsonObject.kt 91.54% <100.00%> (+0.92%) ⬆️
...kotlin/dev/yorkie/document/json/JsonStringifier.kt 96.77% <0.00%> (+6.45%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -250,8 +248,10 @@ internal fun PBJsonElementSimple.toCrdtElement(): CrdtElement {
)
PBValueType.VALUE_TYPE_INTEGER_CNT,
PBValueType.VALUE_TYPE_DOUBLE_CNT,
PBValueType.VALUE_TYPE_LONG_CNT,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you meant to delete the double type here :)

@skhugh
Copy link
Contributor

skhugh commented Nov 21, 2022

since we are only allowing Int and Long for Counter, sanitized seems overcomplicated.
having two invokes for each input type seems to be the better choice now.

@7hong13 7hong13 marked this pull request as ready for review November 21, 2022 07:02
Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

@hackerwins hackerwins merged commit 3236af5 into main Nov 21, 2022
@hackerwins hackerwins deleted the counter branch November 21, 2022 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants