Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version = 3.9.3
runner.dialect = scala213
version = 3.11.1
runner.dialect = scala213source3
project.git = true
style = defaultWithAlign
docstrings.style = Asterisk
Expand Down Expand Up @@ -77,3 +77,13 @@ project.excludeFilters = [
"scripts/authors.scala"
]
project.layout = StandardConvention

rewrite.scala3.convertToNewSyntax = true
runner {
dialectOverride {
allowSignificantIndentation = false
allowAsForImportRename = false
allowStarWildcardImport = false
allowPostfixStarVarargSplices = false
}
}
2 changes: 1 addition & 1 deletion docs-gen/project/PekkoSamplePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object PekkoSamplePlugin extends sbt.AutoPlugin {
outDir
})

override def projectSettings: Seq[Setting[_]] =
override def projectSettings: Seq[Setting[?]] =
themeSettings ++
propertiesSettings ++
sourceDirectorySettings ++
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ final class ClusterClient(settings: ClusterClientSettings)(
val originalSender = sender()
val session = sessionRef.get(originalSender) match {
case Some(ses) => ses
case None =>
case None =>
val ses = newSession(
settings,
receptionistServiceClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ object App {
val service = ctx.spawn(StatsService(workers), "StatsService")

// published through the receptionist to the other nodes in the cluster
ctx.system.receptionist ! Receptionist
ctx.system.receptionist !
Receptionist
.Register(StatsServiceKey, service)
}
if (cluster.selfMember.hasRole("client")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ object AppOneMaster {
ctx.log.info("Starting {} workers", numberOfWorkers)
(0 to numberOfWorkers).foreach { n =>
val worker = ctx.spawn(StatsWorker(), s"StatsWorker$n")
ctx.system.receptionist ! Receptionist
ctx.system.receptionist !
Receptionist
.Register(WorkerServiceKey, worker)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ object ReplicatedCache {
replyTo ! Cached(key, g.dataValue.get(key))
Behaviors.same

case InternalGetResponse(key, replyTo, _: NotFound[_]) =>
case InternalGetResponse(key, replyTo, _: NotFound[?]) =>
replyTo ! Cached(key, None)
Behaviors.same

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ object ReplicatedMetrics {
Behaviors.same

case InternalSubscribeResponse(_) => Behaviors.same // ok
case InternalUpdateResponse(_: UpdateResponse[_]) => Behaviors.same // ok
case InternalUpdateResponse(_: UpdateResponse[?]) => Behaviors.same // ok

case InternalClusterMemberUp(ClusterEvent.MemberUp(m)) =>
nodesInCluster += nodeKey(m.address)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ object ShoppingCart {
}

def receiveOther: PartialFunction[Command, Behavior[Command]] = {
case InternalUpdateResponse(_: UpdateSuccess[_]) => Behaviors.same
case InternalUpdateResponse(_: UpdateTimeout[_]) => Behaviors.same
case InternalUpdateResponse(_: UpdateSuccess[?]) => Behaviors.same
case InternalUpdateResponse(_: UpdateTimeout[?]) => Behaviors.same
// UpdateTimeout, will eventually be replicated
case InternalUpdateResponse(e: UpdateFailure[_]) => throw new IllegalStateException("Unexpected failure: " + e)
case InternalUpdateResponse(e: UpdateFailure[?]) => throw new IllegalStateException("Unexpected failure: " + e)
}

behavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ object VotingService {

Behaviors.same

case InternalUpdateResponse(_: UpdateSuccess[_]) => Behaviors.same
case InternalUpdateResponse(_: UpdateSuccess[?]) => Behaviors.same

case Close =>
replicatorFlag.askUpdate(
Expand Down Expand Up @@ -103,8 +103,8 @@ object VotingService {
replyTo ! Votes(Map.empty, open)
Behaviors.same

case InternalGetResponse(_, _: GetFailure[_]) => Behaviors.same
case InternalUpdateResponse(_: UpdateSuccess[_]) => Behaviors.same
case InternalGetResponse(_, _: GetFailure[?]) => Behaviors.same
case InternalUpdateResponse(_: UpdateSuccess[?]) => Behaviors.same
}

start
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object WorkManagerSingleton {
private val singletonName = "work-manager"
private val singletonRole = "back-end"

def init(system: ActorSystem[_]): ActorRef[Command] = {
def init(system: ActorSystem[?]): ActorRef[Command] = {
val workTimeout = system.settings.config.getDuration("distributed-workers.work-timeout").getSeconds.seconds

ClusterSingleton(system).init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object HttpToGrpc {
log.info("hello request")
onComplete(client.sayHello(HelloRequest(name))) {
case Success(reply) => complete(reply.message)
case Failure(t) =>
case Failure(t) =>
log.error(t, "Request failed")
complete(StatusCodes.InternalServerError, t.getMessage)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ object Main {
}

def startGrpc(
system: ActorSystem[_], frontEndPort: Int, region: ActorRef[UserEvents.Command]): Future[Http.ServerBinding] = {
system: ActorSystem[?], frontEndPort: Int, region: ActorRef[UserEvents.Command]): Future[Http.ServerBinding] = {
val mat = Materializer.createMaterializer(system.toClassic)
val service: HttpRequest => Future[HttpResponse] =
UserServiceHandler(new UserGrpcService(system, region))(system.toClassic)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import scala.concurrent.Future
import scala.concurrent.duration._

object UserEvents {
def init(system: ActorSystem[_], settings: ProcessorSettings): Future[ActorRef[Command]] = {
def init(system: ActorSystem[?], settings: ProcessorSettings): Future[ActorRef[Command]] = {
import system.executionContext
KafkaClusterSharding(settings.system).messageExtractorNoEnvelope(
timeout = 10.seconds,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object UserEventsKafkaProcessor {
def apply(shardRegion: ActorRef[UserEvents.Command], processorSettings: ProcessorSettings): Behavior[Nothing] = {
Behaviors
.setup[Command] { ctx =>
implicit val sys: TypedActorSystem[_] = ctx.system
implicit val sys: TypedActorSystem[?] = ctx.system
val result = startConsumingFromTopic(shardRegion, processorSettings)

ctx.pipeToSelf(result) {
Expand All @@ -50,7 +50,7 @@ object UserEventsKafkaProcessor {
}

private def startConsumingFromTopic(shardRegion: ActorRef[UserEvents.Command], processorSettings: ProcessorSettings)(
implicit actorSystem: TypedActorSystem[_]): Future[Done] = {
implicit actorSystem: TypedActorSystem[?]): Future[Done] = {

implicit val ec: ExecutionContext = actorSystem.executionContext
implicit val scheduler: Scheduler = actorSystem.toClassic.scheduler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import sample.sharding.kafka.UserEvents.{ Command, GetRunningTotal, RunningTotal
import scala.concurrent.duration._
import scala.concurrent.{ ExecutionContextExecutor, Future }

class UserGrpcService(system: ActorSystem[_], shardRegion: ActorRef[Command]) extends UserService {
class UserGrpcService(system: ActorSystem[?], shardRegion: ActorRef[Command]) extends UserService {

implicit val timeout: Timeout = Timeout(5.seconds)
implicit val sched: Scheduler = system.scheduler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ class Auction(
}

private def shouldClose(state: AuctionState): Boolean = {
responsibleForClosing && (state.phase match {
responsibleForClosing &&
(state.phase match {
case Closing(alreadyFinishedAtDc) =>
val allDone = MainApp.AllReplicas.diff(alreadyFinishedAtDc).isEmpty
if (!allDone) {
Expand Down Expand Up @@ -238,7 +239,8 @@ object Auction {
// If timestamps are equal, choose by dc where the offer was submitted
// In real auctions, this last comparison should be deterministic but unpredictable, so that submitting to a
// particular DC would not be an advantage.
(first.offer == second.offer && first.timestamp.equals(second.timestamp) && first.originReplica.id
(first.offer == second.offer && first.timestamp.equals(second.timestamp) &&
first.originReplica.id
.compareTo(second.originReplica.id) < 0)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import scala.util.{ Failure, Success }
object ThumbsUpHttp {

def route(selfReplica: ReplicaId, res: ReplicatedSharding[ThumbsUpCounter.Command])(
implicit system: ActorSystem[_]): Route = {
implicit system: ActorSystem[?]): Route = {

import org.apache.pekko.http.scaladsl.server.Directives._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ object ShoppingCart {

private def handleEvent(state: State, event: Event) = {
event match {
case ItemAdded(_, itemId, quantity) => state.updateItem(itemId, quantity)
case ItemRemoved(_, itemId) => state.removeItem(itemId)
case ItemAdded(_, itemId, quantity) => state.updateItem(itemId, quantity)
case ItemRemoved(_, itemId) => state.removeItem(itemId)
case ItemQuantityAdjusted(_, itemId, quantity) =>
state.updateItem(itemId, quantity)
case CheckedOut(_, eventTime) => state.checkout(eventTime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ object Guardian {

object FogSettings {

def apply(system: ActorSystem[_]): FogSettings = {
def apply(system: ActorSystem[?]): FogSettings = {
apply(system.settings.config.getConfig("killrweather.fog"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ private[killrweather] object WeatherHttpServer {
/**
* Logic to bind the given routes to a HTTP port and add some logging around it
*/
def start(routes: Route, port: Int, system: ActorSystem[_]): Unit = {
def start(routes: Route, port: Int, system: ActorSystem[?]): Unit = {
import org.apache.pekko.actor.typed.scaladsl.adapter._
implicit val classicSystem: classic.ActorSystem = system.toClassic
val shutdown = CoordinatedShutdown(classicSystem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.apache.pekko.util.Timeout
* 1. Receiving data from remote weather stations
* 2. Receiving and responding to queries
*/
private[killrweather] final class WeatherRoutes(system: ActorSystem[_]) {
private[killrweather] final class WeatherRoutes(system: ActorSystem[?]) {

private val sharding = ClusterSharding(system)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private[killrweather] object WeatherStation {
val TypeKey: EntityTypeKey[WeatherStation.Command] =
EntityTypeKey[WeatherStation.Command]("WeatherStation")

def initSharding(system: ActorSystem[_]): Unit =
def initSharding(system: ActorSystem[?]): Unit =
ClusterSharding(system).init(Entity(TypeKey) { entityContext =>
WeatherStation(entityContext.entityId)
})
Expand Down
Loading