From 1afdbde7d1cc3012b603872a5b8e405c7149be16 Mon Sep 17 00:00:00 2001 From: Alex Liubymov Date: Thu, 21 Sep 2023 17:07:14 +0300 Subject: [PATCH] fix scala3 build, naming --- build.sbt | 38 +++++++++---------- .../runtime/rpc/http4s/HttpServer.scala | 10 ++--- ...spatcher.scala => HttpRpcDispatcher.scala} | 6 +-- ...y.scala => HttpRpcDispatcherFactory.scala} | 6 +-- ...Dispatcher.scala => WsRpcDispatcher.scala} | 12 +++--- ...ory.scala => WsRpcDispatcherFactory.scala} | 28 +++++++------- .../rpc/http4s/ws/WsClientSession.scala | 2 +- .../rpc/http4s/ws/WsRequestState.scala | 2 +- ...essageHandler.scala => WsRpcHandler.scala} | 6 +-- .../rpc/http4s/Http4sTransportTest.scala | 2 +- .../http4s/fixtures/Http4sTestContext.scala | 16 ++++---- project/plugins.sbt | 4 +- 12 files changed, 66 insertions(+), 66 deletions(-) rename idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/{HttpRpcClientDispatcher.scala => HttpRpcDispatcher.scala} (96%) rename idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/{HttpRpcClientDispatcherFactory.scala => HttpRpcDispatcherFactory.scala} (90%) rename idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/{WsRpcClientDispatcher.scala => WsRpcDispatcher.scala} (86%) rename idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/{WsRpcClientDispatcherFactory.scala => WsRpcDispatcherFactory.scala} (87%) rename idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/{WsMessageHandler.scala => WsRpcHandler.scala} (96%) diff --git a/build.sbt b/build.sbt index 5fe1af63..515ff580 100644 --- a/build.sbt +++ b/build.sbt @@ -124,7 +124,7 @@ lazy val `idealingua-v1-model` = crossProject(JVMPlatform, JSPlatform).crossType "-Ycache-plugin-class-loader:always", "-Ycache-macro-class-loader:last-modified" ) - case (_, "3.3.1-RC4") => Seq( + case (_, "3.3.1") => Seq( "-release:8", "-Ykind-projector:underscores", "-no-indent", @@ -143,7 +143,7 @@ lazy val `idealingua-v1-model` = crossProject(JVMPlatform, JSPlatform).crossType ) .jvmSettings( crossScalaVersions := Seq( - "3.3.1-RC4", + "3.3.1", "2.13.11", "2.12.18" ), @@ -151,7 +151,7 @@ lazy val `idealingua-v1-model` = crossProject(JVMPlatform, JSPlatform).crossType ) .jsSettings( crossScalaVersions := Seq( - "3.3.1-RC4", + "3.3.1", "2.13.11", "2.12.18" ), @@ -275,7 +275,7 @@ lazy val `idealingua-v1-core` = crossProject(JVMPlatform, JSPlatform).crossType( "-Ycache-plugin-class-loader:always", "-Ycache-macro-class-loader:last-modified" ) - case (_, "3.3.1-RC4") => Seq( + case (_, "3.3.1") => Seq( "-release:8", "-Ykind-projector:underscores", "-no-indent", @@ -439,7 +439,7 @@ lazy val `idealingua-v1-runtime-rpc-scala` = crossProject(JVMPlatform, JSPlatfor "-Ycache-plugin-class-loader:always", "-Ycache-macro-class-loader:last-modified" ) - case (_, "3.3.1-RC4") => Seq( + case (_, "3.3.1") => Seq( "-release:8", "-Ykind-projector:underscores", "-no-indent", @@ -458,7 +458,7 @@ lazy val `idealingua-v1-runtime-rpc-scala` = crossProject(JVMPlatform, JSPlatfor ) .jvmSettings( crossScalaVersions := Seq( - "3.3.1-RC4", + "3.3.1", "2.13.11", "2.12.18" ), @@ -466,7 +466,7 @@ lazy val `idealingua-v1-runtime-rpc-scala` = crossProject(JVMPlatform, JSPlatfor ) .jsSettings( crossScalaVersions := Seq( - "3.3.1-RC4", + "3.3.1", "2.13.11", "2.12.18" ), @@ -508,7 +508,7 @@ lazy val `idealingua-v1-runtime-rpc-http4s` = project.in(file("idealingua-v1/ide ) .settings( crossScalaVersions := Seq( - "3.3.1-RC4", + "3.3.1", "2.13.11", "2.12.18" ), @@ -608,7 +608,7 @@ lazy val `idealingua-v1-runtime-rpc-http4s` = project.in(file("idealingua-v1/ide "-Ycache-plugin-class-loader:always", "-Ycache-macro-class-loader:last-modified" ) - case (_, "3.3.1-RC4") => Seq( + case (_, "3.3.1") => Seq( "-release:8", "-Ykind-projector:underscores", "-no-indent", @@ -752,7 +752,7 @@ lazy val `idealingua-v1-transpilers` = crossProject(JVMPlatform, JSPlatform).cro "-Ycache-plugin-class-loader:always", "-Ycache-macro-class-loader:last-modified" ) - case (_, "3.3.1-RC4") => Seq( + case (_, "3.3.1") => Seq( "-release:8", "-Ykind-projector:underscores", "-no-indent", @@ -820,7 +820,7 @@ lazy val `idealingua-v1-test-defs` = project.in(file("idealingua-v1/idealingua-v ) .settings( crossScalaVersions := Seq( - "3.3.1-RC4", + "3.3.1", "2.13.11", "2.12.18" ), @@ -920,7 +920,7 @@ lazy val `idealingua-v1-test-defs` = project.in(file("idealingua-v1/idealingua-v "-Ycache-plugin-class-loader:always", "-Ycache-macro-class-loader:last-modified" ) - case (_, "3.3.1-RC4") => Seq( + case (_, "3.3.1") => Seq( "-release:8", "-Ykind-projector:underscores", "-no-indent", @@ -951,7 +951,7 @@ lazy val `idealingua-v1-runtime-rpc-typescript` = project.in(file("idealingua-v1 ) .settings( crossScalaVersions := Seq( - "3.3.1-RC4", + "3.3.1", "2.13.11", "2.12.18" ), @@ -1051,7 +1051,7 @@ lazy val `idealingua-v1-runtime-rpc-typescript` = project.in(file("idealingua-v1 "-Ycache-plugin-class-loader:always", "-Ycache-macro-class-loader:last-modified" ) - case (_, "3.3.1-RC4") => Seq( + case (_, "3.3.1") => Seq( "-release:8", "-Ykind-projector:underscores", "-no-indent", @@ -1082,7 +1082,7 @@ lazy val `idealingua-v1-runtime-rpc-go` = project.in(file("idealingua-v1/idealin ) .settings( crossScalaVersions := Seq( - "3.3.1-RC4", + "3.3.1", "2.13.11", "2.12.18" ), @@ -1182,7 +1182,7 @@ lazy val `idealingua-v1-runtime-rpc-go` = project.in(file("idealingua-v1/idealin "-Ycache-plugin-class-loader:always", "-Ycache-macro-class-loader:last-modified" ) - case (_, "3.3.1-RC4") => Seq( + case (_, "3.3.1") => Seq( "-release:8", "-Ykind-projector:underscores", "-no-indent", @@ -1213,7 +1213,7 @@ lazy val `idealingua-v1-runtime-rpc-csharp` = project.in(file("idealingua-v1/ide ) .settings( crossScalaVersions := Seq( - "3.3.1-RC4", + "3.3.1", "2.13.11", "2.12.18" ), @@ -1313,7 +1313,7 @@ lazy val `idealingua-v1-runtime-rpc-csharp` = project.in(file("idealingua-v1/ide "-Ycache-plugin-class-loader:always", "-Ycache-macro-class-loader:last-modified" ) - case (_, "3.3.1-RC4") => Seq( + case (_, "3.3.1") => Seq( "-release:8", "-Ykind-projector:underscores", "-no-indent", @@ -1452,7 +1452,7 @@ lazy val `idealingua-v1-compiler` = project.in(file("idealingua-v1/idealingua-v1 "-Ycache-plugin-class-loader:always", "-Ycache-macro-class-loader:last-modified" ) - case (_, "3.3.1-RC4") => Seq( + case (_, "3.3.1") => Seq( "-release:8", "-Ykind-projector:underscores", "-no-indent", diff --git a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/HttpServer.scala b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/HttpServer.scala index 71d95fd6..8ced0c0c 100644 --- a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/HttpServer.scala +++ b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/HttpServer.scala @@ -13,7 +13,7 @@ import izumi.functional.bio.{Exit, F, IO2, Primitives2, Temporal2, UnsafeRun2} import izumi.fundamentals.platform.language.Quirks import izumi.fundamentals.platform.time.IzTime import izumi.idealingua.runtime.rpc.* -import izumi.idealingua.runtime.rpc.http4s.HttpServer.{ServerWsMessageHandler, WsResponseMarker} +import izumi.idealingua.runtime.rpc.http4s.HttpServer.{ServerWsRpcHandler, WsResponseMarker} import izumi.idealingua.runtime.rpc.http4s.ws.* import izumi.idealingua.runtime.rpc.http4s.ws.WsClientSession.WsClientSessionImpl import izumi.idealingua.runtime.rpc.http4s.ws.WsContextProvider.WsAuthResult @@ -153,8 +153,8 @@ class HttpServer[F[+_, +_]: IO2: Temporal2: Primitives2: UnsafeRun2, RequestCtx, }).map(_.map(p => printer.print(p.asJson))) } - protected def wsHandler(context: WsClientSession[F, RequestCtx, ClientId]): WsMessageHandler[F, RequestCtx] = { - new ServerWsMessageHandler(muxer, wsContextProvider, context, logger) + protected def wsHandler(context: WsClientSession[F, RequestCtx, ClientId]): WsRpcHandler[F, RequestCtx] = { + new ServerWsRpcHandler(muxer, wsContextProvider, context, logger) } protected def onWsHeartbeat(requestTime: ZonedDateTime): F[Throwable, Unit] = { @@ -232,12 +232,12 @@ class HttpServer[F[+_, +_]: IO2: Temporal2: Primitives2: UnsafeRun2, RequestCtx, object HttpServer { case object WsResponseMarker - class ServerWsMessageHandler[F[+_, +_]: IO2, RequestCtx, ClientId]( + class ServerWsRpcHandler[F[+_, +_]: IO2, RequestCtx, ClientId]( muxer: IRTServerMultiplexor[F, RequestCtx], wsContextProvider: WsContextProvider[F, RequestCtx, ClientId], context: WsClientSession[F, RequestCtx, ClientId], logger: LogIO2[F], - ) extends WsMessageHandler[F, RequestCtx](muxer, context, logger) { + ) extends WsRpcHandler[F, RequestCtx](muxer, context, logger) { override def handlePacket(packet: RpcPacket): F[Throwable, Unit] = { wsContextProvider.toId(context.initialContext, context.id, packet).flatMap(context.updateId) } diff --git a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcClientDispatcher.scala b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcDispatcher.scala similarity index 96% rename from idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcClientDispatcher.scala rename to idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcDispatcher.scala index d7222c6b..55bd6e69 100644 --- a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcClientDispatcher.scala +++ b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcDispatcher.scala @@ -7,14 +7,14 @@ import io.circe.parser.parse import izumi.functional.bio.{Exit, F, IO2} import izumi.functional.lifecycle.Lifecycle import izumi.idealingua.runtime.rpc.* -import izumi.idealingua.runtime.rpc.http4s.clients.HttpRpcClientDispatcher.IRTDispatcherRaw +import izumi.idealingua.runtime.rpc.http4s.clients.HttpRpcDispatcher.IRTDispatcherRaw import izumi.idealingua.runtime.rpc.http4s.{HttpExecutionContext, IRTUnexpectedHttpStatus} import logstage.LogIO2 import org.http4s.* import org.http4s.blaze.client.* import org.http4s.client.Client -class HttpRpcClientDispatcher[F[+_, +_]: IO2]( +class HttpRpcDispatcher[F[+_, +_]: IO2]( uri: Uri, codec: IRTClientMultiplexor[F], executionContext: HttpExecutionContext, @@ -121,7 +121,7 @@ class HttpRpcClientDispatcher[F[+_, +_]: IO2]( } } -object HttpRpcClientDispatcher { +object HttpRpcDispatcher { trait IRTDispatcherRaw[F[_, _]] extends IRTDispatcher[F] { def dispatchRaw(method: IRTMethodId, body: String): F[Throwable, IRTMuxResponse] } diff --git a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcClientDispatcherFactory.scala b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcDispatcherFactory.scala similarity index 90% rename from idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcClientDispatcherFactory.scala rename to idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcDispatcherFactory.scala index 66c07e12..406411af 100644 --- a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcClientDispatcherFactory.scala +++ b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/HttpRpcDispatcherFactory.scala @@ -6,13 +6,13 @@ import izumi.functional.bio.{F, IO2} import izumi.fundamentals.platform.language.Quirks.Discarder import izumi.idealingua.runtime.rpc.* import izumi.idealingua.runtime.rpc.http4s.HttpExecutionContext -import izumi.idealingua.runtime.rpc.http4s.clients.HttpRpcClientDispatcher.IRTDispatcherRaw +import izumi.idealingua.runtime.rpc.http4s.clients.HttpRpcDispatcher.IRTDispatcherRaw import logstage.LogIO2 import org.http4s.* import org.http4s.blaze.client.BlazeClientBuilder import org.typelevel.ci.* -class HttpRpcClientDispatcherFactory[F[+_, +_]: IO2]( +class HttpRpcDispatcherFactory[F[+_, +_]: IO2]( codec: IRTClientMultiplexor[F], executionContext: HttpExecutionContext, printer: circe.Printer, @@ -25,7 +25,7 @@ class HttpRpcClientDispatcherFactory[F[+_, +_]: IO2]( tweakRequest: Request[F[Throwable, _]] => Request[F[Throwable, _]] = (req: Request[F[Throwable, _]]) => req, resourceCheck: F[Throwable, Unit] = F.unit, ): IRTDispatcherRaw[F] = { - new HttpRpcClientDispatcher[F](uri, codec, executionContext, printer, dispatcherLogger(uri, logger)) { + new HttpRpcDispatcher[F](uri, codec, executionContext, printer, dispatcherLogger(uri, logger)) { override def dispatch(input: IRTMuxRequest): F[Throwable, IRTMuxResponse] = { resourceCheck *> super.dispatch(input) } diff --git a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcClientDispatcher.scala b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcDispatcher.scala similarity index 86% rename from idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcClientDispatcher.scala rename to idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcDispatcher.scala index 222683ec..56462146 100644 --- a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcClientDispatcher.scala +++ b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcDispatcher.scala @@ -3,20 +3,20 @@ package izumi.idealingua.runtime.rpc.http4s.clients import io.circe.Json import izumi.functional.bio.{Async2, F, Temporal2} import izumi.idealingua.runtime.rpc.* -import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcClientDispatcher.WsRpcDispatcher -import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcClientDispatcherFactory.WsRpcClientConnection +import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcDispatcher.IRTDispatcherWs +import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcDispatcherFactory.WsRpcClientConnection import izumi.idealingua.runtime.rpc.http4s.ws.RawResponse import logstage.LogIO2 import java.util.concurrent.TimeoutException import scala.concurrent.duration.FiniteDuration -class WsRpcClientDispatcher[F[+_, +_]: Async2]( +class WsRpcDispatcher[F[+_, +_]: Async2]( connection: WsRpcClientConnection[F], timeout: FiniteDuration, codec: IRTClientMultiplexor[F], logger: LogIO2[F], -) extends WsRpcDispatcher[F] { +) extends IRTDispatcherWs[F] { override def authorize(headers: Map[String, String]): F[Throwable, Unit] = { connection.authorize(headers, timeout) @@ -60,8 +60,8 @@ class WsRpcClientDispatcher[F[+_, +_]: Async2]( } } -object WsRpcClientDispatcher { - trait WsRpcDispatcher[F[_, _]] extends IRTDispatcher[F] { +object WsRpcDispatcher { + trait IRTDispatcherWs[F[_, _]] extends IRTDispatcher[F] { def authorize(headers: Map[String, String]): F[Throwable, Unit] } } diff --git a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcClientDispatcherFactory.scala b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcDispatcherFactory.scala similarity index 87% rename from idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcClientDispatcherFactory.scala rename to idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcDispatcherFactory.scala index 315c5610..9f5a68b6 100644 --- a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcClientDispatcherFactory.scala +++ b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/clients/WsRpcDispatcherFactory.scala @@ -6,9 +6,9 @@ import izumi.functional.bio.{Async2, F, IO2, Primitives2, Temporal2, UnsafeRun2} import izumi.functional.lifecycle.Lifecycle import izumi.fundamentals.platform.language.Quirks.Discarder import izumi.idealingua.runtime.rpc.* -import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcClientDispatcher.WsRpcDispatcher -import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcClientDispatcherFactory.{ClientWsMessageHandler, WsRpcClientConnection, WsRpcContextProvider} -import izumi.idealingua.runtime.rpc.http4s.ws.{RawResponse, WsMessageHandler, WsRequestState} +import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcDispatcher.IRTDispatcherWs +import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcDispatcherFactory.{ClientWsRpcHandler, WsRpcClientConnection, WsRpcContextProvider} +import izumi.idealingua.runtime.rpc.http4s.ws.{RawResponse, WsRequestState, WsRpcHandler} import logstage.LogIO2 import org.asynchttpclient.netty.ws.NettyWebSocket import org.asynchttpclient.ws.{WebSocket, WebSocketListener, WebSocketUpgradeHandler} @@ -19,7 +19,7 @@ import java.util.concurrent.atomic.AtomicReference import scala.concurrent.duration.{DurationInt, FiniteDuration} import scala.jdk.CollectionConverters.* -class WsRpcClientDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: UnsafeRun2]( +class WsRpcDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: UnsafeRun2]( codec: IRTClientMultiplexor[F], printer: Printer, logger: LogIO2[F], @@ -31,7 +31,7 @@ class WsRpcClientDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: Un contextProvider: WsRpcContextProvider[ServerContext], ): Lifecycle[F[Throwable, _], WsRpcClientConnection[F]] = { for { - client <- WsRpcClientDispatcherFactory.asyncHttpClient[F] + client <- WsRpcDispatcherFactory.asyncHttpClient[F] requestState = new WsRequestState[F] listener <- Lifecycle.liftF(F.syncThrowable(createListener(muxer, contextProvider, requestState, dispatcherLogger(uri, logger)))) handler <- Lifecycle.liftF(F.syncThrowable(new WebSocketUpgradeHandler(List(listener).asJava))) @@ -47,11 +47,11 @@ class WsRpcClientDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: Un uri: Uri, muxer: IRTServerMultiplexor[F, ServerContext], contextProvider: WsRpcContextProvider[ServerContext], - tweakRequest: RpcPacket => RpcPacket, - timeout: FiniteDuration = 30.seconds, - ): Lifecycle[F[Throwable, _], WsRpcDispatcher[F]] = { + tweakRequest: RpcPacket => RpcPacket = identity, + timeout: FiniteDuration = 30.seconds, + ): Lifecycle[F[Throwable, _], IRTDispatcherWs[F]] = { connect(uri, muxer, contextProvider).map { - new WsRpcClientDispatcher(_, timeout, codec, dispatcherLogger(uri, logger)) { + new WsRpcDispatcher(_, timeout, codec, dispatcherLogger(uri, logger)) { override protected def buildRequest(rpcPacketId: RpcPacketId, method: IRTMethodId, body: Json): RpcPacket = { tweakRequest(super.buildRequest(rpcPacketId, method, body)) } @@ -64,8 +64,8 @@ class WsRpcClientDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: Un muxer: IRTServerMultiplexor[F, ServerContext], contextProvider: WsRpcContextProvider[ServerContext], requestState: WsRequestState[F], - ): WsMessageHandler[F, ServerContext] = { - new ClientWsMessageHandler(muxer, requestState, contextProvider, logger) + ): WsRpcHandler[F, ServerContext] = { + new ClientWsRpcHandler(muxer, requestState, contextProvider, logger) } protected def createListener[ServerContext]( @@ -110,7 +110,7 @@ class WsRpcClientDispatcherFactory[F[+_, +_]: Async2: Temporal2: Primitives2: Un } } -object WsRpcClientDispatcherFactory { +object WsRpcDispatcherFactory { def asyncHttpClient[F[+_, +_]: IO2]: Lifecycle[F[Throwable, _], DefaultAsyncHttpClient] = { Lifecycle.fromAutoCloseable(F.syncThrowable { new DefaultAsyncHttpClient( @@ -129,12 +129,12 @@ object WsRpcClientDispatcherFactory { }) } - class ClientWsMessageHandler[F[+_, +_]: IO2, ServerCtx]( + class ClientWsRpcHandler[F[+_, +_]: IO2, ServerCtx]( muxer: IRTServerMultiplexor[F, ServerCtx], requestState: WsRequestState[F], contextProvider: WsRpcContextProvider[ServerCtx], logger: LogIO2[F], - ) extends WsMessageHandler[F, ServerCtx](muxer, requestState, logger) { + ) extends WsRpcHandler[F, ServerCtx](muxer, requestState, logger) { override def handlePacket(packet: RpcPacket): F[Throwable, Unit] = { F.unit } diff --git a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsClientSession.scala b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsClientSession.scala index f3f83cf3..8c30f29b 100644 --- a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsClientSession.scala +++ b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsClientSession.scala @@ -7,7 +7,7 @@ import izumi.functional.bio.{F, IO2, Primitives2, Temporal2} import izumi.fundamentals.platform.time.IzTime import izumi.fundamentals.platform.uuid.UUIDGen import izumi.idealingua.runtime.rpc.* -import izumi.idealingua.runtime.rpc.http4s.ws.WsMessageHandler.WsClientResponder +import izumi.idealingua.runtime.rpc.http4s.ws.WsRpcHandler.WsClientResponder import logstage.LogIO2 import org.http4s.websocket.WebSocketFrame import org.http4s.websocket.WebSocketFrame.Text diff --git a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsRequestState.scala b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsRequestState.scala index f32a5d1b..125e2a42 100644 --- a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsRequestState.scala +++ b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsRequestState.scala @@ -5,7 +5,7 @@ import izumi.functional.bio.{F, IO2, Primitives2, Promise2, Temporal2} import izumi.fundamentals.platform.language.Quirks.* import izumi.idealingua.runtime.rpc.* import izumi.idealingua.runtime.rpc.http4s.ws.RawResponse.BadRawResponse -import izumi.idealingua.runtime.rpc.http4s.ws.WsMessageHandler.WsClientResponder +import izumi.idealingua.runtime.rpc.http4s.ws.WsRpcHandler.WsClientResponder import java.util.concurrent.ConcurrentHashMap import scala.concurrent.duration.FiniteDuration diff --git a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsMessageHandler.scala b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsRpcHandler.scala similarity index 96% rename from idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsMessageHandler.scala rename to idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsRpcHandler.scala index 3eea750e..91825663 100644 --- a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsMessageHandler.scala +++ b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/main/scala/izumi/idealingua/runtime/rpc/http4s/ws/WsRpcHandler.scala @@ -5,10 +5,10 @@ import izumi.functional.bio.Exit.Success import izumi.functional.bio.{Exit, F, IO2} import izumi.fundamentals.platform.language.Quirks.Discarder import izumi.idealingua.runtime.rpc.* -import izumi.idealingua.runtime.rpc.http4s.ws.WsMessageHandler.WsClientResponder +import izumi.idealingua.runtime.rpc.http4s.ws.WsRpcHandler.WsClientResponder import logstage.LogIO2 -abstract class WsMessageHandler[F[+_, +_]: IO2, RequestCtx]( +abstract class WsRpcHandler[F[+_, +_]: IO2, RequestCtx]( muxer: IRTServerMultiplexor[F, RequestCtx], responder: WsClientResponder[F], logger: LogIO2[F], @@ -125,7 +125,7 @@ abstract class WsMessageHandler[F[+_, +_]: IO2, RequestCtx]( } } -object WsMessageHandler { +object WsRpcHandler { trait WsClientResponder[F[_, _]] { def responseWith(id: RpcPacketId, response: RawResponse): F[Throwable, Unit] def responseWithData(id: RpcPacketId, data: Json): F[Throwable, Unit] diff --git a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/test/scala/izumi/idealingua/runtime/rpc/http4s/Http4sTransportTest.scala b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/test/scala/izumi/idealingua/runtime/rpc/http4s/Http4sTransportTest.scala index 3e3163aa..9438ac5b 100644 --- a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/test/scala/izumi/idealingua/runtime/rpc/http4s/Http4sTransportTest.scala +++ b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/test/scala/izumi/idealingua/runtime/rpc/http4s/Http4sTransportTest.scala @@ -4,7 +4,7 @@ import izumi.functional.bio.Exit.{Error, Interruption, Success, Termination} import izumi.functional.bio.F import izumi.fundamentals.platform.language.Quirks.* import izumi.idealingua.runtime.rpc.* -import izumi.idealingua.runtime.rpc.http4s.clients.HttpRpcClientDispatcher.IRTDispatcherRaw +import izumi.idealingua.runtime.rpc.http4s.clients.HttpRpcDispatcher.IRTDispatcherRaw import izumi.r2.idealingua.test.generated.{GreeterServiceClientWrapped, GreeterServiceMethods} import org.http4s.* import org.http4s.blaze.server.* diff --git a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/test/scala/izumi/idealingua/runtime/rpc/http4s/fixtures/Http4sTestContext.scala b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/test/scala/izumi/idealingua/runtime/rpc/http4s/fixtures/Http4sTestContext.scala index a04aee82..469d24dc 100644 --- a/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/test/scala/izumi/idealingua/runtime/rpc/http4s/fixtures/Http4sTestContext.scala +++ b/idealingua-v1/idealingua-v1-runtime-rpc-http4s/src/test/scala/izumi/idealingua/runtime/rpc/http4s/fixtures/Http4sTestContext.scala @@ -6,8 +6,8 @@ import izumi.functional.lifecycle.Lifecycle import izumi.fundamentals.platform.language.Quirks import izumi.fundamentals.platform.network.IzSockets import izumi.idealingua.runtime.rpc.http4s.* -import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcClientDispatcherFactory.WsRpcContextProvider -import izumi.idealingua.runtime.rpc.http4s.clients.{HttpRpcClientDispatcher, HttpRpcClientDispatcherFactory, WsRpcClientDispatcher, WsRpcClientDispatcherFactory} +import izumi.idealingua.runtime.rpc.http4s.clients.WsRpcDispatcherFactory.WsRpcContextProvider +import izumi.idealingua.runtime.rpc.http4s.clients.{HttpRpcDispatcher, HttpRpcDispatcherFactory, WsRpcDispatcher, WsRpcDispatcherFactory} import izumi.idealingua.runtime.rpc.http4s.ws.WsContextProvider.WsAuthResult import izumi.idealingua.runtime.rpc.http4s.ws.WsSessionsStorage.WsSessionsStorageImpl import izumi.idealingua.runtime.rpc.http4s.ws.{WsClientId, WsContextProvider, WsSessionListener} @@ -102,17 +102,17 @@ object Http4sTestContext { RT.printer, ) - final val httpClientFactory: HttpRpcClientDispatcherFactory[IO] = { - new HttpRpcClientDispatcherFactory[IO](demo.Client.codec, RT.execCtx, RT.printer, RT.logger) + final val httpClientFactory: HttpRpcDispatcherFactory[IO] = { + new HttpRpcDispatcherFactory[IO](demo.Client.codec, RT.execCtx, RT.printer, RT.logger) } - final def httpRpcClientDispatcher(headers: Headers): HttpRpcClientDispatcher.IRTDispatcherRaw[IO] = { + final def httpRpcClientDispatcher(headers: Headers): HttpRpcDispatcher.IRTDispatcherRaw[IO] = { httpClientFactory.dispatcher(baseUri, headers) } - final val wsClientFactory: WsRpcClientDispatcherFactory[IO] = { - new WsRpcClientDispatcherFactory[IO](demo.Client.codec, RT.printer, RT.logger) + final val wsClientFactory: WsRpcDispatcherFactory[IO] = { + new WsRpcDispatcherFactory[IO](demo.Client.codec, RT.printer, RT.logger) } - final def wsRpcClientDispatcher(): Lifecycle[IO[Throwable, _], WsRpcClientDispatcher.WsRpcDispatcher[IO]] = { + final def wsRpcClientDispatcher(): Lifecycle[IO[Throwable, _], WsRpcDispatcher.IRTDispatcherWs[IO]] = { wsClientFactory.dispatcher(wsUri, demo.Client.buzzerMultiplexor, WsRpcContextProvider.unit) } } diff --git a/project/plugins.sbt b/project/plugins.sbt index bb6762e0..a72c8513 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,10 +2,10 @@ // IT IS AUTOGENERATED BY `sbtgen.sc` SCRIPT // ALL CHANGES WILL BE LOST // https://www.scala-js.org/ -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.0") // https://github.com/portable-scala/sbt-crossproject -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2") +addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.1") // https://scalacenter.github.io/scalajs-bundler/ addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.21.1")