commonMain.io.github.rotbolt.flakerdata.flakerprefs.DataStoreFactory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of flaker-data Show documentation
Show all versions of flaker-data Show documentation
Persistence module for flaker.
package io.github.rotbolt.flakerdata.flakerprefs
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.PreferenceDataStoreFactory
import androidx.datastore.preferences.core.Preferences
import okio.Path.Companion.toPath
expect class DataStoreFactory {
fun create(): DataStore
}
internal fun createDataStore(
producePath: () -> String,
): DataStore = PreferenceDataStoreFactory.createWithPath(
corruptionHandler = null,
migrations = emptyList(),
produceFile = { producePath().toPath() },
)
internal const val DATASTORE_FILE_NAME = "flaker.preferences_pb"