Class/Object

zio

ZManaged

Related Docs: object ZManaged | package zio

Permalink

final case class ZManaged[-R, +E, +A](reserve: ZIO[R, E, Reservation[R, E, A]]) extends Product with Serializable

A ZManaged[R, E, A] is a managed resource of type A, which may be used by invoking the use method of the resource. The resource will be automatically acquired before the resource is used, and automatically released after the resource is used.

Resources do not survive the scope of use, meaning that if you attempt to capture the resource, leak it from use, and then use it after the resource has been consumed, the resource will not be valid anymore and may fail with some checked error, as per the type of the functions provided by the resource.

Self Type
ZManaged[R, E, A]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZManaged
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ZManaged(reserve: ZIO[R, E, Reservation[R, E, A]])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def &&&[R1 <: R, E1 >: E, B](that: ZManaged[R1, E1, B]): ZManaged[R1, E1, (A, B)]

    Permalink

    Symbolic alias for zip.

  4. final def &>[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, A1]

    Permalink

    Symbolic alias for zipParRight

  5. final def *>[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, A1]

    Permalink

    Symbolic alias for zipRight

  6. final def +++[R1, B, E1 >: E](that: ZManaged[R1, E1, B]): ZManaged[Either[R, R1], E1, Either[A, B]]

    Permalink
  7. final def <&[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, A]

    Permalink

    Symbolic alias for zipParLeft

  8. final def <&>[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, (A, A1)]

    Permalink

    Symbolic alias for zipPar

  9. final def <*[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, A]

    Permalink

    Symbolic alias for zipLeft.

  10. final def <*>[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, (A, A1)]

    Permalink

    Symbolic alias for zip.

  11. final def <<<[R1, E1 >: E](that: ZManaged[R1, E1, R]): ZManaged[R1, E1, A]

    Permalink

    Symbolic alias for compose

  12. final def <>[R1 <: R, E2, A1 >: A](that: ⇒ ZManaged[R1, E2, A1]): ZManaged[R1, E2, A1]

    Permalink

    Operator alias for orElse.

  13. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def >>=[R1 <: R, E1 >: E, B](k: (A) ⇒ ZManaged[R1, E1, B]): ZManaged[R1, E1, B]

    Permalink

    Symbolic alias for flatMap

  15. final def >>>[R1 >: A, E1 >: E, B](that: ZManaged[R1, E1, B]): ZManaged[R, E1, B]

    Permalink

    Symbolic alias for andThen

  16. final def absolve[R1 <: R, E1, B](implicit ev: <:<[ZManaged[R, E, A], ZManaged[R1, E1, Either[E1, B]]]): ZManaged[R1, E1, B]

    Permalink

    Submerges the error case of an Either into the ZManaged.

    Submerges the error case of an Either into the ZManaged. The inverse operation of ZManaged.either.

  17. final def andThen[R1 >: A, E1 >: E, B](that: ZManaged[R1, E1, B]): ZManaged[R, E1, B]

    Permalink

    Executes the this effect and then provides its output as an environment to the second effect

  18. final def as[B](b: ⇒ B): ZManaged[R, E, B]

    Permalink

    Maps this effect to the specified constant while preserving the effects of this effect.

  19. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  20. final def bimap[E1, A1](f: (E) ⇒ E1, g: (A) ⇒ A1): ZManaged[R, E1, A1]

    Permalink

    Returns an effect whose failure and success channels have been mapped by the specified pair of functions, f and g.

  21. final def catchAll[R1 <: R, E2, A1 >: A](h: (E) ⇒ ZManaged[R1, E2, A1]): ZManaged[R1, E2, A1]

    Permalink

    Recovers from all errors.

  22. final def catchSome[R1 <: R, E1 >: E, A1 >: A](pf: PartialFunction[E, ZManaged[R1, E1, A1]]): ZManaged[R1, E1, A1]

    Permalink

    Recovers from some or all of the error cases.

  23. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  24. final def compose[R1, E1 >: E](that: ZManaged[R1, E1, R]): ZManaged[R1, E1, A]

    Permalink

    Executes the second effect and then provides its output as an environment to this effect

  25. final def either: ZManaged[R, Nothing, Either[E, A]]

    Permalink

    Returns an effect whose failure and success have been lifted into an Either.The resulting effect cannot fail

  26. final def ensuring[R1 <: R](f: ZIO[R1, Nothing, _]): ZManaged[R1, E, A]

    Permalink

    Ensures that f is executed when this ZManaged is finalized, after the existing finalizer.

    Ensures that f is executed when this ZManaged is finalized, after the existing finalizer.

    For usecases that need access to the ZManaged's result, see ZManaged#onExit.

  27. final def ensuringFirst[R1 <: R](f: ZIO[R1, Nothing, _]): ZManaged[R1, E, A]

    Permalink

    Ensures that f is executed when this ZManaged is finalized, before the existing finalizer.

    Ensures that f is executed when this ZManaged is finalized, before the existing finalizer.

    For usecases that need access to the ZManaged's result, see ZManaged#onExitFirst.

  28. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  29. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  30. final def first[R1 <: R, A1 >: A]: ZManaged[R1, E, (A1, R1)]

    Permalink

    Zips this effect with its environment

  31. final def flatMap[R1 <: R, E1 >: E, B](f0: (A) ⇒ ZManaged[R1, E1, B]): ZManaged[R1, E1, B]

    Permalink

    Returns an effect that models the execution of this effect, followed by the passing of its value to the specified continuation function k, followed by the effect that it returns.

  32. final def flatMapError[R1 <: R, E2](f: (E) ⇒ ZManaged[R1, Nothing, E2]): ZManaged[R1, E2, A]

    Permalink

    Effectfully map the error channel

  33. final def flatten[R1 <: R, E1 >: E, B](implicit ev: <:<[A, ZManaged[R1, E1, B]]): ZManaged[R1, E1, B]

    Permalink

    Returns an effect that performs the outer effect first, followed by the inner effect, yielding the value of the inner effect.

    Returns an effect that performs the outer effect first, followed by the inner effect, yielding the value of the inner effect.

    This method can be used to "flatten" nested effects.

  34. final def flip: ZManaged[R, A, E]

    Permalink

    Flip the error and result

  35. final def flipWith[R1, A1, E1](f: (ZManaged[R, A, E]) ⇒ ZManaged[R1, A1, E1]): ZManaged[R1, E1, A1]

    Permalink

    Flip the error and result, then apply an effectful function to the effect

  36. final def fold[B](failure: (E) ⇒ B, success: (A) ⇒ B): ZManaged[R, Nothing, B]

    Permalink

    Folds over the failure value or the success value to yield an effect that does not fail, but succeeds with the value returned by the left or right function passed to fold.

  37. final def foldCauseM[R1 <: R, E1, A1](failure: (Cause[E]) ⇒ ZManaged[R1, E1, A1], success: (A) ⇒ ZManaged[R1, E1, A1]): ZManaged[R1, E1, A1]

    Permalink

    A more powerful version of foldM that allows recovering from any kind of failure except interruptions.

  38. final def foldM[R1 <: R, E2, B](failure: (E) ⇒ ZManaged[R1, E2, B], success: (A) ⇒ ZManaged[R1, E2, B]): ZManaged[R1, E2, B]

    Permalink

    Recovers from errors by accepting one effect to execute for the case of an error, and one effect to execute for the case of success.

  39. final def fork: ZManaged[R, Nothing, Fiber[E, A]]

    Permalink

    Creates a ZManaged value that acquires the original resource in a fiber, and provides that fiber.

    Creates a ZManaged value that acquires the original resource in a fiber, and provides that fiber. The finalizer for this value will interrupt the fiber and run the original finalizer.

  40. final def get[E1 >: E, B](implicit ev1: =:=[E1, Nothing], ev2: <:<[A, Option[B]]): ZManaged[R, Unit, B]

    Permalink

    Unwraps the optional success of this effect, but can fail with unit value.

  41. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  42. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  43. final def join[R1, E1 >: E, A1 >: A](that: ZManaged[R1, E1, A1]): ZManaged[Either[R, R1], E1, A1]

    Permalink

    Depending on the environment execute this or the other effect

  44. final def left[R1 <: R, C]: ZManaged[Either[R1, C], E, Either[A, C]]

    Permalink
  45. final def map[B](f0: (A) ⇒ B): ZManaged[R, E, B]

    Permalink

    Returns an effect whose success is mapped by the specified f function.

  46. final def mapError[E1](f: (E) ⇒ E1): ZManaged[R, E1, A]

    Permalink

    Returns an effect whose failure is mapped by the specified f function.

  47. final def mapErrorCause[E1](f: (Cause[E]) ⇒ Cause[E1]): ZManaged[R, E1, A]

    Permalink

    Returns an effect whose full failure is mapped by the specified f function.

  48. final def mapM[R1 <: R, E1 >: E, B](f: (A) ⇒ ZIO[R1, E1, B]): ZManaged[R1, E1, B]

    Permalink

    Effectfully maps the resource acquired by this value.

  49. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  50. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  51. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  52. final def onExit[R1 <: R](cleanup: (Exit[E, A]) ⇒ ZIO[R1, Nothing, _]): ZManaged[R1, E, A]

    Permalink

    Ensures that a cleanup function runs when this ZManaged is finalized, after the existing finalizers.

  53. final def onExitFirst[R1 <: R](cleanup: (Exit[E, A]) ⇒ ZIO[R1, Nothing, _]): ZManaged[R1, E, A]

    Permalink

    Ensures that a cleanup function runs when this ZManaged is finalized, before the existing finalizers.

  54. final def option: ZManaged[R, Nothing, Option[A]]

    Permalink

    Executes this effect, skipping the error but returning optionally the success.

  55. final def orDie(implicit ev: <:<[E, Throwable]): ZManaged[R, Nothing, A]

    Permalink

    Translates effect failure into death of the fiber, making all failures unchecked and not a part of the type of the effect.

  56. final def orDieWith(f: (E) ⇒ Throwable): ZManaged[R, Nothing, A]

    Permalink

    Keeps none of the errors, and terminates the fiber with them, using the specified function to convert the E into a Throwable.

  57. final def orElse[R1 <: R, E2, A1 >: A](that: ⇒ ZManaged[R1, E2, A1]): ZManaged[R1, E2, A1]

    Permalink

    Executes this effect and returns its value, if it succeeds, but otherwise executes the specified effect.

  58. final def orElseEither[R1 <: R, E2, B](that: ⇒ ZManaged[R1, E2, B]): ZManaged[R1, E2, Either[A, B]]

    Permalink

    Returns an effect that will produce the value of this effect, unless it fails, in which case, it will produce the value of the specified effect.

  59. final def provide(r: R): ZManaged[Any, E, A]

    Permalink

    Provides the ZManaged effect with its required environment, which eliminates its dependency on R.

  60. final def provideSome[R0](f: (R0) ⇒ R): ZManaged[R0, E, A]

    Permalink

    Provides some of the environment required to run this effect, leaving the remainder R0.

  61. final def refineOrDie[E1](pf: PartialFunction[E, E1])(implicit ev: <:<[E, Throwable]): ZManaged[R, E1, A]

    Permalink

    Keeps some of the errors, and terminates the fiber with the rest.

  62. final def refineOrDieWith[E1](pf: PartialFunction[E, E1])(f: (E) ⇒ Throwable): ZManaged[R, E1, A]

    Permalink

    Keeps some of the errors, and terminates the fiber with the rest, using the specified function to convert the E into a Throwable.

  63. final def refineToOrDie[E1](implicit arg0: ClassTag[E1], ev: <:<[E, Throwable]): ZManaged[R, E1, A]

    Permalink

    Keeps some of the errors, and terminates the fiber with the rest.

  64. val reserve: ZIO[R, E, Reservation[R, E, A]]

    Permalink
  65. final def retry[R1 <: R, E1 >: E, S](policy: ZSchedule[R1, E1, S]): ZManaged[R1 with Clock, E1, A]

    Permalink

    Retries with the specified retry policy.

    Retries with the specified retry policy. Retries are done following the failure of the original io (up to a fixed maximum with once or recurs for example), so that that io.retry(Schedule.once) means "execute io and in case of failure, try again once".

  66. final def right[R1 <: R, C]: ZManaged[Either[C, R1], E, Either[C, A]]

    Permalink
  67. final def sandbox: ZManaged[R, Cause[E], A]

    Permalink

    Exposes the full cause of failure of this effect.

  68. final def second[R1 <: R, A1 >: A]: ZManaged[R1, E, (R1, A1)]

    Permalink

    Zips this effect with its environment

  69. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  70. final def timed: ZManaged[R with Clock, E, (Duration, A)]

    Permalink

    Returns a new effect that executes this one and times the acquisition of the resource.

  71. final def timeout(d: Duration): ZManaged[R with Clock, E, Option[A]]

    Permalink

    Returns an effect that will timeout this resource, returning None if the timeout elapses before the resource was reserved and acquired.

    Returns an effect that will timeout this resource, returning None if the timeout elapses before the resource was reserved and acquired. If the reservation completes successfully (even after the timeout) the release action will be run on a new fiber. Some will be returned if acquisition and reservation complete in time

  72. final lazy val unit: ZManaged[R, E, Unit]

    Permalink

    Return unit while running the effect

  73. final def unsandbox[E1](implicit ev: <:<[E, Cause[E1]]): ZManaged[R, E1, A]

    Permalink

    The inverse operation ZManaged.sandboxed

  74. final def use[R1 <: R, E1 >: E, B](f: (A) ⇒ ZIO[R1, E1, B]): ZIO[R1, E1, B]

    Permalink

    Run an effect while acquiring the resource before and releasing it after

  75. final val useForever: ZIO[R, E, Nothing]

    Permalink

    Use the resource until interruption.

    Use the resource until interruption. Useful for resources that you want to acquire and use as long as the application is running, like a HTTP server.

  76. final def use_[R1 <: R, E1 >: E, B](f: ZIO[R1, E1, B]): ZIO[R1, E1, B]

    Permalink

    Run an effect while acquiring the resource before and releasing it after.

    Run an effect while acquiring the resource before and releasing it after. This does not provide the resource to the function

  77. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  78. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  79. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  80. final def when(b: Boolean): ZManaged[R, E, Unit]

    Permalink

    The moral equivalent of if (p) exp

  81. final def whenM[R1 <: R, E1 >: E](b: ZManaged[R1, E1, Boolean]): ZManaged[R1, E1, Unit]

    Permalink

    The moral equivalent of if (p) exp when p has side-effects

  82. final def withEarlyRelease: ZManaged[R, E, (URIO[R, Any], A)]

    Permalink

    Modifies this ZManaged to provide a canceler that can be used to eagerly execute the finalizer of this ZManaged.

    Modifies this ZManaged to provide a canceler that can be used to eagerly execute the finalizer of this ZManaged. The canceler will run uninterruptibly with an exit value indicating that the effect was interrupted, and if completed will cause the regular finalizer to not run.

  83. final def withEarlyReleaseExit(exit: Exit[Any, Any]): ZManaged[R, E, (URIO[R, Any], A)]

    Permalink

    A more powerful version of withEarlyRelease that allows specifying an exit value in the event of early release.

  84. final def zip[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, (A, A1)]

    Permalink

    Named alias for <*>.

  85. final def zipLeft[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, A]

    Permalink

    Named alias for <*.

  86. final def zipPar[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, (A, A1)]

    Permalink

    Named alias for <&>.

  87. final def zipParLeft[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, A]

    Permalink

    Named alias for <&.

  88. final def zipParRight[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, A1]

    Permalink

    Named alias for &>.

  89. final def zipRight[R1 <: R, E1 >: E, A1](that: ZManaged[R1, E1, A1]): ZManaged[R1, E1, A1]

    Permalink

    Named alias for *>.

  90. final def zipWith[R1 <: R, E1 >: E, A1, A2](that: ZManaged[R1, E1, A1])(f: (A, A1) ⇒ A2): ZManaged[R1, E1, A2]

    Permalink

    Returns an effect that executes both this effect and the specified effect, in sequence, combining their results with the specified f function.

  91. final def zipWithPar[R1 <: R, E1 >: E, A1, A2](that: ZManaged[R1, E1, A1])(f0: (A, A1) ⇒ A2): ZManaged[R1, E1, A2]

    Permalink

    Returns an effect that executes both this effect and the specified effect, in parallel, combining their results with the specified f function.

    Returns an effect that executes both this effect and the specified effect, in parallel, combining their results with the specified f function. If either side fails, then the other side will be interrupted.

  92. final def |||[R1, E1 >: E, A1 >: A](that: ZManaged[R1, E1, A1]): ZManaged[Either[R, R1], E1, A1]

    Permalink

    Symbolic alias for join

Deprecated Value Members

  1. final def const[B](b: ⇒ B): ZManaged[R, E, B]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.0) use as

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped