All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tanukkii.reactivezk.ExistsAsyncCallback.scala Maven / Gradle / Ivy

package tanukkii.reactivezk

import akka.actor.{Actor, ActorRef}
import org.apache.zookeeper.data.Stat
import tanukkii.reactivezk.ZKOperations.{ExistsFailure, DoesExist}

trait ExistsAsyncCallback {
  import KeeperExceptionConverter._

  def existsAsyncCallback(implicit sender: ActorRef = Actor.noSender): (Int, String, ContextEnvelope, Stat) => Unit = {
    (rc: Int, path: String, ctx: ContextEnvelope, stat: Stat) => rc.toKeeperExceptionOpt(path) match {
      case None => ctx.sender ! DoesExist(path, Option(stat), ctx.originalCtx) // stat may be null
      case Some(e) => ctx.sender ! ExistsFailure(e, path, ctx.originalCtx)
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy