google / horologist

Horologist is a group of libraries that aim to supplement Wear OS developers with features that are commonly required by developers but not yet available.
https://google.github.io/horologist/
Apache License 2.0
561 stars 91 forks source link

Add a cache for Data Layer DataStore #1480

Open yschimke opened 1 year ago

yschimke commented 1 year ago

See https://stackoverflow.com/questions/72935096/using-dataclient-getdataitem-as-storage-for-wear-over-datastore

We should also follow this advice and avoid reading directly through to the Data Client.

yschimke commented 1 year ago

Mainly in DataStore module

https://github.com/google/horologist/blob/main/datalayer/core/src/main/java/com/google/android/horologist/data/store/impl/DataItemFlow.kt

this feature should probably wrap the standard Proto DataStore, but also synchronize the in the background with DataClient.

At the moment, it only reads from DataClient, which effectively means IPC to GMS?

yschimke commented 3 months ago

We should look at adopting the InterProcessCoordinator

https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:datastore/datastore-core/src/commonMain/kotlin/androidx/datastore/core/InterProcessCoordinator.kt?q=InterProcessCoordinator%20