remove Future from StreamRefs mat val, #24372 (#26847)

This commit is contained in:
Patrik Nordwall 2019-05-02 16:54:37 +02:00 committed by GitHub
parent 1128024797
commit 82c761f026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 109 additions and 117 deletions

View file

@ -23,7 +23,6 @@ class FlowStreamRefsDocSpec extends AkkaSpec with CompileOnlySpec {
case class LogsOffer(streamId: Int, sourceRef: SourceRef[String])
class DataSource extends Actor {
import context.dispatcher
implicit val mat = ActorMaterializer()(context)
def receive = {
@ -32,13 +31,13 @@ class FlowStreamRefsDocSpec extends AkkaSpec with CompileOnlySpec {
val source: Source[String, NotUsed] = streamLogs(streamId)
// materialize the SourceRef:
val ref: Future[SourceRef[String]] = source.runWith(StreamRefs.sourceRef())
val ref: SourceRef[String] = source.runWith(StreamRefs.sourceRef())
// wrap the SourceRef in some domain message, such that the sender knows what source it is
val reply: Future[LogsOffer] = ref.map(LogsOffer(streamId, _))
val reply = LogsOffer(streamId, ref)
// reply to sender
reply.pipeTo(sender())
sender() ! reply
}
def streamLogs(streamId: Long): Source[String, NotUsed] = ???
@ -70,7 +69,6 @@ class FlowStreamRefsDocSpec extends AkkaSpec with CompileOnlySpec {
class DataReceiver extends Actor {
import context.dispatcher
implicit val mat = ActorMaterializer()(context)
def receive = {
@ -79,13 +77,13 @@ class FlowStreamRefsDocSpec extends AkkaSpec with CompileOnlySpec {
val sink: Sink[String, NotUsed] = logsSinkFor(nodeId)
// materialize the SinkRef (the remote is like a source of data for us):
val ref: Future[SinkRef[String]] = StreamRefs.sinkRef[String]().to(sink).run()
val ref: SinkRef[String] = StreamRefs.sinkRef[String]().to(sink).run()
// wrap the SinkRef in some domain message, such that the sender knows what source it is
val reply: Future[MeasurementsSinkReady] = ref.map(MeasurementsSinkReady(nodeId, _))
val reply = MeasurementsSinkReady(nodeId, ref)
// reply to sender
reply.pipeTo(sender())
sender() ! reply
}
def logsSinkFor(nodeId: String): Sink[String, NotUsed] = ???