Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
data class NetworkChangeList(val id: String, val changeListVersion: Int, val isDelete: Boolean)

Network representation of a change list for a model.

Link copied to clipboard
interface Syncable

Interface marker for a class that is synchronized with a remote source. Syncing must not be performed concurrently and it is the Synchronizer's responsibility to ensure this.

Link copied to clipboard
interface Synchronizer

Interface marker for a class that manages synchronization between local data and a remote source for a Syncable.

Functions

Link copied to clipboard
suspend fun Synchronizer.changeListSync(model: String, changeListFetcher: suspend (currentVersion: Int) -> List<NetworkChangeList>, modelDeleter: suspend (ids: List<String>) -> Unit, modelUpdater: suspend (ids: List<String>) -> Unit): Boolean

Utility function for syncing a repository with the network. model Model that needs to be synced changeListFetcher Fetches the change list for the model modelDeleter Deletes models by consuming the ids of the models that have been deleted. modelUpdater Updates models by consuming the ids of the models that have changed.

suspend fun Synchronizer.changeListSync(models: List<String>, changeListFetcher: suspend (model: String, currentVersion: Int) -> List<NetworkChangeList>, modelDeleter: suspend (model: String, ids: List<String>) -> Unit, modelUpdater: suspend (model: String, ids: List<String>) -> Unit): Boolean

Utility function for syncing a repository with the network. models List of models that needs to be synced changeListFetcher Fetches the change list for the model modelDeleter Deletes models by consuming the ids of the models that have been deleted. modelUpdater Updates models by consuming the ids of the models that have changed.