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

refactor(neon_framework): use a separate persistence layer backing th… #1602

Merged

Conversation

Leptopoda
Copy link
Member

@Leptopoda Leptopoda commented Feb 14, 2024

…e storages

The general idea is to decouple the storage layer, the app is talking to, from the layer actually persisting the data.
A Persistence is just a basic CRUD like (maybe asynchronous) interface for the storage layers to use. Other implementations like the CachedPersistence cache the data in memory (HashMap) so reads can be synchronous while writes are asynchronous in the background.

In turn we can build a complete SharedPreferences implementation on to of the cached persistence. Currently the SharedPreferencesPersistence is just a CachedPeristence warper around the shared preferences (with some key handling magic to allow the current data to seamlessly be used without any migration).

I understand that the current default implementation of our storages (SettingsStore and SingleValueStore) are already wrappers themselves but with the up cumming migration to a SQLite persistence we will no longer have the double wrappers. This may seem like a lot of unnecessary boilerplate interfaces but as shown in #1585 it will allow us to make changes with minimal effort.

We can later consider changing some of these patterns but it was the easiest way to tackle it in a reviewable small patch-set.

@Leptopoda Leptopoda force-pushed the feat/neon_framework/add_persistence_backaend_for_storages branch 2 times, most recently from aae6a26 to 8c04be4 Compare February 18, 2024 11:08
@Leptopoda Leptopoda force-pushed the feat/neon_framework/add_persistence_backaend_for_storages branch 2 times, most recently from 63b2d9b to 71560fb Compare February 21, 2024 15:34
@Leptopoda Leptopoda force-pushed the feat/neon_framework/add_persistence_backaend_for_storages branch 2 times, most recently from c1e961c to 6ddfe18 Compare February 22, 2024 18:31
…e storages

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
…ersistence

Signed-off-by: Nikolas Rimikis <leptopoda@users.noreply.github.com>
@Leptopoda Leptopoda force-pushed the feat/neon_framework/add_persistence_backaend_for_storages branch from 6ddfe18 to 786c29c Compare February 25, 2024 07:12
@Leptopoda Leptopoda enabled auto-merge February 25, 2024 07:13
@Leptopoda Leptopoda merged commit b1e52e1 into main Feb 25, 2024
8 checks passed
@Leptopoda Leptopoda deleted the feat/neon_framework/add_persistence_backaend_for_storages branch February 25, 2024 07:20
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