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

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
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy