Skip to content

kvs: apply C++ idiom and class layout rules - #566

Merged
vinodreddy-g merged 1 commit into
eclipse-score:mainfrom
qorix-group:arkjedrz_style-04-idioms
Oct 28, 2026
Merged

vinodreddy-g merged 1 commit into
eclipse-score:mainfrom
qorix-group:arkjedrz_style-04-idioms

Conversation

@arkjedrz

@arkjedrz arkjedrz commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
  • Brace-initialize declarations. Count/value constructors and initializer_list types keep parentheses.
  • Declare one variable per declaration.
  • Order class sections and members as the style guide requires and add the KvsValue::ValueType alias.
  • Initialize InstanceId, SnapshotId and KvsValue members in the initializer list.
  • Define members in .cpp files in declaration order and group file-local helpers at the top.
  • Name repeated file suffixes and the hash size.

Merge #564 first.

Relates to #556

@arkjedrz arkjedrz self-assigned this Oct 22, 2026
@arkjedrz
arkjedrz deployed to workflow-approval October 22, 2026 12:56 — with GitHub Actions Active
@arkjedrz
arkjedrz deployed to workflow-approval October 22, 2026 12:56 — with GitHub Actions Active
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Starting local Bazel server (8.7.0) and connecting to it...
INFO: Invocation ID: 4f24fd00-1a0f-4c65-b74c-6566e1d4ccdb
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 2 packages loaded
Loading: 2 packages loaded
    currently loading: 
Loading: 2 packages loaded
    currently loading: 
Loading: 2 packages loaded
    currently loading: 
Loading: 2 packages loaded
    currently loading: 
Loading: 2 packages loaded
    currently loading: 
Loading: 2 packages loaded
    currently loading: 
Analyzing: target //:license-check (3 packages loaded, 0 targets configured)
Analyzing: target //:license-check (3 packages loaded, 0 targets configured)

Analyzing: target //:license-check (30 packages loaded, 14 targets configured)

Analyzing: target //:license-check (98 packages loaded, 14 targets configured)

Analyzing: target //:license-check (99 packages loaded, 14 targets configured)

Analyzing: target //:license-check (100 packages loaded, 14 targets configured)

Analyzing: target //:license-check (100 packages loaded, 14 targets configured)

Analyzing: target //:license-check (150 packages loaded, 2718 targets configured)

Analyzing: target //:license-check (200 packages loaded, 4772 targets configured)

Analyzing: target //:license-check (202 packages loaded, 9919 targets configured)

Analyzing: target //:license-check (207 packages loaded, 11383 targets configured)

Analyzing: target //:license-check (207 packages loaded, 11383 targets configured)

Analyzing: target //:license-check (208 packages loaded, 11785 targets configured)

INFO: Analyzed target //:license-check (213 packages loaded, 17903 targets configured).
[1 / 1] no actions running
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
INFO: From Generating Dash formatted dependency file ...:
INFO: Successfully converted 50 packages from Cargo.lock to bazel-out/k8-fastbuild/bin/tools/formatted.txt
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
[15 / 16] Building tools/license.check.license_check.jar (); 0s disk-cache, multiplex-worker
INFO: Found 1 target...
Target //tools:license.check.license_check up-to-date:
  bazel-bin/tools/license.check.license_check
  bazel-bin/tools/license.check.license_check.jar
INFO: Elapsed time: 105.690s, Critical Path: 2.83s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/tools/license.check.license_check tools/formatted.txt <args omitted>
[main] INFO Querying Eclipse Foundation for license data for 42 items.
[main] INFO Found 32 items.
[main] INFO Querying ClearlyDefined for license data for 10 items.
[main] INFO Found 10 items.
[main] INFO License information could not be automatically verified for the following content:
[main] INFO 
[main] INFO crate/cratesio/-/lazy_static/1.5.1
[main] INFO 
[main] INFO This content is either not correctly mapped by the system, or requires review.

@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-566: https://eclipse-score.github.io/persistency/pr-566/

Comment thread score/kvs/kvs.cpp Outdated
return total_size;
}

score::Result<void> Kvs::write_temp_file(const score::filesystem::Path& path,

@Ahmed-Elsaka-JC Ahmed-Elsaka-JC Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[non blocking] when you refactor function keep it in same location , do not update function adn change it's location in oneshot that makes review not easy.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's not random, it's part of the change.
- Order class sections and members as the style guide requires.

Comment thread score/kvs/kvs.cpp
return {};
}

score::Result<score::filesystem::Path> Kvs::KvsFilePath(const SnapshotId& snapshot_id) const noexcept

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this function returns file name and old name was get_kvs_filename why did you change it ??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  • Alignment with Rust implementation.
  • No rules on that in the guidelines.
  • It's not really a getter, as those methods construct the path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this function returns file name , not file path , i would recommend to adjust rust name instead of c++ name to misleading name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Both KvsFilePath and HashFilePath work the same way.
Functions return file paths, that are created by taking filename_prefix_, then appending snapshot ID, then extension.
If such file doesn't exist, then an error is returned.
filename_prefix_ is set in Kvs::Open, and it's a working directory with kvs_, instance ID and a _ appended.

With Rust there are two separate methods: *_file_path and *_file_name.

  • *_file_path returns full path (working dir + file name).
  • *_file_name returns file name (so kvs_<instance_id>_<snapshot_id>.<extension>.

Comment thread score/kvs/kvs.cpp
}

for (const char* extension : file_extensions)
score::Result<score::filesystem::Path> Kvs::HashFilePath(const SnapshotId& snapshot_id) const noexcept

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why did you rename it form get_hash_filename to HathFilePath ??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  • Alignment with Rust implementation.
  • No rules on that in the guidelines.
  • It's not really a getter, as those methods construct the path.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

again , this function returns hash file name not full path .

@arkjedrz
arkjedrz force-pushed the arkjedrz_style-04-idioms branch from e086807 to 5179e8f Compare October 28, 2026 12:43
@arkjedrz
arkjedrz deployed to workflow-approval October 28, 2026 12:43 — with GitHub Actions Active
@arkjedrz
arkjedrz deployed to workflow-approval October 28, 2026 12:43 — with GitHub Actions Active

@Ahmed-Elsaka-JC Ahmed-Elsaka-JC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGFM

- Brace-initialize declarations. Count/value constructors and
  initializer_list types keep parentheses.
- Declare one variable per declaration.
- Order class sections and members as the style guide requires.
  Move the KvsValue::ValueVariant alias next to Array and Object.
- Initialize InstanceId, SnapshotId and KvsValue members in the
  initializer list.
- Define members in .cpp files in declaration order and group
  file-local helpers at the top.
- Name repeated file suffixes and the hash size.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@arkjedrz
arkjedrz force-pushed the arkjedrz_style-04-idioms branch from 5179e8f to 980a361 Compare October 28, 2026 15:00
@arkjedrz
arkjedrz deployed to workflow-approval October 28, 2026 15:00 — with GitHub Actions Active
@arkjedrz
arkjedrz deployed to workflow-approval October 28, 2026 15:00 — with GitHub Actions Active
@vinodreddy-g
vinodreddy-g added this pull request to the merge queue Oct 28, 2026
Merged via the queue into eclipse-score:main with commit 2bfa2f1 Oct 28, 2026
19 checks passed
@vinodreddy-g
vinodreddy-g deleted the arkjedrz_style-04-idioms branch October 28, 2026 15:35

This branch was successfully deployed

1 active deployment
workflow-approval — 980a3611 Deployed Oct 28, 2026 by arkjedrz via qnx-build (score-qnx-aarch64) / approval #1563
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