Skip to content

Commit e00c0fb

Browse files
authored
Upgrade zio-grpc (#56)
1 parent 044ec20 commit e00c0fb

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ val scala213 = "2.13.8"
22
val scala3 = "3.2.1"
33
val allScala = Seq(scala213, scala3)
44

5-
val zioVersion = "2.0.5"
6-
val zioGrpcVersion = "0.6.0-test7"
5+
val zioVersion = "2.0.6"
6+
val zioGrpcVersion = "0.6.0-rc1"
77
val zioK8sVersion = "2.0.1"
88
val zioCacheVersion = "0.2.1"
99
val zioCatsInteropVersion = "23.0.0.0"

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")
66
resolvers ++= Resolver.sonatypeOssRepos("snapshots")
77

88
libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.10"
9-
libraryDependencies += "com.thesamet.scalapb.zio-grpc" %% "zio-grpc-codegen" % "0.6.0-test7"
9+
libraryDependencies += "com.thesamet.scalapb.zio-grpc" %% "zio-grpc-codegen" % "0.6.0-rc1"

protocol-grpc/src/main/scala/com/devsisters/shardcake/GrpcPods.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import zio._
1212

1313
class GrpcPods(
1414
config: GrpcConfig,
15-
connections: Ref.Synchronized[Map[PodAddress, (ShardingServiceClient.ZService[Any], Fiber[Throwable, Nothing])]]
15+
connections: Ref.Synchronized[Map[PodAddress, (ShardingServiceClient, Fiber[Throwable, Nothing])]]
1616
) extends Pods {
17-
private def getConnection(pod: PodAddress): Task[ShardingServiceClient.ZService[Any]] =
17+
private def getConnection(pod: PodAddress): Task[ShardingServiceClient] =
1818
// optimize happy path and only get first
1919
connections.get.flatMap(_.get(pod) match {
2020
case Some((channel, _)) => ZIO.succeed(channel)
@@ -34,7 +34,7 @@ class GrpcPods(
3434
// create a fiber that never ends and keeps the connection alive
3535
for {
3636
_ <- ZIO.logDebug(s"Opening connection to pod $pod")
37-
promise <- Promise.make[Nothing, ShardingServiceClient.ZService[Any]]
37+
promise <- Promise.make[Nothing, ShardingServiceClient]
3838
fiber <-
3939
ZIO
4040
.scoped(
@@ -93,7 +93,7 @@ object GrpcPods {
9393
config <- ZIO.service[GrpcConfig]
9494
connections <-
9595
Ref.Synchronized
96-
.make(Map.empty[PodAddress, (ShardingServiceClient.ZService[Any], Fiber[Throwable, Nothing])])
96+
.make(Map.empty[PodAddress, (ShardingServiceClient, Fiber[Throwable, Nothing])])
9797
.withFinalizer(
9898
// stop all connection fibers on release
9999
_.get.flatMap(connections => ZIO.foreachDiscard(connections) { case (_, (_, fiber)) => fiber.interrupt })

protocol-grpc/src/main/scala/com/devsisters/shardcake/GrpcShardingService.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ package com.devsisters.shardcake
22

33
import com.devsisters.shardcake.errors.EntityNotManagedByThisPod
44
import com.devsisters.shardcake.interfaces.Pods.BinaryMessage
5-
import com.devsisters.shardcake.protobuf.sharding.ZioSharding.ZShardingService
5+
import com.devsisters.shardcake.protobuf.sharding.ZioSharding.ShardingService
66
import com.devsisters.shardcake.protobuf.sharding._
77
import com.google.protobuf.ByteString
88
import io.grpc.protobuf.services.ProtoReflectionService
99
import io.grpc.{ ServerBuilder, Status, StatusException, StatusRuntimeException }
10-
import scalapb.zio_grpc.{ ScopedServer, ServerLayer, ServiceList }
10+
import scalapb.zio_grpc.{ ScopedServer, ServiceList }
1111
import zio.{ Config => _, _ }
1212

13-
abstract class GrpcShardingService(sharding: Sharding, timeout: Duration) extends ZShardingService[Any] {
13+
abstract class GrpcShardingService(sharding: Sharding, timeout: Duration) extends ShardingService {
1414
def assignShards(request: AssignShardsRequest): ZIO[Any, Status, AssignShardsResponse] =
1515
sharding.assign(request.shards.toSet).as(AssignShardsResponse())
1616

0 commit comments

Comments
 (0)