DataStore.Builder
-
Cmn
class DataStore.Builder<T : Any?>
Builder for DataStore.
Summary
Public constructors |
|
|---|---|
<T : Any?> Builder(storage: Storage<T>, context: CoroutineContext) |
Cmn
android
N
JS
|
Public functions |
||
|---|---|---|
DataStore.Builder<T> |
addMigrations(migrations: List<DataMigration<T>>)Adds |
Cmn
android
N
JS
|
DataStore<T> |
build()Validates the configuration and builds the |
Cmn
android
N
JS
|
DataStore.Builder<T> |
setCorruptionHandler(handler: CorruptionHandler<T>)Sets the |
Cmn
android
N
JS
|
DataStore.Builder<T> |
Sets the |
android
|
Public constructors
Public functions
addMigrations
fun addMigrations(migrations: List<DataMigration<T>>): DataStore.Builder<T>
Adds DataMigrations to the DataStore.
Migrations are run in the order they are added before any data is returned to the user.
| Parameters | |
|---|---|
migrations: List<DataMigration<T>> |
the list of migrations. |
| Returns | |
|---|---|
DataStore.Builder<T> |
this |
build
fun build(): DataStore<T>
Validates the configuration and builds the Builder instance.
| Returns | |
|---|---|
DataStore<T> |
a new DataStore instance. |
setCorruptionHandler
fun setCorruptionHandler(handler: CorruptionHandler<T>): DataStore.Builder<T>
Sets the CorruptionHandler for the DataStore.
This handler is invoked if the Storage layer throws a CorruptionException. Defaults to ReThrowCorruptionHandler.
| Parameters | |
|---|---|
handler: CorruptionHandler<T> |
the corruption handler. |
| Returns | |
|---|---|
DataStore.Builder<T> |
this |
setTracer
fun setTracer(tracer: Tracer): DataStore.Builder<T>
Sets the Tracer for Android.
| Returns | |
|---|---|
DataStore.Builder<T> |
this |