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

Support unsigned numeric config #1546

Open
wants to merge 3 commits into
base: unstable
Choose a base branch
from

Conversation

artikell
Copy link
Contributor

  • Supports VALKEYMODULE_CONFIG_UNSIGNED and UNSIGNED_CONFIG for a wider range of configurations.
  • Supported the API for ValkeyModule_RegisterUnsignedNumericConfig
  • string2ull method supports the length parameter, making it more secure

Copy link

codecov bot commented Jan 12, 2025

Codecov Report

Attention: Patch coverage is 22.80702% with 44 lines in your changes missing coverage. Please review.

Project coverage is 70.90%. Comparing base (e60990e) to head (87709c2).
Report is 5 commits behind head on unstable.

Files with missing lines Patch % Lines
src/config.c 24.13% 22 Missing ⚠️
src/module.c 4.34% 22 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1546      +/-   ##
============================================
+ Coverage     70.77%   70.90%   +0.13%     
============================================
  Files           120      120              
  Lines         65005    65108     +103     
============================================
+ Hits          46005    46165     +160     
+ Misses        19000    18943      -57     
Files with missing lines Coverage Δ
src/db.c 89.48% <100.00%> (ø)
src/server.h 100.00% <ø> (ø)
src/t_stream.c 93.12% <100.00%> (ø)
src/util.c 71.79% <100.00%> (ø)
src/config.c 77.38% <24.13%> (-1.02%) ⬇️
src/module.c 9.55% <4.34%> (-0.02%) ⬇️

... and 16 files with indirect coverage changes

Signed-off-by: artikell <[email protected]>
Signed-off-by: skyfirelee <[email protected]>
@madolson
Copy link
Member

Is there a concrete need for this, or are you just looking to make the API more usable by extending the use cases? We had discussed previously in Redis, and had decided to avoid having a large number of APIs, we would only support signed until someone indicated they clearly needed a 64 bit unsigned value. You can always restrict the value to be positive and cast it to unsigned (but just miss some of the high values).

@artikell
Copy link
Contributor Author

Is there a concrete need for this, or are you just looking to make the API more usable by extending the use cases? We had discussed previously in Redis, and had decided to avoid having a large number of APIs, we would only support signed until someone indicated they clearly needed a 64 bit unsigned value. You can always restrict the value to be positive and cast it to unsigned (but just miss some of the high values).

Yes, we encountered some scenarios.

In some designs, uint64 is used as the ID, and the higher bits are used to store some information.
Logically, use creatULongLongConfig to manage configurations.

However, for the creatULongLongConfig method, it can only exceed ULLONG_MAX in the MEMORY_CONFIG configuration item. so, I think we need a configuration to support a larger range.

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.

2 participants