layotto
layotto copied to clipboard
feat: add sequencer api component with snowflake algorithm
What this PR does: add snowflake sequencer
- [x] mysql
- [x] ringbuffer
- [x] uidgenerator
Which issue(s) this PR fixes:
Fixes #193
Codecov Report
Base: 60.55% // Head: 60.69% // Increases project coverage by +0.14%
:tada:
Coverage data is based on head (
301b3c1
) compared to base (18ceced
). Patch coverage: 66.08% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## main #767 +/- ##
==========================================
+ Coverage 60.55% 60.69% +0.14%
==========================================
Files 135 137 +2
Lines 8815 9101 +286
==========================================
+ Hits 5338 5524 +186
- Misses 2823 2889 +66
- Partials 654 688 +34
Impacted Files | Coverage Δ | |
---|---|---|
...ponents/sequencer/snowflake/snowflake_sequencer.go | 65.88% <65.88%> (ø) |
|
components/sequencer/snowflake/snowflake.go | 66.16% <66.16%> (ø) |
|
components/lock/zookeeper/zookeeper_lock.go | 54.38% <0.00%> (-5.27%) |
:arrow_down: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@OOOOlh There are several issues that need to be resolved:
- The function name and important steps should be commented
- I see that you have defined a lot of parameters, you also should explain it
- The test is not enough, there is only one simple test now, you need to add some more. For example: multi-concurrency, recovery in case of errors, etc.
If you are done coding, remove [WIP]
.
@ZLBer got it
I will add more unit tests.
@OOOOlh hi, Have you done integration test? i mean, real using mysql to generate many many snowflake sequence and check the correctness of sequence
@ZLBer yes, it can produce increasing uid correctly
@OOOOlh hi,bro, after you fix the issues, remember to tell me.
@seeflood help review this pr, pls
@ZLBer Please review again 😘