Created
February 21, 2018 08:29
-
-
Save ragdroid/1df088ab5789950fe69cc37971b482e3 to your computer and use it in GitHub Desktop.
Cache Interface to talk to the whole app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface DataStore<T> { | |
fun modelListObservable(): Maybe<List<T>> | |
fun modelObservable(id: String): Maybe<T> | |
fun putModels(vararg models: T) | |
fun clear() | |
fun modelObservable(): Maybe<T> | |
= modelListObservable().map { | |
list -> list.get(0) | |
} | |
val isDataAvailableObservable: Single<Boolean> | |
get() = modelObservable().isEmpty | |
.map { !it } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment