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

refactor: Clio Config #1593

Merged

Conversation

PeterChen13579
Copy link
Collaborator

Add constraint + parse json into Config
Second part of refactoring Clio Config; First PR found here

Steps that are left to implement:

  • Replacing all the places where we fetch config values (by using config.valueOr/MaybeValue) to instead get it from Config Definition
  • Generate markdown file using Clio Config Description

@PeterChen13579 PeterChen13579 changed the title Refactor: Clio Config refactor: Clio Config Aug 12, 2024
@PeterChen13579 PeterChen13579 marked this pull request as draft August 12, 2024 02:03
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

Attention: Patch coverage is 79.29515% with 47 lines in your changes missing coverage. Please review.

Project coverage is 70.06%. Comparing base (49e9d5e) to head (09458df).
Report is 24 commits behind head on develop.

Files with missing lines Patch % Lines
src/util/newconfig/ConfigValue.hpp 59.57% 3 Missing and 16 partials ⚠️
src/util/newconfig/ConfigConstraints.hpp 72.72% 1 Missing and 8 partials ⚠️
src/util/newconfig/ConfigFileJson.cpp 86.66% 5 Missing and 3 partials ⚠️
src/util/newconfig/ConfigConstraints.cpp 82.35% 2 Missing and 4 partials ⚠️
src/util/newconfig/ConfigDefinition.cpp 85.18% 1 Missing and 3 partials ⚠️
src/util/newconfig/Array.cpp 95.23% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1593      +/-   ##
===========================================
+ Coverage    69.61%   70.06%   +0.45%     
===========================================
  Files          257      265       +8     
  Lines         9879    10175     +296     
  Branches      5457     5612     +155     
===========================================
+ Hits          6877     7129     +252     
- Misses        1588     1601      +13     
- Partials      1414     1445      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@PeterChen13579 PeterChen13579 marked this pull request as ready for review August 12, 2024 23:34
src/util/newconfig/Array.hpp Outdated Show resolved Hide resolved
src/util/newconfig/Array.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@cindyyan317 cindyyan317 left a comment

Choose a reason for hiding this comment

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

Maybe we can just use one general constraint to constraint the port range, api range, instead of creating different constraint for each usage. For logger channels and levels, we can use one constraint (like OneOf) . I saw the similarity between the config constraint and the input validators, worth to check if anything we can borrow from validators.

src/util/newconfig/ConfigDefinition.cpp Show resolved Hide resolved
src/util/newconfig/ConfigDefinition.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigDefinition.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigDefinition.cpp Show resolved Hide resolved
src/util/newconfig/ConfigFileJson.hpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigValue.hpp Show resolved Hide resolved
src/util/newconfig/ConfigValue.hpp Show resolved Hide resolved
src/util/newconfig/ConfigValue.hpp Show resolved Hide resolved
src/util/newconfig/Errors.hpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigFileInterface.hpp Outdated Show resolved Hide resolved
src/util/newconfig/Array.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Outdated Show resolved Hide resolved
tests/unit/util/newconfig/ConfigValueTests.cpp Outdated Show resolved Hide resolved
tests/unit/util/newconfig/ConfigValueTests.cpp Outdated Show resolved Hide resolved
tests/unit/util/newconfig/JsonFileTests.cpp Outdated Show resolved Hide resolved
tests/unit/util/newconfig/JsonFileTests.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@godexsoft godexsoft left a comment

Choose a reason for hiding this comment

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

Leaving a few nits and findings. Good progress 👍

src/util/newconfig/ConfigConstraints.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigFileJson.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigFileJson.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigFileJson.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigFileJson.cpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigValue.hpp Outdated Show resolved Hide resolved
@PeterChen13579
Copy link
Collaborator Author

PeterChen13579 commented Sep 11, 2024

@godexsoft Just a heads-up: I removed the uint64 constraint since, in the places where it's used, the user only inputs a number in the thousands, and we multiply that number by a constant. Therefore, I really don't think the uint64 constraint is necessary

Copy link
Collaborator

@godexsoft godexsoft left a comment

Choose a reason for hiding this comment

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

Looks good! just a few more tiny things to verify 👍

src/util/newconfig/ConfigConstraints.hpp Outdated Show resolved Hide resolved
src/util/newconfig/ConfigConstraints.hpp Show resolved Hide resolved
@PeterChen13579 PeterChen13579 enabled auto-merge (squash) September 18, 2024 18:15
@PeterChen13579 PeterChen13579 merged commit af4fde9 into XRPLF:develop Sep 19, 2024
17 checks passed
kuznetsss pushed a commit that referenced this pull request Sep 25, 2024
Add constraint + parse json into Config
Second part of refactoring Clio Config; First PR found
[here](#1544)

Steps that are left to implement:
- Replacing all the places where we fetch config values (by using
config.valueOr/MaybeValue) to instead get it from Config Definition
- Generate markdown file using Clio Config Description
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.

4 participants