Created
November 23, 2014 23:07
-
-
Save arkadijs/4d4280d7d1bdc7b50ef9 to your computer and use it in GitHub Desktop.
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
def zookeeper: Future[Map[String, String]] = async { | |
val writeback = ZooKeeper.WritebackPathPrefix.split("/").filterNot(_.isEmpty).toSeq | |
def join(l: Seq[String]) = l.mkString("/") | |
def nodes(parent: Seq[String], node: String): Seq[Seq[String]] = { | |
(parent :+ node) match { | |
case `writeback` => Seq() | |
case path => path +: ZooKeeper.getChildren(join(path)).flatMap(node => nodes(path, node)) | |
} | |
} | |
nodes(Seq(), services.ZooKeeperService.BasePath.stripPrefix("/")) | |
.map(join).map { node => (node, ZooKeeper.get(node)) }.filter(_._2.isDefined).toMap.mapValues(_.get) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment