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

Add store providers to persistence module #251

Merged
merged 9 commits into from
Sep 5, 2024
Merged

Add store providers to persistence module #251

merged 9 commits into from
Sep 5, 2024

Conversation

dr-orlovsky
Copy link
Member

@dr-orlovsky dr-orlovsky commented Aug 9, 2024

This solves the problem with saving and restoring Stock and related persistence objects in a custom way.

If a client of the library want to use custom store and load procedures, it has to do the following:

  • create a custom type with all necessary information;
  • implement StoreProvider for with MemStash, MemState and MemIndex generics
  • implement StockStoreProvider for it

You can check how it is done in https://github.com/RGB-WG/rgb-std/compare/store?expand=1#diff-ad8cec98dd4a1dac3d2a20e6c7a9c3e64129a3182285b50e1e3df20da2c167c7 where PathBuf becomes such store provider for a local file. If somebody needs to use Amazon S3 for instance, they can wrap this PathBuf into a custom structure and use its methods when needed.

Two other related PRs:

@dr-orlovsky dr-orlovsky added epic Epic task covering multiple steps of implementation refactoring Code refactoring labels Aug 9, 2024
@dr-orlovsky dr-orlovsky added this to the v0.11.0 milestone Aug 9, 2024
@dr-orlovsky dr-orlovsky self-assigned this Aug 9, 2024
@will-bitlight
Copy link
Contributor

will-bitlight commented Aug 10, 2024

Dear Maxim, I have a colleague who is paying attention to this PR at any time and cooperating with the docking work of the client. You can replace him @Crayon-Shin-chan-1024 as reviewer, so that your design can have a better understanding with the downstream projects :)

@dr-orlovsky
Copy link
Member Author

Thank you for the suggestion! First, he needs to accept invitation to the org

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 4.81928% with 158 lines in your changes missing coverage. Please review.

Project coverage is 19.2%. Comparing base (91a3c41) to head (47e81b9).
Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
src/persistence/memory.rs 13.1% 53 Missing ⚠️
src/persistence/stock.rs 0.0% 48 Missing ⚠️
src/persistence/fs.rs 0.0% 42 Missing ⚠️
src/persistence/index.rs 0.0% 5 Missing ⚠️
src/persistence/stash.rs 0.0% 5 Missing ⚠️
src/persistence/state.rs 0.0% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #251     +/-   ##
========================================
- Coverage    19.4%   19.2%   -0.2%     
========================================
  Files          39      40      +1     
  Lines        8610    8604      -6     
========================================
- Hits         1672    1655     -17     
- Misses       6938    6949     +11     
Flag Coverage Δ
rust 19.2% <4.8%> (-0.2%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@dr-orlovsky dr-orlovsky merged commit 4e4327a into master Sep 5, 2024
24 of 25 checks passed
@dr-orlovsky dr-orlovsky deleted the store branch September 5, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic Epic task covering multiple steps of implementation refactoring Code refactoring
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants