From 1ce2f11919b220ae87eed41a60b13e8b47b96a32 Mon Sep 17 00:00:00 2001 From: VladKopanev Date: Thu, 17 Oct 2019 15:37:02 +0300 Subject: [PATCH] Get rid of deprecated zio API usage --- core/src/main/scala/com/vladkopanev/zio/saga/Saga.scala | 7 +++---- .../scala/com/vladkopanev/zio/saga/example/SagaApp.scala | 8 ++++---- .../scala/com/vladkopanev/zio/saga/example/example.scala | 4 ++-- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/core/src/main/scala/com/vladkopanev/zio/saga/Saga.scala b/core/src/main/scala/com/vladkopanev/zio/saga/Saga.scala index eeebc76..3652e77 100644 --- a/core/src/main/scala/com/vladkopanev/zio/saga/Saga.scala +++ b/core/src/main/scala/com/vladkopanev/zio/saga/Saga.scala @@ -1,9 +1,8 @@ package com.vladkopanev.zio.saga import com.vladkopanev.zio.saga.Saga.Compensator -import zio.Cause +import zio.{ Cause, Exit, Fiber, IO, RIO, Schedule, Task, UIO, ZIO } import zio.clock.Clock -import zio.{ Exit, Fiber, IO, Schedule, Task, TaskR, UIO, ZIO } /** * A Saga is an immutable structure that models a distributed transaction. @@ -195,9 +194,9 @@ object Saga { implicit def UIOtoCompensable[A](uio: UIO[A]): Compensable[Any, Nothing, A] = new Compensable(uio) - implicit def TaskRtoCompensable[R, A](taskR: TaskR[R, A]): Compensable[R, Throwable, A] = new Compensable(taskR) + implicit def TaskRtoCompensable[R, A](rio: RIO[R, A]): Compensable[R, Throwable, A] = new Compensable(rio) - implicit def TaskToCompensable[A](taskR: Task[A]): Compensable[Any, Throwable, A] = new Compensable(taskR) + implicit def TaskToCompensable[A](task: Task[A]): Compensable[Any, Throwable, A] = new Compensable(task) // $COVERAGE-ON$ /** diff --git a/examples/src/main/scala/com/vladkopanev/zio/saga/example/SagaApp.scala b/examples/src/main/scala/com/vladkopanev/zio/saga/example/SagaApp.scala index c713413..59688af 100644 --- a/examples/src/main/scala/com/vladkopanev/zio/saga/example/SagaApp.scala +++ b/examples/src/main/scala/com/vladkopanev/zio/saga/example/SagaApp.scala @@ -8,7 +8,7 @@ import com.vladkopanev.zio.saga.example.dao.SagaLogDaoImpl import com.vladkopanev.zio.saga.example.endpoint.SagaEndpoint import zio.interop.catz._ import zio.console.putStrLn -import zio.{ App, ZIO } +import zio.{ App, ZEnv, ZIO } object SagaApp extends App { @@ -16,7 +16,7 @@ object SagaApp extends App { implicit val runtime = this - override def run(args: List[String]): ZIO[Environment, Nothing, Int] = { + override def run(args: List[String]): ZIO[ZEnv, Nothing, Int] = { val flakyClient = sys.env.getOrElse("FLAKY_CLIENT", "false").toBoolean val clientMaxReqTimeout = sys.env.getOrElse("CLIENT_MAX_REQUEST_TIMEOUT_SEC", "10").toInt val sagaMaxReqTimeout = sys.env.getOrElse("SAGA_MAX_REQUEST_TIMEOUT_SEC", "12").toInt @@ -31,8 +31,8 @@ object SagaApp extends App { _ <- orderSEC.recoverSagas.fork _ <- BlazeServerBuilder[TaskC].bindHttp(8042).withHttpApp(app).serve.compile.drain } yield ()).foldM( - e => putStrLn(s"Saga Coordinator fails with error $e, stopping server...").const(1), - _ => putStrLn(s"Saga Coordinator finished successfully, stopping server...").const(0) + e => putStrLn(s"Saga Coordinator fails with error $e, stopping server...").as(1), + _ => putStrLn(s"Saga Coordinator finished successfully, stopping server...").as(0) ) } diff --git a/examples/src/main/scala/com/vladkopanev/zio/saga/example/example.scala b/examples/src/main/scala/com/vladkopanev/zio/saga/example/example.scala index e3b32c0..ef7104a 100644 --- a/examples/src/main/scala/com/vladkopanev/zio/saga/example/example.scala +++ b/examples/src/main/scala/com/vladkopanev/zio/saga/example/example.scala @@ -1,7 +1,7 @@ package com.vladkopanev.zio.saga -import zio.TaskR +import zio.RIO import zio.clock.Clock package object example { - type TaskC[+A] = TaskR[Clock, A] + type TaskC[+A] = RIO[Clock, A] }