Skip to content

refactor!: Box the changeset of StoreErrorWithDump #1998

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

110CodingP
Copy link

@110CodingP 110CodingP commented Jul 22, 2025

Description

Fixes #1991. As the linked issue mentions Boxing helps reduce memory overhead and limits the size of enums with StoreErrorWithDump as variant.

Breaking: The enum StoreErrorWithDump and the functions load,dump and load_or_create have been changed.

Changelog Notice

   Changed
   - `changeset` field of `StoreErrorWithDump` is now of type `Option<Box<C>>` 

Checklists

All Submissions:

@ValuedMammal
Copy link
Collaborator

I agree with the use of Box in the StoreErrorWithDump error, but I wonder is it necessary to box the changeset when returned in the Ok value, for example in dump and load, etc. If no one finds this to be important, I would just as soon leave it out.

@ValuedMammal ValuedMammal requested a review from nymius July 22, 2025 19:53
As mentioned in the corresponding issue, `Box`ing helps reduce memory
overhead while passing the enum around and also to limit the size of
enums with `StoreErrorWithDump` as a variant.

Breaking: The enum `StoreErrorWithDump` has been changed.
@110CodingP
Copy link
Author

110CodingP commented Jul 28, 2025

Removed the Box from return type of dump, load, load_or_create in #56f1fad .
Sorry for the delay.

Copy link
Contributor

@nymius nymius 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 to me!

I wonder is it necessary to box the changeset when returned in the Ok value, for example in dump and load, etc.

We can ignore that, thinking in terms of the goal of this crate, which is to provide a testing database to experiment, not performance. load and dump are called most of the time just on the startup and on the shutdown of the code using the database, with occasional dumps for debugging.

@ValuedMammal
Copy link
Collaborator

ACK 56f1fad

Copy link
Contributor

@LagginTimes LagginTimes left a comment

Choose a reason for hiding this comment

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

ACK 56f1fad

Copy link
Contributor

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

ACK 56f1fad

You need to do a rebase to get the updated rustc and MSRV fixed CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

[file_store] Change StoreErrorWithDump to box the aggregate changeset
5 participants