io.hydrosphere.mist.master.WorkersJuggler.scala Maven / Gradle / Ivy
package io.hydrosphere.mist.master
object WorkersJuggler {
private val workers = scala.collection.mutable.Map[String, String]()
def +=(worker: WorkerLink): Unit = {
workers += (worker.name -> worker.address)
}
def -=(worker: WorkerLink): Unit = {
workers -= (worker.name)
}
def map[T](f: (WorkerLink) => T): List[T] = {
workers.map {
case (name, address) =>
f(WorkerLink(name, address))
}.toList
}
}