androidx.datastore.core


Interfaces

Closeable

Datastore common version of java.io.Closeable

DataMigration

Interface for migrations to DataStore.

DataStore

DataStore provides a safe and durable way to store small amounts of data, such as preferences and application state.

InterProcessCoordinator

InterProcessCoordinator provides functionalities that support DataStore instances to coordinate the concurrent work running on multiple threads and multiple processes to guarantee its data consistency.

ReadScope

The scope used for a read transaction.

Serializer

The serializer determines the on-disk format and API for accessing it.

Storage

Storage provides a way to create StorageConnections that allow read and write a particular type of data.

StorageConnection

StorageConnection provides a way to read and write a particular type of data.

WriteScope

The scope used for a write transaction.

Classes

FileStorage

The Java IO File version of the Storage interface.

Exceptions

CorruptionException

A subclass of IOException that indicates that the file could not be de-serialized due to data format corruption.

IOException

Common IOException mapped to java.io.Exception in jvm code.

Objects

DataStoreFactory

Public factory for creating DataStore instances.

DataStoreFactory

Type aliases

IOException

Common IOException mapped to java.io.Exception in jvm code.

Top-level functions summary

InterProcessCoordinator

Create a coordinator for single process use cases.

Extension functions summary

suspend T
inline R
<T : Closeable, R : Any?> T.use(block: (T) -> R)

Ensures a Closeable object has its close() method called at the end of the supplied block.

suspend Unit
<T : Any?> StorageConnection<T>.writeData(value: T)

Top-level functions

createSingleProcessCoordinator

fun createSingleProcessCoordinator(file: File): InterProcessCoordinator

Create a coordinator for single process use cases.

Parameters
file: File

The canonical file managed by SingleProcessCoordinator

Extension functions

suspend fun <T : Any?> StorageConnection<T>.readData(): T
inline fun <T : Closeable, R : Any?> T.use(block: (T) -> R): R

Ensures a Closeable object has its close() method called at the end of the supplied block.

Throws
kotlin.Throwable

any exceptions thrown in the block will propagate through this method.

suspend fun <T : Any?> StorageConnection<T>.writeData(value: T): Unit