Skip to content

Conversation

@marcoSanti
Copy link
Member

@marcoSanti marcoSanti commented Dec 12, 2025

This pull request refactors the CAPIO server logic responsible for handling the storage of files by introducing a dedicated StorageManager class. This centralizes all file storage management into a single, modular unit.

Key Changes:

  • Introduced StorageManager: All CAPIO server logic related to files and directories storage has been moved into the new StorageManager class.
  • Simplified storage logic: The internal storage structure has been streamlined for clarity and efficiency.
  • New Access Methods: Added get and tryGet methods for accessing stored items, including an overload that uses a thread ID (tid) and file descriptor (fd) pair. Class methods have also been renamed to better reflect the naming scheme used in CAPIO classes.
  • Error Handling Conformity: Updated error handling to use ERR_EXIT instead of exceptions (throws), ensuring consistency with CAPIO's standard error reporting conventions.
  • Includes general cleanup and documentation updates.

@marcoSanti marcoSanti marked this pull request as draft December 12, 2025 16:03
@marcoSanti marcoSanti force-pushed the storage-service branch 2 times, most recently from 98bb3b1 to d07097c Compare December 12, 2025 16:16
@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

❌ Patch coverage is 69.81132% with 80 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.06%. Comparing base (84bfd83) to head (a27cfda).

Files with missing lines Patch % Lines
capio/server/src/storage_manager.cpp 84.70% 16 Missing and 10 partials ⚠️
capio/server/include/remote/handlers/read.hpp 0.00% 16 Missing ⚠️
capio/server/include/handlers/read.hpp 33.33% 10 Missing ⚠️
capio/server/include/handlers/getdents.hpp 25.00% 9 Missing ⚠️
capio/server/include/handlers/seek.hpp 16.66% 5 Missing ⚠️
capio/server/include/remote/handlers/stat.hpp 0.00% 4 Missing ⚠️
capio/server/include/remote/requests.hpp 0.00% 4 Missing ⚠️
capio/server/include/handlers/stat.hpp 40.00% 2 Missing and 1 partial ⚠️
capio/server/include/handlers/rename.hpp 50.00% 0 Missing and 1 partial ⚠️
capio/server/include/handlers/write.hpp 80.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #197      +/-   ##
==========================================
- Coverage   56.34%   56.06%   -0.29%     
==========================================
  Files          71       70       -1     
  Lines        3429     3439      +10     
  Branches     2126     2132       +6     
==========================================
- Hits         1932     1928       -4     
- Misses        578     1232     +654     
+ Partials      919      279     -640     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marcoSanti marcoSanti force-pushed the storage-service branch 2 times, most recently from 64ac63c to 2bdbaa7 Compare December 13, 2025 16:38
@marcoSanti marcoSanti marked this pull request as ready for review December 13, 2025 17:58
@marcoSanti marcoSanti changed the title Introduction of StorageService class Introduction of StorageManager class Dec 13, 2025
* @return `0` if the directory was added/updated, `1` if it already exists and no action was
* taken.
*/
off64_t addDirectory(pid_t tid, const std::filesystem::path &path);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why there is a generic add function and a specialized addDirectory function?

Copy link
Member Author

@marcoSanti marcoSanti Dec 23, 2025

Choose a reason for hiding this comment

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

When adding directories, extra steps need to be done compared to simply adding a file. The generic add is used to add a new entry in the storage manager, and when calling the addDirectory, extra steps are performed, which are not usually performed when adding a file.

Moreover, changing to have a single add method, would require to refactor not only method calls naming within the capio_server, but also the logic of the various handlers around capio.

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