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

Adding usage of sequential storage #811

Merged
merged 3 commits into from
Dec 4, 2023
Merged

Conversation

ryan-summers
Copy link
Member

@ryan-summers ryan-summers commented Nov 15, 2023

Leveraging sequential-storage to make it faster to save settings and reduce wear on the flash. This PR also makes it so that the flash settings structure is not defined in flash itself, so if we add new items in the future, they will be dynamically loaded into the settings struct. This ensures that settings will not be lost between API changes.

This also aids in supporting #822, as we can encode the settings item-by-item into the flash memory. This also means that settings for different profiles can co-exist (as long as they have unique settings names) so that they persist (and are shared) between different applications.

@ryan-summers ryan-summers marked this pull request as ready for review December 4, 2023 14:56
jordens
jordens previously approved these changes Dec 4, 2023
Copy link
Member

@jordens jordens left a comment

Choose a reason for hiding this comment

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

@ryan-summers I reworked the save logic a bit.
LGTM.

Sidenote: While a hypothetical TreeKey::iter_indices() would make the storage more compact, it would make it less robust against settings struct changes (as the indices are not necessarily very stable).

@ryan-summers
Copy link
Member Author

ryan-summers commented Dec 4, 2023

I was in the process of reorganizing and writing docs when you pushed your change, but I've incorporated them into the PR. Let me know if things look good!

Copy link
Member

@jordens jordens left a comment

Choose a reason for hiding this comment

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

Sorry for the collision. LGTM!

@jordens jordens added this pull request to the merge queue Dec 4, 2023
Merged via the queue into main with commit accf844 Dec 4, 2023
8 of 9 checks passed
@jordens jordens deleted the feature/sequential-storage branch December 4, 2023 16:15
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.

2 participants