Trait/Object

zio

ZSchedule

Related Docs: object ZSchedule | package zio

Permalink

trait ZSchedule[-R, -A, +B] extends Serializable

Defines a stateful, possibly effectful, recurring schedule of actions.

A ZSchedule[R, A, B] consumes A values, and based on the inputs and the internal state, decides whether to continue or halt. Every decision is accompanied by a (possibly zero) delay, and an output value of type B.

Schedules compose in each of the following ways:

1. Intersection, using the && operator, which requires that both schedules continue, using the longer of the two durations. 2. Union, using the || operator, which requires that only one schedule continues, using the shorter of the two durations. 3. Sequence, using the <||> operator, which runs the first schedule until it ends, and then switches over to the second schedule.

Schedule[R, A, B] forms a profunctor on [A, B], an applicative functor on B, and a monoid, allowing rich composition of different schedules.

Self Type
ZSchedule[R, A, B]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ZSchedule
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract type State

    Permalink

    The internal state type of the schedule.

Abstract Value Members

  1. abstract val initial: ZIO[R, Nothing, State]

    Permalink

    The initial state of the schedule.

  2. abstract val update: (A, State) ⇒ ZIO[R, Nothing, Decision[State, B]]

    Permalink

    Updates the schedule based on a new input and the current state.

Concrete 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, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, (B, C)]

    Permalink

    Returns a new schedule that continues only as long as both schedules continue, using the maximum of the delays of the two schedules.

  4. final def ***[R1 <: R, C, D](that: ZSchedule[R1, C, D]): ZSchedule[R1, (A, C), (B, D)]

    Permalink

    Split the input

  5. final def *>[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, C]

    Permalink

    The same as &&, but ignores the left output.

  6. final def +++[R1 <: R, C, D](that: ZSchedule[R1, C, D]): ZSchedule[R1, Either[A, C], Either[B, D]]

    Permalink

    Chooses between two schedules with different outputs.

  7. final def <*[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, B]

    Permalink

    The same as &&, but ignores the right output.

  8. final def <*>[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, (B, C)]

    Permalink

    Returns a new schedule that continues only as long as both schedules continue, using the maximum of the delays of the two schedules.

  9. final def <<<[R1 <: R, C](that: ZSchedule[R1, C, A]): ZSchedule[R1, C, B]

    Permalink

    A backwards version of >>>.

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

    Permalink
    Definition Classes
    AnyRef → Any
  11. final def >>>[R1 <: R, C](that: ZSchedule[R1, B, C]): ZSchedule[R1, A, C]

    Permalink

    Returns the composition of this schedule and the specified schedule, by piping the output of this one into the input of the other, and summing delays produced by both.

  12. final def andThen[R1 <: R, A1 <: A, B1 >: B](that: ZSchedule[R1, A1, B1]): ZSchedule[R1, A1, B1]

    Permalink

    The same as andThenEither, but merges the output.

  13. final def andThenEither[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, Either[B, C]]

    Permalink

    Returns a new schedule that first executes this schedule to completion, and then executes the specified schedule to completion.

  14. final def as[C](c: ⇒ C): ZSchedule[R, A, C]

    Permalink

    Returns a new schedule that maps this schedule to a constant output.

  15. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  16. final def both[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, (B, C)]

    Permalink

    A named alias for &&.

  17. final def bothWith[R1 <: R, A1 <: A, C, D](that: ZSchedule[R1, A1, C])(f: (B, C) ⇒ D): ZSchedule[R1, A1, D]

    Permalink

    The same as both followed by map.

  18. final def check[A1 <: A](test: (A1, B) ⇒ UIO[Boolean]): ZSchedule[R, A1, B]

    Permalink

    Peeks at the state produced by this schedule, executes some action, and then continues the schedule or not based on the specified state predicate.

  19. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def collectAll: ZSchedule[R, A, List[B]]

    Permalink

    Returns a new schedule that collects the outputs of this one into a list.

  21. final def combineWith[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C])(g: (Boolean, Boolean) ⇒ Boolean, f: (Duration, Duration) ⇒ Duration): ZSchedule[R1, A1, (B, C)]

    Permalink

    Creates a new schedule that outputs elements of both underlying schedules pair-wie.

    Creates a new schedule that outputs elements of both underlying schedules pair-wie. The decision to continue is a function of the two underlying decisions, as is the delay.

  22. final def compose[R1 <: R, C](that: ZSchedule[R1, C, A]): ZSchedule[R1, C, B]

    Permalink

    An alias for <<<

  23. final def contramap[A1](f: (A1) ⇒ A): ZSchedule[R, A1, B]

    Permalink

    Returns a new schedule that deals with a narrower class of inputs than this schedule.

  24. final def delayed(f: (Duration) ⇒ Duration): ZSchedule[R, A, B]

    Permalink

    Returns a new schedule with the specified pure modification applied to each delay produced by this schedule.

  25. final def dimap[A1, C](f: (A1) ⇒ A, g: (B) ⇒ C): ZSchedule[R, A1, C]

    Permalink

    Returns a new schedule that contramaps the input and maps the output.

  26. final def either[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, (B, C)]

    Permalink

    A named alias for ||.

  27. final def eitherWith[R1 <: R, A1 <: A, C, D](that: ZSchedule[R1, A1, C])(f: (B, C) ⇒ D): ZSchedule[R1, A1, D]

    Permalink

    The same as either followed by map.

  28. final def ensuring(finalizer: UIO[_]): ZSchedule[R, A, B]

    Permalink

    Runs the specified finalizer as soon as the schedule is complete.

    Runs the specified finalizer as soon as the schedule is complete. Note that unlike ZIO#ensuring, this method does not guarantee the finalizer will be run. The Schedule may not initialize or the driver of the schedule may not run to completion. However, if the Schedule ever decides not to continue, then the finalizer will be run.

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

    Permalink
    Definition Classes
    AnyRef
  30. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  31. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  32. final def first[R1 <: R, C]: ZSchedule[R1, (A, C), (B, C)]

    Permalink

    Puts this schedule into the first element of a tuple, and passes along another value unchanged as the second element of the tuple.

  33. final def fold[Z](z: Z)(f: (Z, B) ⇒ Z): ZSchedule[R, A, Z]

    Permalink

    Returns a new schedule that folds over the outputs of this one.

  34. final def foldM[Z](z: UIO[Z])(f: (Z, B) ⇒ UIO[Z]): ZSchedule[R, A, Z]

    Permalink

    Returns a new schedule that effectfully folds over the outputs of this one.

  35. final def forever: ZSchedule[R, A, B]

    Permalink

    Returns a new schedule that loops this one forever, resetting the state when this schedule is done.

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

    Permalink
    Definition Classes
    AnyRef → Any
  37. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  38. final def initialized[R1 <: R, A1 <: A](f: (ZIO[R1, Nothing, State]) ⇒ ZIO[R1, Nothing, State]): ZSchedule[R1, A1, B]

    Permalink

    Returns a new schedule with the specified initial state transformed by the specified initial transformer.

  39. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  40. final def jittered(min: Double, max: Double): ZSchedule[R with Random, A, B]

    Permalink

    Applies random jitter to the schedule bounded by the specified factors, with a given random generator.

  41. final def jittered: ZSchedule[R with Random, A, B]

    Permalink

    Applies random jitter to the schedule bounded by the factors 0.0 and 1.0.

  42. final def left[C]: ZSchedule[R, Either[A, C], Either[B, C]]

    Permalink

    Puts this schedule into the first element of a either, and passes along another value unchanged as the second element of the either.

  43. final def logInput[R1 <: R, A1 <: A](f: (A1) ⇒ ZIO[R1, Nothing, Unit]): ZSchedule[R1, A1, B]

    Permalink

    Sends every input value to the specified sink.

  44. final def logOutput[R1 <: R](f: (B) ⇒ ZIO[R1, Nothing, Unit]): ZSchedule[R1, A, B]

    Permalink

    Sends every output value to the specified sink.

  45. final def map[A1 <: A, C](f: (B) ⇒ C): ZSchedule[R, A1, C]

    Permalink

    Returns a new schedule that maps over the output of this one.

  46. final def modifyDelay[R1 <: R](f: (B, Duration) ⇒ ZIO[R1, Nothing, Duration]): ZSchedule[R1, A, B]

    Permalink

    Returns a new schedule with the specified effectful modification applied to each delay produced by this schedule.

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

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

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

    Permalink
    Definition Classes
    AnyRef
  50. final def onDecision[A1 <: A](f: (A1, Decision[State, B]) ⇒ UIO[Unit]): ZSchedule[R, A1, B]

    Permalink

    A new schedule that applies the current one but runs the specified effect for every decision of this schedule.

    A new schedule that applies the current one but runs the specified effect for every decision of this schedule. This can be used to create schedules that log failures, decisions, or computed values.

  51. final def reconsider[A1 <: A, C](f: (A1, Decision[State, B]) ⇒ Decision[State, C]): ZSchedule[R, A1, C]

    Permalink

    Returns a new schedule that reconsiders the decision made by this schedule.

  52. final def reconsiderM[A1 <: A, C](f: (A1, Decision[State, B]) ⇒ UIO[Decision[State, C]]): ZSchedule[R, A1, C]

    Permalink

    Returns a new schedule that effectfully reconsiders the decision made by this schedule.

  53. final def right[C]: ZSchedule[R, Either[C, A], Either[C, B]]

    Permalink

    Puts this schedule into the second element of a either, and passes along another value unchanged as the first element of the either.

  54. final def run(as: Iterable[A]): ZIO[R, Nothing, List[(Duration, B)]]

    Permalink

    Runs the schedule on the provided list of inputs, returning a list of durations and outputs.

    Runs the schedule on the provided list of inputs, returning a list of durations and outputs. This method is useful for testing complicated schedules. Only as many inputs will be used as necessary to run the schedule to completion, and additional inputs will be discarded.

  55. final def second[C]: ZSchedule[R, (C, A), (C, B)]

    Permalink

    Puts this schedule into the second element of a tuple, and passes along another value unchanged as the first element of the tuple.

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

    Permalink
    Definition Classes
    AnyRef
  57. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  58. final def unary_!: ZSchedule[R, A, B]

    Permalink

    Returns a new schedule that inverts the decision to continue.

  59. final def unit: ZSchedule[R, A, Unit]

    Permalink

    Returns a new schedule that maps this schedule to a Unit output.

  60. final def untilInput[A1 <: A](f: (A1) ⇒ Boolean): ZSchedule[R, A1, B]

    Permalink

    Returns a new schedule that continues the schedule only until the predicate is satisfied on the input of the schedule.

  61. final def untilInputM[A1 <: A](f: (A1) ⇒ UIO[Boolean]): ZSchedule[R, A1, B]

    Permalink

    Returns a new schedule that continues the schedule only until the effectful predicate is satisfied on the input of the schedule.

  62. final def untilOutput(f: (B) ⇒ Boolean): ZSchedule[R, A, B]

    Permalink

    Returns a new schedule that continues the schedule only until the predicate is satisfied on the output value of the schedule.

  63. final def updated[R1 <: R, A1 <: A, B1](f: ((A, State) ⇒ ZIO[R, Nothing, Decision[State, B]]) ⇒ (A1, State) ⇒ ZIO[R1, Nothing, Decision[State, B1]]): ZSchedule[R1, A1, B1]

    Permalink

    Returns a new schedule with the update function transformed by the specified update transformer.

  64. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  67. final def whileInput[A1 <: A](f: (A1) ⇒ Boolean): ZSchedule[R, A1, B]

    Permalink

    Returns a new schedule that continues this schedule so long as the predicate is satisfied on the input of the schedule.

  68. final def whileInputM[A1 <: A](f: (A1) ⇒ UIO[Boolean]): ZSchedule[R, A1, B]

    Permalink

    Returns a new schedule that continues this schedule so long as the effectful predicate is satisfied on the input of the schedule.

  69. final def whileOutput(f: (B) ⇒ Boolean): ZSchedule[R, A, B]

    Permalink

    Returns a new schedule that continues this schedule so long as the predicate is satisfied on the output value of the schedule.

  70. final def zip[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, (B, C)]

    Permalink

    Named alias for <*>.

  71. final def zipLeft[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, B]

    Permalink

    Named alias for <*.

  72. final def zipRight[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, C]

    Permalink

    Named alias for *>.

  73. final def ||[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, (B, C)]

    Permalink

    Returns a new schedule that continues as long as either schedule continues, using the minimum of the delays of the two schedules.

  74. final def |||[R1 <: R, B1 >: B, C](that: ZSchedule[R1, C, B1]): ZSchedule[R1, Either[A, C], B1]

    Permalink

    Chooses between two schedules with a common output.

Deprecated Value Members

  1. final def const[C](c: ⇒ C): ZSchedule[R, A, C]

    Permalink
    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.0) use as

  2. final def void: ZSchedule[R, A, Unit]

    Permalink

    Returns a new schedule that maps this schedule to a Unit output.

    Returns a new schedule that maps this schedule to a Unit output.

    Annotations
    @deprecated
    Deprecated

    (Since version 1.0.0) use unit

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped