ReplicaClient
Creates and manages replicas.
Types
Functions
Link copied to clipboard
abstract fun <K : Any, T : Any> createKeyedReplica( name: String, childName: (K) -> String, settings: KeyedReplicaSettings<K, T> = KeyedReplicaSettings(), childSettings: (K) -> ReplicaSettings, tags: Set<ReplicaTag> = emptySet(), childTags: (K) -> Set<ReplicaTag> = { emptySet() }, behaviours: List<KeyedReplicaBehaviour<K, T>> = emptyList(), childBehaviours: (K) -> List<ReplicaBehaviour<T>> = { emptyList() }, storage: KeyedStorage<K, T>? = null, fetcher: KeyedFetcher<K, T>): KeyedPhysicalReplica<K, T>
Content copied to clipboard
Creates a KeyedPhysicalReplica. Note: once created a keyed replica will exist as long as a client exists.
Link copied to clipboard
abstract fun <T : Any> createReplica( name: String, settings: ReplicaSettings, tags: Set<ReplicaTag> = emptySet(), behaviours: List<ReplicaBehaviour<T>> = emptyList(), storage: Storage<T>? = null, fetcher: Fetcher<T>): PhysicalReplica<T>
Content copied to clipboard
Creates a PhysicalReplica. Note: once created a replica will exist as long as a client exists.
Link copied to clipboard
abstract suspend fun onEachKeyedReplica(action: suspend KeyedPhysicalReplica<*, *>.() -> Unit)
Content copied to clipboard
Executes an action on each KeyedPhysicalReplica.
Link copied to clipboard
abstract suspend fun onEachReplica(includeChildrenOfKeyedReplicas: Boolean = true, action: suspend PhysicalReplica<*>.() -> Unit)
Content copied to clipboard
Executes an action on each PhysicalReplica.
Properties
Link copied to clipboard
Notifies that some ReplicaClientEvent has occurred.
Link copied to clipboard
Returns NetworkConnectivityProvider that was passed to create a client.
Extensions
Link copied to clipboard
Cancels network requests in all replicas.
Link copied to clipboard
suspend fun ReplicaClient.cancelByTags(predicate: (Set<ReplicaTag>) -> Boolean)
Content copied to clipboard
Cancels network requests in replicas with the matching tags.
Link copied to clipboard
Cancels network requests and clears data in all replicas.
Link copied to clipboard
suspend fun ReplicaClient.clearByTags(predicate: (Set<ReplicaTag>) -> Boolean)
Content copied to clipboard
Cancels network requests and clears data in replicas with the matching tags.
Link copied to clipboard
suspend fun ReplicaClient.invalidateAll(mode: InvalidationMode = InvalidationMode.RefreshIfHasObservers)
Content copied to clipboard
Makes all replicas stale.
Link copied to clipboard
suspend fun ReplicaClient.invalidateByTags(mode: InvalidationMode = InvalidationMode.RefreshIfHasObservers, predicate: (Set<ReplicaTag>) -> Boolean)
Content copied to clipboard
Makes replicas with the matching tags stale.