Rename OperationAttributes to Attributes
This commit is contained in:
parent
e6f2db127c
commit
dc7269e620
92 changed files with 458 additions and 462 deletions
|
|
@ -6,9 +6,9 @@ package akka.stream.impl
|
|||
import java.io.File
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import akka.actor.{ Deploy, ActorRef, Props }
|
||||
import akka.stream.ActorOperationAttributes.Dispatcher
|
||||
import akka.stream.ActorAttributes.Dispatcher
|
||||
import akka.stream.impl.StreamLayout.Module
|
||||
import akka.stream.OperationAttributes
|
||||
import akka.stream.Attributes
|
||||
import akka.stream.{ Inlet, Shape, SinkShape }
|
||||
import akka.util.ByteString
|
||||
import org.reactivestreams.{ Publisher, Subscriber, Subscription }
|
||||
|
|
@ -39,7 +39,7 @@ private[akka] abstract class SinkModule[-In, Mat](val shape: SinkShape[In]) exte
|
|||
|
||||
override def subModules: Set[Module] = Set.empty
|
||||
|
||||
def amendShape(attr: OperationAttributes): SinkShape[In] = {
|
||||
def amendShape(attr: Attributes): SinkShape[In] = {
|
||||
attr.nameOption match {
|
||||
case None ⇒ shape
|
||||
case s: Some[String] if s == attributes.nameOption ⇒ shape
|
||||
|
|
@ -55,7 +55,7 @@ private[akka] abstract class SinkModule[-In, Mat](val shape: SinkShape[In]) exte
|
|||
* elements to fill the internal buffers it will assert back-pressure until
|
||||
* a subscriber connects and creates demand for elements to be emitted.
|
||||
*/
|
||||
private[akka] class PublisherSink[In](val attributes: OperationAttributes, shape: SinkShape[In]) extends SinkModule[In, Publisher[In]](shape) {
|
||||
private[akka] class PublisherSink[In](val attributes: Attributes, shape: SinkShape[In]) extends SinkModule[In, Publisher[In]](shape) {
|
||||
|
||||
override def toString: String = "PublisherSink"
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ private[akka] class PublisherSink[In](val attributes: OperationAttributes, shape
|
|||
}
|
||||
|
||||
override protected def newInstance(shape: SinkShape[In]): SinkModule[In, Publisher[In]] = new PublisherSink[In](attributes, shape)
|
||||
override def withAttributes(attr: OperationAttributes): Module = new PublisherSink[In](attr, amendShape(attr))
|
||||
override def withAttributes(attr: Attributes): Module = new PublisherSink[In](attr, amendShape(attr))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -74,7 +74,7 @@ private[akka] class PublisherSink[In](val attributes: OperationAttributes, shape
|
|||
private[akka] final class FanoutPublisherSink[In](
|
||||
initialBufferSize: Int,
|
||||
maximumBufferSize: Int,
|
||||
val attributes: OperationAttributes,
|
||||
val attributes: Attributes,
|
||||
shape: SinkShape[In])
|
||||
extends SinkModule[In, Publisher[In]](shape) {
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ private[akka] final class FanoutPublisherSink[In](
|
|||
override protected def newInstance(shape: SinkShape[In]): SinkModule[In, Publisher[In]] =
|
||||
new FanoutPublisherSink[In](initialBufferSize, maximumBufferSize, attributes, shape)
|
||||
|
||||
override def withAttributes(attr: OperationAttributes): Module =
|
||||
override def withAttributes(attr: Attributes): Module =
|
||||
new FanoutPublisherSink[In](initialBufferSize, maximumBufferSize, attr, amendShape(attr))
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ private[akka] object HeadSink {
|
|||
* the Future into the corresponding failed state) or the end-of-stream
|
||||
* (failing the Future with a NoSuchElementException).
|
||||
*/
|
||||
private[akka] class HeadSink[In](val attributes: OperationAttributes, shape: SinkShape[In]) extends SinkModule[In, Future[In]](shape) {
|
||||
private[akka] class HeadSink[In](val attributes: Attributes, shape: SinkShape[In]) extends SinkModule[In, Future[In]](shape) {
|
||||
|
||||
override def create(context: MaterializationContext) = {
|
||||
val p = Promise[In]()
|
||||
|
|
@ -139,7 +139,7 @@ private[akka] class HeadSink[In](val attributes: OperationAttributes, shape: Sin
|
|||
}
|
||||
|
||||
override protected def newInstance(shape: SinkShape[In]): SinkModule[In, Future[In]] = new HeadSink[In](attributes, shape)
|
||||
override def withAttributes(attr: OperationAttributes): Module = new HeadSink[In](attr, amendShape(attr))
|
||||
override def withAttributes(attr: Attributes): Module = new HeadSink[In](attr, amendShape(attr))
|
||||
|
||||
override def toString: String = "HeadSink"
|
||||
}
|
||||
|
|
@ -149,7 +149,7 @@ private[akka] class HeadSink[In](val attributes: OperationAttributes, shape: Sin
|
|||
* Attaches a subscriber to this stream which will just discard all received
|
||||
* elements.
|
||||
*/
|
||||
private[akka] final class BlackholeSink(val attributes: OperationAttributes, shape: SinkShape[Any]) extends SinkModule[Any, Future[Unit]](shape) {
|
||||
private[akka] final class BlackholeSink(val attributes: Attributes, shape: SinkShape[Any]) extends SinkModule[Any, Future[Unit]](shape) {
|
||||
|
||||
override def create(context: MaterializationContext) = {
|
||||
val effectiveSettings = ActorFlowMaterializer.downcast(context.materializer).effectiveSettings(context.effectiveAttributes)
|
||||
|
|
@ -158,26 +158,26 @@ private[akka] final class BlackholeSink(val attributes: OperationAttributes, sha
|
|||
}
|
||||
|
||||
override protected def newInstance(shape: SinkShape[Any]): SinkModule[Any, Future[Unit]] = new BlackholeSink(attributes, shape)
|
||||
override def withAttributes(attr: OperationAttributes): Module = new BlackholeSink(attr, amendShape(attr))
|
||||
override def withAttributes(attr: Attributes): Module = new BlackholeSink(attr, amendShape(attr))
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
* Attaches a subscriber to this stream.
|
||||
*/
|
||||
private[akka] final class SubscriberSink[In](subscriber: Subscriber[In], val attributes: OperationAttributes, shape: SinkShape[In]) extends SinkModule[In, Unit](shape) {
|
||||
private[akka] final class SubscriberSink[In](subscriber: Subscriber[In], val attributes: Attributes, shape: SinkShape[In]) extends SinkModule[In, Unit](shape) {
|
||||
|
||||
override def create(context: MaterializationContext) = (subscriber, ())
|
||||
|
||||
override protected def newInstance(shape: SinkShape[In]): SinkModule[In, Unit] = new SubscriberSink[In](subscriber, attributes, shape)
|
||||
override def withAttributes(attr: OperationAttributes): Module = new SubscriberSink[In](subscriber, attr, amendShape(attr))
|
||||
override def withAttributes(attr: Attributes): Module = new SubscriberSink[In](subscriber, attr, amendShape(attr))
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
* A sink that immediately cancels its upstream upon materialization.
|
||||
*/
|
||||
private[akka] final class CancelSink(val attributes: OperationAttributes, shape: SinkShape[Any]) extends SinkModule[Any, Unit](shape) {
|
||||
private[akka] final class CancelSink(val attributes: Attributes, shape: SinkShape[Any]) extends SinkModule[Any, Unit](shape) {
|
||||
|
||||
override def create(context: MaterializationContext): (Subscriber[Any], Unit) = {
|
||||
val subscriber = new Subscriber[Any] {
|
||||
|
|
@ -190,7 +190,7 @@ private[akka] final class CancelSink(val attributes: OperationAttributes, shape:
|
|||
}
|
||||
|
||||
override protected def newInstance(shape: SinkShape[Any]): SinkModule[Any, Unit] = new CancelSink(attributes, shape)
|
||||
override def withAttributes(attr: OperationAttributes): Module = new CancelSink(attr, amendShape(attr))
|
||||
override def withAttributes(attr: Attributes): Module = new CancelSink(attr, amendShape(attr))
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -198,7 +198,7 @@ private[akka] final class CancelSink(val attributes: OperationAttributes, shape:
|
|||
* Creates and wraps an actor into [[org.reactivestreams.Subscriber]] from the given `props`,
|
||||
* which should be [[akka.actor.Props]] for an [[akka.stream.actor.ActorSubscriber]].
|
||||
*/
|
||||
private[akka] final class ActorSubscriberSink[In](props: Props, val attributes: OperationAttributes, shape: SinkShape[In]) extends SinkModule[In, ActorRef](shape) {
|
||||
private[akka] final class ActorSubscriberSink[In](props: Props, val attributes: Attributes, shape: SinkShape[In]) extends SinkModule[In, ActorRef](shape) {
|
||||
|
||||
override def create(context: MaterializationContext) = {
|
||||
val subscriberRef = ActorFlowMaterializer.downcast(context.materializer).actorOf(context, props)
|
||||
|
|
@ -206,14 +206,14 @@ private[akka] final class ActorSubscriberSink[In](props: Props, val attributes:
|
|||
}
|
||||
|
||||
override protected def newInstance(shape: SinkShape[In]): SinkModule[In, ActorRef] = new ActorSubscriberSink[In](props, attributes, shape)
|
||||
override def withAttributes(attr: OperationAttributes): Module = new ActorSubscriberSink[In](props, attr, amendShape(attr))
|
||||
override def withAttributes(attr: Attributes): Module = new ActorSubscriberSink[In](props, attr, amendShape(attr))
|
||||
}
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
*/
|
||||
private[akka] final class ActorRefSink[In](ref: ActorRef, onCompleteMessage: Any,
|
||||
val attributes: OperationAttributes,
|
||||
val attributes: Attributes,
|
||||
shape: SinkShape[In]) extends SinkModule[In, Unit](shape) {
|
||||
|
||||
override def create(context: MaterializationContext) = {
|
||||
|
|
@ -226,7 +226,7 @@ private[akka] final class ActorRefSink[In](ref: ActorRef, onCompleteMessage: Any
|
|||
|
||||
override protected def newInstance(shape: SinkShape[In]): SinkModule[In, Unit] =
|
||||
new ActorRefSink[In](ref, onCompleteMessage, attributes, shape)
|
||||
override def withAttributes(attr: OperationAttributes): Module =
|
||||
override def withAttributes(attr: Attributes): Module =
|
||||
new ActorRefSink[In](ref, onCompleteMessage, attr, amendShape(attr))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue