aboutsummaryrefslogtreecommitdiff
path: root/stream/src/main/scala/akka/serial/stream/impl/WatcherStage.scala
diff options
context:
space:
mode:
authorJakob Odersky <jakob@odersky.com>2017-01-08 21:16:25 +0100
committerJakob Odersky <jakob@odersky.com>2017-01-21 17:22:10 -0800
commit23959966760174477a6b0fcbf9dd1e8ef37c643b (patch)
tree9a0ee44eb43a8c13af57b0d06313f3aabf9e4555 /stream/src/main/scala/akka/serial/stream/impl/WatcherStage.scala
parent6c371ba6d69c891c1f0d6df00bb643e1d543cc9d (diff)
downloadakka-serial-23959966760174477a6b0fcbf9dd1e8ef37c643b.tar.gz
akka-serial-23959966760174477a6b0fcbf9dd1e8ef37c643b.tar.bz2
akka-serial-23959966760174477a6b0fcbf9dd1e8ef37c643b.zip
Rename project to akka-serial
Diffstat (limited to 'stream/src/main/scala/akka/serial/stream/impl/WatcherStage.scala')
-rw-r--r--stream/src/main/scala/akka/serial/stream/impl/WatcherStage.scala38
1 files changed, 38 insertions, 0 deletions
diff --git a/stream/src/main/scala/akka/serial/stream/impl/WatcherStage.scala b/stream/src/main/scala/akka/serial/stream/impl/WatcherStage.scala
new file mode 100644
index 0000000..649249f
--- /dev/null
+++ b/stream/src/main/scala/akka/serial/stream/impl/WatcherStage.scala
@@ -0,0 +1,38 @@
+package akka.serial
+package stream
+package impl
+
+import scala.concurrent.{Future, Promise}
+
+import akka.actor.ActorRef
+import akka.stream.{Attributes, Outlet, SourceShape}
+import akka.stream.stage.{GraphStageWithMaterializedValue, GraphStageLogic}
+
+
+private[stream] class WatcherStage(
+ ioManager: ActorRef,
+ ports: Set[String]
+) extends GraphStageWithMaterializedValue[SourceShape[String], Future[Serial.Watch]] {
+
+ val out = Outlet[String]("Watcher.out")
+
+ val shape = new SourceShape(out)
+
+ override def createLogicAndMaterializedValue(attributes: Attributes):
+ (GraphStageLogic, Future[Serial.Watch]) = {
+
+ val promise = Promise[Serial.Watch]
+
+ val logic = new WatcherLogic(
+ shape,
+ ioManager,
+ ports,
+ promise
+ )
+
+ (logic, promise.future)
+ }
+
+ override def toString = s"Watcher($ports)"
+
+}