Synchronizer

interface Synchronizer

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

Inheritors

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.

Link copied to clipboard
abstract suspend fun getChangeListVersions(model: String): Int
Link copied to clipboard
open suspend fun Syncable.sync(): Boolean

Syntactic sugar to call Syncable.syncWith while omitting the synchronizer argument

Link copied to clipboard
abstract suspend fun updateChangeListVersions(model: String, version: Int)