Rename OperationAttributes to Attributes

This commit is contained in:
Endre Sándor Varga 2015-06-23 17:32:55 +02:00
parent e6f2db127c
commit dc7269e620
92 changed files with 458 additions and 462 deletions

View file

@ -9,7 +9,7 @@ import akka.stream.testkit.AkkaSpec
import scala.concurrent.Await
import scala.concurrent.duration._
import scala.util.control.NoStackTrace
import akka.stream.OperationAttributes
import akka.stream.Attributes
object FlexiDocSpec {
//#fleximerge-zip-states
@ -34,7 +34,7 @@ class FlexiDocSpec extends AkkaSpec {
"implement zip using readall" in {
//#fleximerge-zip-readall
class Zip[A, B] extends FlexiMerge[(A, B), ZipPorts[A, B]](
new ZipPorts, OperationAttributes.name("Zip1State")) {
new ZipPorts, Attributes.name("Zip1State")) {
import FlexiMerge._
override def createMergeLogic(p: PortT) = new MergeLogic[(A, B)] {
override def initialState =
@ -73,7 +73,7 @@ class FlexiDocSpec extends AkkaSpec {
"implement zip using two states" in {
//#fleximerge-zip-states
class Zip[A, B] extends FlexiMerge[(A, B), ZipPorts[A, B]](
new ZipPorts, OperationAttributes.name("Zip2State")) {
new ZipPorts, Attributes.name("Zip2State")) {
import FlexiMerge._
override def createMergeLogic(p: PortT) = new MergeLogic[(A, B)] {
@ -122,7 +122,7 @@ class FlexiDocSpec extends AkkaSpec {
new ImportantWithBackupShape(i)
}
class ImportantWithBackups[A] extends FlexiMerge[A, ImportantWithBackupShape[A]](
new ImportantWithBackupShape, OperationAttributes.name("ImportantWithBackups")) {
new ImportantWithBackupShape, Attributes.name("ImportantWithBackups")) {
import FlexiMerge._
override def createMergeLogic(p: PortT) = new MergeLogic[A] {
@ -192,7 +192,7 @@ class FlexiDocSpec extends AkkaSpec {
//#flexi-preferring-merge
class PreferringMerge extends FlexiMerge[Int, PreferringMergeShape[Int]](
new PreferringMergeShape, OperationAttributes.name("ImportantWithBackups")) {
new PreferringMergeShape, Attributes.name("ImportantWithBackups")) {
import akka.stream.scaladsl.FlexiMerge._
override def createMergeLogic(p: PortT) = new MergeLogic[Int] {
@ -217,7 +217,7 @@ class FlexiDocSpec extends AkkaSpec {
protected override def construct(i: Init[(A, B)]) = new UnzipShape(i)
}
class Unzip[A, B] extends FlexiRoute[(A, B), UnzipShape[A, B]](
new UnzipShape, OperationAttributes.name("Unzip")) {
new UnzipShape, Attributes.name("Unzip")) {
import FlexiRoute._
override def createRouteLogic(p: PortT) = new RouteLogic[(A, B)] {
@ -246,7 +246,7 @@ class FlexiDocSpec extends AkkaSpec {
protected override def construct(i: Init[A]) = new ImportantRouteShape(i)
}
class ImportantRoute[A] extends FlexiRoute[A, ImportantRouteShape[A]](
new ImportantRouteShape, OperationAttributes.name("ImportantRoute")) {
new ImportantRouteShape, Attributes.name("ImportantRoute")) {
import FlexiRoute._
override def createRouteLogic(p: PortT) = new RouteLogic[A] {
import p.important

View file

@ -9,8 +9,8 @@ import akka.stream.ActorFlowMaterializerSettings
import akka.stream.Supervision
import akka.stream.scaladsl._
import akka.stream.testkit.AkkaSpec
import akka.stream.OperationAttributes
import akka.stream.ActorOperationAttributes
import akka.stream.Attributes
import akka.stream.ActorAttributes
import scala.concurrent.duration._
class FlowErrorDocSpec extends AkkaSpec {
@ -55,7 +55,7 @@ class FlowErrorDocSpec extends AkkaSpec {
}
val flow = Flow[Int]
.filter(100 / _ < 50).map(elem => 100 / (5 - elem))
.withAttributes(ActorOperationAttributes.supervisionStrategy(decider))
.withAttributes(ActorAttributes.supervisionStrategy(decider))
val source = Source(0 to 5).via(flow)
val result = source.runWith(Sink.fold(0)(_ + _))
@ -78,7 +78,7 @@ class FlowErrorDocSpec extends AkkaSpec {
if (elem < 0) throw new IllegalArgumentException("negative not allowed")
else acc + elem
}
.withAttributes(ActorOperationAttributes.supervisionStrategy(decider))
.withAttributes(ActorAttributes.supervisionStrategy(decider))
val source = Source(List(1, 3, -1, 5, 7)).via(flow)
val result = source.grouped(1000).runWith(Sink.head)
// the negative element cause the scan stage to be restarted,

View file

@ -10,7 +10,7 @@ import akka.stream.testkit.AkkaSpec
import scala.collection.immutable
import scala.concurrent.{ Future, Await }
import scala.concurrent.duration._
import akka.stream.OperationAttributes
import akka.stream.Attributes
class FlowGraphDocSpec extends AkkaSpec {

View file

@ -15,8 +15,8 @@ import akka.actor.Actor
import akka.actor.Props
import akka.pattern.ask
import akka.util.Timeout
import akka.stream.OperationAttributes
import akka.stream.ActorOperationAttributes
import akka.stream.Attributes
import akka.stream.ActorAttributes
import scala.concurrent.ExecutionContext
import akka.stream.ActorFlowMaterializerSettings
import java.util.concurrent.atomic.AtomicInteger
@ -172,7 +172,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
tweets.filter(_.hashtags.contains(akka)).map(_.author)
//#email-addresses-mapAsync-supervision
import ActorOperationAttributes.supervisionStrategy
import ActorAttributes.supervisionStrategy
import Supervision.resumingDecider
val emailAddresses: Source[String, Unit] =
@ -270,7 +270,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
.map { phoneNo =>
smsServer.send(TextMessage(to = phoneNo, body = "I like your tweet"))
}
.withAttributes(ActorOperationAttributes.dispatcher("blocking-dispatcher"))
.withAttributes(ActorAttributes.dispatcher("blocking-dispatcher"))
val sendTextMessages: RunnableFlow[Unit] =
phoneNumbers.via(send).to(Sink.ignore)

View file

@ -3,7 +3,7 @@ package docs.stream
import akka.stream.{ OverflowStrategy, ActorFlowMaterializerSettings, ActorFlowMaterializer }
import akka.stream.scaladsl._
import akka.stream.testkit.AkkaSpec
import akka.stream.OperationAttributes
import akka.stream.Attributes
class StreamBuffersRateSpec extends AkkaSpec {
implicit val mat = ActorFlowMaterializer()
@ -30,7 +30,7 @@ class StreamBuffersRateSpec extends AkkaSpec {
//#section-buffer
val section = Flow[Int].map(_ * 2)
.withAttributes(OperationAttributes.inputBuffer(initial = 1, max = 1))
.withAttributes(Attributes.inputBuffer(initial = 1, max = 1))
val flow = section.via(Flow[Int].map(_ / 2)) // the buffer size of this map is the default
//#section-buffer
}

View file

@ -1,7 +1,7 @@
package docs.stream.cookbook
import akka.event.Logging
import akka.stream.OperationAttributes
import akka.stream.Attributes
import akka.stream.scaladsl.{ Sink, Source }
import akka.testkit.{ EventFilter, TestProbe }
@ -30,7 +30,7 @@ class RecipeLoggingElements extends RecipeSpec {
//#log-custom
// customise log levels
mySource.log("before-map")
.withAttributes(OperationAttributes.logLevels(onElement = Logging.WarningLevel))
.withAttributes(Attributes.logLevels(onElement = Logging.WarningLevel))
.map(analyse)
// or provide custom logging adapter

View file

@ -56,7 +56,7 @@ class StreamFileDocSpec extends AkkaSpec(UnboundedMailboxConfig) {
"configure dispatcher in code" in {
//#custom-dispatcher-code
SynchronousFileSink(file)
.withAttributes(ActorOperationAttributes.dispatcher("custom-file-io-dispatcher"))
.withAttributes(ActorAttributes.dispatcher("custom-file-io-dispatcher"))
//#custom-dispatcher-code
}