Packages

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

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

A Schedule[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
Schedule[R, A, B]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Schedule
  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

    The internal state type of the schedule.

Abstract Value Members

  1. abstract val extract: (A, State) ⇒ B

    Extract the B from the schedule

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

    The initial state of the schedule.

  3. abstract val update: (A, State) ⇒ ZIO[R, Unit, State]

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

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def &&[R1 <: R, A1 <: A, C](that: Schedule[R1, A1, C]): Schedule[R1, A1, (B, C)]

    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: Schedule[R1, C, D]): Schedule[R1, (A, C), (B, D)]

    Split the input

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

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

  6. final def ++[R1 <: R, A1 <: A, B1 >: B](that: Schedule[R1, A1, B1]): Schedule[R1, A1, B1]

    A symbolic alias for andThen.

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

    Chooses between two schedules with different outputs.

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

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

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

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

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

    A backwards version of >>>.

  11. final def <||>[R1 <: R, A1 <: A, C](that: Schedule[R1, A1, C]): Schedule[R1, A1, Either[B, C]]

    Operator alias for andThenEither.

  12. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  13. final def >>>[R1 <: R, C](that: Schedule[R1, B, C]): Schedule[R1, A, C]

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

    Returns the composition of this schedule and the specified schedule, by piping the output of this one into the input of the other. Effects described by this schedule will always be executed before the effects described by the second schedule.

  14. final def addDelay(f: (B) ⇒ Duration): Schedule[R with Clock, A, B]

    Returns a new schedule with the given delay added to every update.

  15. final def addDelayM[R1 <: R](f: (B) ⇒ ZIO[R1, Nothing, Duration]): Schedule[R1 with Clock, A, B]

    Returns a new schedule with the effectfully calculated delay added to every update.

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

    The same as andThenEither, but merges the output.

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

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

  18. final def as[C](c: ⇒ C): Schedule[R, A, C]

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

  19. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  20. final def both[R1 <: R, A1 <: A, C](that: Schedule[R1, A1, C]): Schedule[R1, A1, (B, C)]

    A named alias for &&.

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

    The same as both followed by map.

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

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

  23. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  24. final def collectAll: Schedule[R, A, List[B]]

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

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

    An alias for <<<

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

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

  27. final def delayed[R1 <: R](f: (Duration) ⇒ Duration)(implicit ev1: IsHas[R1], ev2: <:<[R1, Clock]): Schedule[R1, A, B]

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

  28. final def delayedM[R1 <: R](f: (Duration) ⇒ ZIO[R1, Nothing, Duration])(implicit ev1: IsHas[R1], ev2: <:<[R1, Clock]): Schedule[R1, A, B]

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

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

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

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

    A named alias for ||.

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

    The same as either followed by map.

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

    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.

  33. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  34. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  35. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  36. final def first[R1 <: R, C]: Schedule[R1, (A, C), (B, C)]

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

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

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

  38. final def foldM[R1 <: R, Z](z: Z)(f: (Z, B) ⇒ ZIO[R1, Nothing, Z]): Schedule[R1, A, Z]

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

  39. final def forever: Schedule[R, A, B]

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

  40. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  41. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  42. final def initialized[R1 <: R, A1 <: A](f: (ZIO[R1, Nothing, State]) ⇒ ZIO[R1, Nothing, State]): Schedule[R1, A1, B]

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

  43. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  44. final def jittered[R1 <: R](min: Double, max: Double)(implicit ev1: IsHas[R1], ev2: <:<[R1, Clock]): Schedule[R1 with Random, A, B]

    Applies random jitter to all sleeps executed by the schedule.

  45. def jittered[R1 <: R](implicit ev1: IsHas[R1], ev2: <:<[R1, Clock]): Schedule[R1 with Random, A, B]
  46. final def left[C]: Schedule[R, Either[A, C], Either[B, C]]

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

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

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

  48. final def modifyDelay[R1 <: R](f: (B, Duration) ⇒ ZIO[R1, Nothing, Duration])(implicit ev1: IsHas[R1], ev2: <:<[R1, Clock]): Schedule[R1, A, B]

    Returns a new schedule with the specified effectful modification applied to each sleep performed by this schedule.

    Returns a new schedule with the specified effectful modification applied to each sleep performed by this schedule.

    Note that this does not apply to sleeps performed in Schedule#initial. All effects executed while calculating the modified duration will run with the old environment.

  49. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  50. final def noDelay[R1 <: R](implicit ev1: IsHas[R1], ev2: <:<[R1, Clock]): Schedule[R1, A, B]

    Returns a new schedule that will not perform any sleep calls between recurrences.

  51. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  52. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  53. final def onDecision[A1 <: A, R1 <: R](f: (A1, Option[State]) ⇒ URIO[R1, Any]): Schedule[R1, A1, B]

    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.

  54. final def provide(r: R)(implicit ev: NeedsEnv[R]): Schedule[Any, A, B]

    Provide all requirements to the schedule.

  55. final def provideSome[R1](f: (R1) ⇒ R)(implicit ev: NeedsEnv[R]): Schedule[R1, A, B]

    Provide some of the requirements to the schedule.

  56. final def reconsider[R1 <: R, A1 <: A](f: (A1, Either[State, State]) ⇒ ZIO[R1, Unit, State]): Schedule[R1, A1, B]

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

    Returns a new schedule that effectfully reconsiders the decision made by this schedule. The provided either will be a Left if the schedule has failed and will contain the old state or a Right with the new state if the schedule has updated successfully.

  57. final def repetitions: Schedule[R, A, Int]

    Emit the number of repetitions of the schedule so far.

  58. final def right[C]: Schedule[R, Either[C, A], Either[C, B]]

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

  59. final def run(input: Iterable[A]): ZIO[R, Nothing, List[B]]

    Run a schedule using the provided input and collect all outputs.

  60. final def second[C]: Schedule[R, (C, A), (C, B)]

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

  61. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  62. final def tapInput[R1 <: R, A1 <: A](f: (A1) ⇒ ZIO[R1, Nothing, Unit]): Schedule[R1, A1, B]

    Sends every input value to the specified sink.

  63. final def tapOutput[R1 <: R](f: (B) ⇒ ZIO[R1, Nothing, Unit]): Schedule[R1, A, B]

    Sends every output value to the specified sink.

  64. def toString(): String
    Definition Classes
    AnyRef → Any
  65. final def unit: Schedule[R, A, Unit]

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

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

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

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

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

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

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

  69. final def untilOutputM(f: (B) ⇒ UIO[Boolean]): Schedule[R, A, B]

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

  70. final def updated[R1 <: R, A1 <: A](f: ((A, State) ⇒ ZIO[R, Unit, State]) ⇒ (A1, State) ⇒ ZIO[R1, Unit, State]): Schedule[R1, A1, B]

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

  71. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  72. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  73. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  74. final def whileInput[A1 <: A](f: (A1) ⇒ Boolean): Schedule[R, A1, B]

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

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

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

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

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

  77. final def whileOutputM(f: (B) ⇒ UIO[Boolean]): Schedule[R, A, B]

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

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

    Named alias for <*>.

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

    Named alias for <*.

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

    Named alias for *>.

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

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

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

    Chooses between two schedules with a common output.

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped