Pascal Weisenburger, Mirko Köhler, Guido Salvaneschi
TU Darmstadt, Germany
trait Registry extends Peer
trait Node extends Peer
val message: Event[String] on Registry
= placed { getMessageStream() }
trait Registry extends Peer { type Tie <: Multiple[Node] }
trait Node extends Peer { type Tie <: Single[Registry] with Multiple[Node] }
trait Registry extends Peer { type Tie <: Single[Node] }
trait Node extends Peer { type Tie <: Single[Registry] }
val message: Event[String] on Node
placed[Registry] {
message.asLocal: Event[String]
}
trait Registry extends Peer { type Tie <: Multiple[Node] }
trait Node extends Peer { type Tie <: Single[Registry] }
val message: Event[String] on Node
placed[Registry] {
message.asLocalFromAll: Map[Remote[Node], Event[String]]
}
val message = Event[String]()
val result = message map processMessage
val ui = new UI(result)
val message: Event[String] on Node = placed[Node] { Event[String]() }
val result = placed[Registry] { message.asLocal map processMessage }
val ui = placed[Node] { new UI(result.asLocal) }
@multitier object Chat {
trait Registry extends Peer { type Tie <: Multiple[Node] }
trait Node extends Peer { type Tie <: Single[Registry] }
val message = placed[Node] { Event[String]() }
val publicMessage = placed[Registry] {
message.asLocalFromAllSeq map { case (_, msg) => msg }
}
placed[Node].main {
publicMessage.asLocal observe println
for (line <- io.Source.stdin.getLines)
message.fire(line)
}
}
trait MasterProxy extends Peer { type Tie <: Multiple[Master] with Multiple[Worker] }
trait Worker extends Peer { type Tie <: Single[MasterProxy] with Optional[Master] }
trait Master extends Peer { type Tie <: Multiple[MasterProxy] with Multiple[Worker] }
Value on Peer