You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by md...@apache.org on 2022/11/14 21:23:40 UTC
[incubator-pekko-persistence-r2dbc] 03/03: format source with scalafmt, #3
This is an automated email from the ASF dual-hosted git repository.
mdedetrich pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-persistence-r2dbc.git
commit 97a7214a3ec0aa1a2ee6debcd0fce9ab6aa67492
Author: Auto Format <nobody>
AuthorDate: Mon Nov 14 22:06:31 2022 +0100
format source with scalafmt, #3
---
.../r2dbc/query/scaladsl/R2dbcReadJournal.scala | 2 +-
.../r2dbc/query/EventsBySlicePerfSpec.scala | 2 +-
.../projection/R2dbcProjectionDocExample.scala | 24 +++++++++++-----------
.../docs/home/query/QueryDocCompileOnly.scala | 20 +++++++++---------
project/AutomaticModuleName.scala | 2 +-
.../r2dbc/internal/R2dbcProjectionImpl.scala | 5 +----
.../projection/r2dbc/EventSourcedChaosSpec.scala | 3 ++-
.../r2dbc/EventSourcedEndToEndSpec.scala | 5 +++--
.../projection/r2dbc/EventSourcedPubSubSpec.scala | 5 +++--
.../projection/r2dbc/R2dbcOffsetStoreSpec.scala | 2 +-
.../projection/r2dbc/R2dbcProjectionSpec.scala | 2 --
11 files changed, 35 insertions(+), 37 deletions(-)
diff --git a/core/src/main/scala/akka/persistence/r2dbc/query/scaladsl/R2dbcReadJournal.scala b/core/src/main/scala/akka/persistence/r2dbc/query/scaladsl/R2dbcReadJournal.scala
index 27fa8f9..546e7fb 100644
--- a/core/src/main/scala/akka/persistence/r2dbc/query/scaladsl/R2dbcReadJournal.scala
+++ b/core/src/main/scala/akka/persistence/r2dbc/query/scaladsl/R2dbcReadJournal.scala
@@ -289,7 +289,7 @@ final class R2dbcReadJournal(system: ExtendedActorSystem, config: Config, cfgPat
queryDao.timestampOfEvent(persistenceId, sequenceNr)
}
- //LoadEventQuery
+ // LoadEventQuery
override def loadEnvelope[Event](persistenceId: String, sequenceNr: Long): Future[EventEnvelope[Event]] = {
queryDao
.loadEvent(persistenceId, sequenceNr)
diff --git a/core/src/test/scala/akka/persistence/r2dbc/query/EventsBySlicePerfSpec.scala b/core/src/test/scala/akka/persistence/r2dbc/query/EventsBySlicePerfSpec.scala
index fd21977..7fc20c6 100644
--- a/core/src/test/scala/akka/persistence/r2dbc/query/EventsBySlicePerfSpec.scala
+++ b/core/src/test/scala/akka/persistence/r2dbc/query/EventsBySlicePerfSpec.scala
@@ -86,7 +86,7 @@ class EventsBySlicePerfSpec
.runWith(Sink.fold(0) { case (acc, _) =>
if (acc > 0 && acc % 100 == 0)
println(s"#$iteration Reading [$acc] events from slices [${range.min}-${range.max}] " +
- s"took [${(System.nanoTime() - t1) / 1000 / 1000}] ms")
+ s"took [${(System.nanoTime() - t1) / 1000 / 1000}] ms")
acc + 1
})
}
diff --git a/docs/src/test/scala/docs/home/projection/R2dbcProjectionDocExample.scala b/docs/src/test/scala/docs/home/projection/R2dbcProjectionDocExample.scala
index f3bd339..cdcd8e2 100644
--- a/docs/src/test/scala/docs/home/projection/R2dbcProjectionDocExample.scala
+++ b/docs/src/test/scala/docs/home/projection/R2dbcProjectionDocExample.scala
@@ -44,7 +44,7 @@ object R2dbcProjectionDocExample {
final case class CheckedOut(cartId: String, eventTime: Instant) extends Event
}
- //#handler
+ // #handler
class ShoppingCartHandler()(implicit ec: ExecutionContext) extends R2dbcHandler[EventEnvelope[ShoppingCart.Event]] {
private val logger = LoggerFactory.getLogger(getClass)
@@ -66,9 +66,9 @@ object R2dbcProjectionDocExample {
}
}
}
- //#handler
+ // #handler
- //#grouped-handler
+ // #grouped-handler
import scala.collection.immutable
class GroupedShoppingCartHandler()(implicit ec: ExecutionContext)
@@ -96,7 +96,7 @@ object R2dbcProjectionDocExample {
session.update(stmts).map(_ => Done)
}
}
- //#grouped-handler
+ // #grouped-handler
implicit val system = ActorSystem[Nothing](Behaviors.empty, "Example")
implicit val ec: ExecutionContext = system.executionContext
@@ -149,7 +149,7 @@ object R2dbcProjectionDocExample {
// #initProjections
}
- //#sourceProvider
+ // #sourceProvider
import akka.projection.eventsourced.scaladsl.EventSourcedProvider
import akka.persistence.r2dbc.query.scaladsl.R2dbcReadJournal
import akka.projection.scaladsl.SourceProvider
@@ -171,10 +171,10 @@ object R2dbcProjectionDocExample {
entityType,
minSlice,
maxSlice)
- //#sourceProvider
+ // #sourceProvider
object IllustrateExactlyOnce {
- //#exactlyOnce
+ // #exactlyOnce
import akka.projection.r2dbc.scaladsl.R2dbcProjection
import akka.projection.ProjectionId
@@ -183,11 +183,11 @@ object R2dbcProjectionDocExample {
val projection =
R2dbcProjection
.exactlyOnce(projectionId, settings = None, sourceProvider, handler = () => new ShoppingCartHandler)
- //#exactlyOnce
+ // #exactlyOnce
}
object IllustrateAtLeastOnce {
- //#atLeastOnce
+ // #atLeastOnce
import akka.projection.r2dbc.scaladsl.R2dbcProjection
import akka.projection.ProjectionId
@@ -197,11 +197,11 @@ object R2dbcProjectionDocExample {
R2dbcProjection
.atLeastOnce(projectionId, settings = None, sourceProvider, handler = () => new ShoppingCartHandler)
.withSaveOffset(afterEnvelopes = 100, afterDuration = 500.millis)
- //#atLeastOnce
+ // #atLeastOnce
}
object IllustrateGrouped {
- //#grouped
+ // #grouped
import akka.projection.r2dbc.scaladsl.R2dbcProjection
import akka.projection.ProjectionId
@@ -211,7 +211,7 @@ object R2dbcProjectionDocExample {
R2dbcProjection
.groupedWithin(projectionId, settings = None, sourceProvider, handler = () => new GroupedShoppingCartHandler)
.withGroup(groupAfterEnvelopes = 20, groupAfterDuration = 500.millis)
- //#grouped
+ // #grouped
}
}
diff --git a/docs/src/test/scala/docs/home/query/QueryDocCompileOnly.scala b/docs/src/test/scala/docs/home/query/QueryDocCompileOnly.scala
index c9719f7..d2d5ba5 100644
--- a/docs/src/test/scala/docs/home/query/QueryDocCompileOnly.scala
+++ b/docs/src/test/scala/docs/home/query/QueryDocCompileOnly.scala
@@ -10,34 +10,34 @@ object QueryDocCompileOnly {
trait MyEvent
trait MyState
- //#readJournalFor
+ // #readJournalFor
import akka.persistence.query.PersistenceQuery
import akka.persistence.r2dbc.query.scaladsl.R2dbcReadJournal
val eventQueries = PersistenceQuery(system)
.readJournalFor[R2dbcReadJournal](R2dbcReadJournal.Identifier)
- //#readJournalFor
+ // #readJournalFor
- //#durableStateStoreFor
+ // #durableStateStoreFor
import akka.persistence.state.DurableStateStoreRegistry
import akka.persistence.r2dbc.state.scaladsl.R2dbcDurableStateStore
val stateQueries = DurableStateStoreRegistry(system)
.durableStateStoreFor[R2dbcDurableStateStore[MyState]](R2dbcDurableStateStore.Identifier)
- //#durableStateStoreFor
+ // #durableStateStoreFor
{
- //#currentEventsByPersistenceId
+ // #currentEventsByPersistenceId
val persistenceId = PersistenceId("MyEntity", "id1")
eventQueries
.currentEventsByPersistenceId(persistenceId.id, 1, 101)
.map(envelope => s"event with seqNr ${envelope.sequenceNr}: ${envelope.event}")
.runWith(Sink.foreach(println))
- //#currentEventsByPersistenceId
+ // #currentEventsByPersistenceId
}
{
- //#currentEventsBySlices
+ // #currentEventsBySlices
import akka.persistence.query.typed.EventEnvelope
// Slit the slices into 4 ranges
@@ -54,11 +54,11 @@ object QueryDocCompileOnly {
s"event from persistenceId ${envelope.persistenceId} with " +
s"seqNr ${envelope.sequenceNr}: ${envelope.event}")
.runWith(Sink.foreach(println))
- //#currentEventsBySlices
+ // #currentEventsBySlices
}
{
- //#currentChangesBySlices
+ // #currentChangesBySlices
import akka.persistence.query.UpdatedDurableState
// Slit the slices into 4 ranges
@@ -76,6 +76,6 @@ object QueryDocCompileOnly {
s"state change from persistenceId ${change.persistenceId} with " +
s"revision ${change.revision}: ${change.value}")
.runWith(Sink.foreach(println))
- //#currentChangesBySlices
+ // #currentChangesBySlices
}
}
diff --git a/project/AutomaticModuleName.scala b/project/AutomaticModuleName.scala
index 46f9f18..67ebd3d 100644
--- a/project/AutomaticModuleName.scala
+++ b/project/AutomaticModuleName.scala
@@ -16,5 +16,5 @@ object AutomaticModuleName {
private val AutomaticModuleName = "Automatic-Module-Name"
def settings(name: String): Seq[Def.Setting[Task[Seq[PackageOption]]]] = Seq(
- Compile / packageBin / packageOptions += Package.ManifestAttributes(AutomaticModuleName → name))
+ Compile / packageBin / packageOptions += Package.ManifestAttributes(AutomaticModuleName -> name))
}
diff --git a/projection/src/main/scala/akka/projection/r2dbc/internal/R2dbcProjectionImpl.scala b/projection/src/main/scala/akka/projection/r2dbc/internal/R2dbcProjectionImpl.scala
index 286a2d0..f4e0550 100644
--- a/projection/src/main/scala/akka/projection/r2dbc/internal/R2dbcProjectionImpl.scala
+++ b/projection/src/main/scala/akka/projection/r2dbc/internal/R2dbcProjectionImpl.scala
@@ -150,7 +150,6 @@ private[projection] object R2dbcProjectionImpl {
offsetStore: R2dbcOffsetStore,
r2dbcExecutor: R2dbcExecutor)(implicit ec: ExecutionContext, system: ActorSystem[_]): () => Handler[Envelope] = {
() =>
-
new AdaptedR2dbcHandler(handlerFactory()) {
override def process(envelope: Envelope): Future[Done] = {
offsetStore.isAccepted(envelope).flatMap {
@@ -186,7 +185,6 @@ private[projection] object R2dbcProjectionImpl {
r2dbcExecutor: R2dbcExecutor)(implicit
ec: ExecutionContext,
system: ActorSystem[_]): () => Handler[immutable.Seq[Envelope]] = { () =>
-
new AdaptedR2dbcHandler(handlerFactory()) {
override def process(envelopes: immutable.Seq[Envelope]): Future[Done] = {
offsetStore.filterAccepted(envelopes).flatMap { acceptedEnvelopes =>
@@ -284,7 +282,6 @@ private[projection] object R2dbcProjectionImpl {
offsetStore: R2dbcOffsetStore)(implicit
ec: ExecutionContext,
system: ActorSystem[_]): () => Handler[immutable.Seq[Envelope]] = { () =>
-
new AdaptedHandler(handlerFactory()) {
override def process(envelopes: immutable.Seq[Envelope]): Future[Done] = {
offsetStore.filterAccepted(envelopes).flatMap { acceptedEnvelopes =>
@@ -455,7 +452,7 @@ private[projection] class R2dbcProjectionImpl[Offset, Envelope](
val newStrategy = offsetStrategy match {
case s: ExactlyOnce => s.copy(recoveryStrategy = Some(recoveryStrategy))
case s: AtLeastOnce => s.copy(recoveryStrategy = Some(recoveryStrategy))
- //NOTE: AtMostOnce has its own withRecoveryStrategy variant
+ // NOTE: AtMostOnce has its own withRecoveryStrategy variant
// this method is not available for AtMostOnceProjection
case s: AtMostOnce => s
}
diff --git a/projection/src/test/scala/akka/projection/r2dbc/EventSourcedChaosSpec.scala b/projection/src/test/scala/akka/projection/r2dbc/EventSourcedChaosSpec.scala
index 6bd9f25..d809d98 100644
--- a/projection/src/test/scala/akka/projection/r2dbc/EventSourcedChaosSpec.scala
+++ b/projection/src/test/scala/akka/projection/r2dbc/EventSourcedChaosSpec.scala
@@ -198,7 +198,8 @@ class EventSourcedChaosSpec
log.error(
s"Iteration #$iteration. Processed [${processed.size}] events, but expected [$expectedEventCounts]. " +
s"Missing [${missing.mkString(",")}]. " +
- s"Received [${processed.map(p => s"(${p.envelope.event}, ${p.envelope.persistenceId}, ${p.envelope.sequenceNr})").mkString(", ")}]. " +
+ s"Received [${processed.map(p =>
+ s"(${p.envelope.event}, ${p.envelope.persistenceId}, ${p.envelope.sequenceNr})").mkString(", ")}]. " +
s"Seed [$seed].")
throw e
}
diff --git a/projection/src/test/scala/akka/projection/r2dbc/EventSourcedEndToEndSpec.scala b/projection/src/test/scala/akka/projection/r2dbc/EventSourcedEndToEndSpec.scala
index efb4d47..e16e330 100644
--- a/projection/src/test/scala/akka/projection/r2dbc/EventSourcedEndToEndSpec.scala
+++ b/projection/src/test/scala/akka/projection/r2dbc/EventSourcedEndToEndSpec.scala
@@ -264,8 +264,9 @@ class EventSourcedEndToEndSpec
case e: AssertionError =>
val missing = expectedEvents.diff(processed.map(_.envelope.event))
log.error(s"Processed [${processed.size}] events, but expected [$numberOfEvents]. " +
- s"Missing [${missing.mkString(",")}]. " +
- s"Received [${processed.map(p => s"(${p.envelope.event}, ${p.envelope.persistenceId}, ${p.envelope.sequenceNr})").mkString(", ")}]. ")
+ s"Missing [${missing.mkString(",")}]. " +
+ s"Received [${processed.map(p =>
+ s"(${p.envelope.event}, ${p.envelope.persistenceId}, ${p.envelope.sequenceNr})").mkString(", ")}]. ")
throw e
}
}
diff --git a/projection/src/test/scala/akka/projection/r2dbc/EventSourcedPubSubSpec.scala b/projection/src/test/scala/akka/projection/r2dbc/EventSourcedPubSubSpec.scala
index ce7e969..1e87044 100644
--- a/projection/src/test/scala/akka/projection/r2dbc/EventSourcedPubSubSpec.scala
+++ b/projection/src/test/scala/akka/projection/r2dbc/EventSourcedPubSubSpec.scala
@@ -144,8 +144,9 @@ class EventSourcedPubSubSpec
case e: AssertionError =>
val missing = expectedEvents.diff(processed.map(_.envelope.event))
log.error(s"Processed [${processed.size}] events, but expected [$numberOfEvents]. " +
- s"Missing [${missing.mkString(",")}]. " +
- s"Received [${processed.map(p => s"(${p.envelope.event}, ${p.envelope.persistenceId}, ${p.envelope.sequenceNr})").mkString(", ")}]. ")
+ s"Missing [${missing.mkString(",")}]. " +
+ s"Received [${processed.map(p =>
+ s"(${p.envelope.event}, ${p.envelope.persistenceId}, ${p.envelope.sequenceNr})").mkString(", ")}]. ")
throw e
}
}
diff --git a/projection/src/test/scala/akka/projection/r2dbc/R2dbcOffsetStoreSpec.scala b/projection/src/test/scala/akka/projection/r2dbc/R2dbcOffsetStoreSpec.scala
index b3ae4c4..f505c64 100644
--- a/projection/src/test/scala/akka/projection/r2dbc/R2dbcOffsetStoreSpec.scala
+++ b/projection/src/test/scala/akka/projection/r2dbc/R2dbcOffsetStoreSpec.scala
@@ -128,7 +128,7 @@ class R2dbcOffsetStoreSpec
val offsetStore = createOffsetStore(projectionId)
val timeUuidOffset =
- TimeBasedUUID(UUID.fromString("49225740-2019-11ea-a752-ffae2393b6e4")) //2019-12-16T15:32:36.148Z[UTC]
+ TimeBasedUUID(UUID.fromString("49225740-2019-11ea-a752-ffae2393b6e4")) // 2019-12-16T15:32:36.148Z[UTC]
offsetStore.saveOffset(timeUuidOffset).futureValue
val offset = offsetStore.readOffset[TimeBasedUUID]()
offset.futureValue shouldBe Some(timeUuidOffset)
diff --git a/projection/src/test/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala b/projection/src/test/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala
index 4e46bda..4ffc494 100644
--- a/projection/src/test/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala
+++ b/projection/src/test/scala/akka/projection/r2dbc/R2dbcProjectionSpec.scala
@@ -824,7 +824,6 @@ class R2dbcProjectionSpec
.withSaveOffset(10, 1.minute)
projectionTestKit.runWithTestSink(projection) { sinkProbe =>
-
eventually {
sourceProbe.get should not be null
}
@@ -870,7 +869,6 @@ class R2dbcProjectionSpec
.withSaveOffset(10, 2.seconds)
projectionTestKit.runWithTestSink(projection) { sinkProbe =>
-
eventually {
sourceProbe.get should not be null
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org