Packages

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

    The internal state type of the schedule.

Abstract Value Members

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

    The initial state of the schedule.

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

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

    Split the input

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

    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]]

    Chooses between two schedules with different outputs.

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

    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)]

    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]

    A backwards version of >>>.

  10. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. final def >>>[R1 <: R, C](that: ZSchedule[R1, B, C]): ZSchedule[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, 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]

    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]]

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

  14. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  15. final def both[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, (B, C)]

    A named alias for &&.

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

    The same as both followed by map.

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

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

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

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

  20. 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)]

    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.

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

    An alias for <<<

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

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

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

    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]

    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]

    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)]

    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]

    The same as either followed by map.

  28. final def ensuring(finalizer: UIO[_]): ZSchedule[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.

  29. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  31. def finalize(): Unit
    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)]

    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]

    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]

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

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

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

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

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

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

    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]

    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]]

    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]

    Sends every input value to the specified sink.

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

    Sends every output value to the specified sink.

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

    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]

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

  47. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  48. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  49. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  50. final def onDecision[A1 <: A](f: (A1, Decision[State, B]) ⇒ UIO[Unit]): ZSchedule[R, 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.

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

    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]

    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]]

    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)]]

    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)]

    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
    Definition Classes
    AnyRef
  57. def toString(): String
    Definition Classes
    AnyRef → Any
  58. final def unary_!: ZSchedule[R, A, B]

    Returns a new schedule that inverts the decision to continue.

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

    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]

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

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

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

  62. 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]

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

  63. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  64. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  65. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  66. final def whileInput[A1 <: A](f: (A1) ⇒ Boolean): ZSchedule[R, A1, B]

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

  67. final def whileOutput(f: (B) ⇒ Boolean): ZSchedule[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.

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

    Named alias for <*>.

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

    Named alias for <*.

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

    Named alias for *>.

  71. final def ||[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[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.

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

    Chooses between two schedules with a common output.

Deprecated Value Members

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

    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