Skip to content

Instantly share code, notes, and snippets.

@Lovesan
Created May 14, 2015 09:54
Show Gist options
  • Save Lovesan/7fb635bb51a20d51dffd to your computer and use it in GitHub Desktop.
Save Lovesan/7fb635bb51a20d51dffd to your computer and use it in GitHub Desktop.
private def metaExists(id: Id[DocumentMeta]): Rx[Boolean] = {
metaDir.fileExists(id.value) mapToRx {
case Failure(_) => false
case Success(exists) => exists
}
}
private def dataExists(id: Id[DocumentMeta]): Rx[Boolean] = {
dir.fileExists(id.value) mapToRx {
case Failure(_) => false
case Success(exists) => exists
}
}
private def getPendingMeta(id: Id[DocumentMeta])(f: => Rx[CdnMetaState]) = {
pendingMeta.getOrElseUpdate(id, f)
}
private def getPendingData(id: Id[DocumentMeta])(f: => Rx[CdnDataState]) = {
pendingData.getOrElseUpdate(id, f)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment