Update scalariform (#23778) (#23783)

This commit is contained in:
Arnout Engelen 2017-10-06 10:30:28 +02:00 committed by GitHub
parent 63ccdeec16
commit b1df13d4d4
221 changed files with 1528 additions and 1580 deletions

View file

@ -92,7 +92,7 @@ object IntegrationDocSpec {
class DatabaseService(probe: ActorRef) extends Actor {
override def receive = {
case Save(tweet: Tweet) =>
case Save(tweet: Tweet)
probe ! tweet.author.handle
sender() ! SaveDone
}
@ -123,7 +123,7 @@ object IntegrationDocSpec {
//#ask-actor
class Translator extends Actor {
def receive = {
case word: String =>
case word: String
// ... process message
val reply = word.toUpperCase
sender() ! reply // reply to the ask
@ -148,7 +148,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
Source(List("hello", "hi"))
words
.mapAsync(parallelism = 5)(elem => (ref ? elem).mapTo[String])
.mapAsync(parallelism = 5)(elem (ref ? elem).mapTo[String])
// continue processing of the replies from the actor
.map(_.toLowerCase)
.runWith(Sink.ignore)
@ -170,14 +170,14 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
//#email-addresses-mapAsync
val emailAddresses: Source[String, NotUsed] =
authors
.mapAsync(4)(author => addressSystem.lookupEmail(author.handle))
.collect { case Some(emailAddress) => emailAddress }
.mapAsync(4)(author addressSystem.lookupEmail(author.handle))
.collect { case Some(emailAddress) emailAddress }
//#email-addresses-mapAsync
//#send-emails
val sendEmails: RunnableGraph[NotUsed] =
emailAddresses
.mapAsync(4)(address => {
.mapAsync(4)(address {
emailServer.send(
Email(to = address, title = "Akka", body = "I like your tweet"))
})
@ -206,7 +206,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
val emailAddresses: Source[String, NotUsed] =
authors.via(
Flow[Author].mapAsync(4)(author => addressSystem.lookupEmail(author.handle))
Flow[Author].mapAsync(4)(author addressSystem.lookupEmail(author.handle))
.withAttributes(supervisionStrategy(resumingDecider)))
//#email-addresses-mapAsync-supervision
}
@ -222,12 +222,12 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
val emailAddresses: Source[String, NotUsed] =
authors
.mapAsyncUnordered(4)(author => addressSystem.lookupEmail(author.handle))
.collect { case Some(emailAddress) => emailAddress }
.mapAsyncUnordered(4)(author addressSystem.lookupEmail(author.handle))
.collect { case Some(emailAddress) emailAddress }
val sendEmails: RunnableGraph[NotUsed] =
emailAddresses
.mapAsyncUnordered(4)(address => {
.mapAsyncUnordered(4)(address {
emailServer.send(
Email(to = address, title = "Akka", body = "I like your tweet"))
})
@ -254,15 +254,15 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
val authors = tweets.filter(_.hashtags.contains(akkaTag)).map(_.author)
val phoneNumbers =
authors.mapAsync(4)(author => addressSystem.lookupPhoneNumber(author.handle))
.collect { case Some(phoneNo) => phoneNo }
authors.mapAsync(4)(author addressSystem.lookupPhoneNumber(author.handle))
.collect { case Some(phoneNo) phoneNo }
//#blocking-mapAsync
val blockingExecutionContext = system.dispatchers.lookup("blocking-dispatcher")
val sendTextMessages: RunnableGraph[NotUsed] =
phoneNumbers
.mapAsync(4)(phoneNo => {
.mapAsync(4)(phoneNo {
Future {
smsServer.send(
TextMessage(to = phoneNo, body = "I like your tweet"))
@ -291,12 +291,12 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
val authors = tweets.filter(_.hashtags.contains(akkaTag)).map(_.author)
val phoneNumbers =
authors.mapAsync(4)(author => addressSystem.lookupPhoneNumber(author.handle))
.collect { case Some(phoneNo) => phoneNo }
authors.mapAsync(4)(author addressSystem.lookupPhoneNumber(author.handle))
.collect { case Some(phoneNo) phoneNo }
//#blocking-map
val send = Flow[String]
.map { phoneNo =>
.map { phoneNo
smsServer.send(TextMessage(to = phoneNo, body = "I like your tweet"))
}
.withAttributes(ActorAttributes.dispatcher("blocking-dispatcher"))
@ -327,7 +327,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
implicit val timeout = Timeout(3.seconds)
val saveTweets: RunnableGraph[NotUsed] =
akkaTweets
.mapAsync(4)(tweet => database ? Save(tweet))
.mapAsync(4)(tweet database ? Save(tweet))
.to(Sink.ignore)
//#save-tweets
@ -357,9 +357,9 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
ActorMaterializerSettings(system).withInputBuffer(initialSize = 4, maxSize = 4))
Source(List("a", "B", "C", "D", "e", "F", "g", "H", "i", "J"))
.map(elem => { println(s"before: $elem"); elem })
.map(elem { println(s"before: $elem"); elem })
.mapAsync(4)(service.convert)
.runForeach(elem => println(s"after: $elem"))
.runForeach(elem println(s"after: $elem"))
//#sometimes-slow-mapAsync
probe.expectMsg("after: A")
@ -389,9 +389,9 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
ActorMaterializerSettings(system).withInputBuffer(initialSize = 4, maxSize = 4))
Source(List("a", "B", "C", "D", "e", "F", "g", "H", "i", "J"))
.map(elem => { println(s"before: $elem"); elem })
.map(elem { println(s"before: $elem"); elem })
.mapAsyncUnordered(4)(service.convert)
.runForeach(elem => println(s"after: $elem"))
.runForeach(elem println(s"after: $elem"))
//#sometimes-slow-mapAsyncUnordered
probe.receiveN(10).toSet should be(Set(