AbstractDataSource

Contract for data sources

Since

v1.1.0

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val loadState: Flow<LoadState>

Observable for network state during requests that the UI can monitor and act based on state changes

Link copied to clipboard
open override val requestHelper: RequestHelper

Request helper that controls the flow of requests to the implementing data source to avoid multiple requests of the same type before others are completed for this instance

Functions

Link copied to clipboard
abstract suspend fun clearDataSource(context: CoroutineDispatcher)

Clears data sources (databases, preferences, e.t.c)

Link copied to clipboard
infix fun <T> IDataSource.create(model: Flow<T>): DataState<T>

Helper for creating a user interface state using a data source

Link copied to clipboard
abstract suspend fun invalidate()

Informs the data source to invalidate itself and should invoke network refresh or reload

Link copied to clipboard
abstract suspend fun refresh()

Invalidate data source and, re-run the last successful or last failed request if applicable

Link copied to clipboard
abstract suspend fun retryFailed()

Performs the necessary operation to invoke a network retry request