-str - Improvements and renames in internal streams classes

* Renames Module.grow -> Module.compose
 * Renames Module.connect -> Module.wire
 * Renames Module.growConnect -> Module.fuse
 * Renames Module.wrap -> Module.nest

 * Adds explicit identity equals and hashCode to InPort and OutPort

 * Reimplements many of the Source factories to avoid copying

 * Documents Module.compose, Module.fuse, Module.wire and Module.nest

 * Removes Attributes.nameLifted

 * Optimizes Attributes.nameOrDefault
This commit is contained in:
Viktor Klang 2015-07-06 22:00:21 +02:00
parent efc659b70a
commit 66a116d3d2
19 changed files with 333 additions and 290 deletions

View file

@ -3,20 +3,12 @@
*/
package akka.stream.impl
import java.io.File
import java.util.concurrent.atomic.AtomicReference
import akka.actor.{ Deploy, ActorRef, Props }
import akka.stream.ActorAttributes.Dispatcher
import akka.stream.impl.StreamLayout.Module
import akka.stream.Attributes
import akka.stream.{ Inlet, Shape, SinkShape }
import akka.util.ByteString
import akka.stream.{ Attributes, Inlet, Shape, SinkShape, MaterializationContext, ActorMaterializer }
import org.reactivestreams.{ Publisher, Subscriber, Subscription }
import scala.annotation.unchecked.uncheckedVariance
import scala.collection.immutable
import scala.concurrent.{ Future, Promise }
import akka.stream.MaterializationContext
import akka.stream.ActorMaterializer
/**
* INTERNAL API
@ -36,12 +28,12 @@ private[akka] abstract class SinkModule[-In, Mat](val shape: SinkShape[In]) exte
override def subModules: Set[Module] = Set.empty
def amendShape(attr: Attributes): SinkShape[In] = {
attr.nameOption match {
case None shape
case s: Some[String] if s == attributes.nameOption shape
case Some(name) shape.copy(inlet = Inlet(name + ".in"))
}
protected def amendShape(attr: Attributes): SinkShape[In] = {
val thisN = attributes.nameOrDefault(null)
val thatN = attr.nameOrDefault(null)
if ((thatN eq null) || thisN == thatN) shape
else shape.copy(inlet = Inlet(thatN + ".in"))
}
}