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]
- Alphabetic
- By Inheritance
- ZSchedule
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- abstract type State
The internal state type of the schedule.
Abstract Value Members
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- 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.
- final def ***[R1 <: R, C, D](that: ZSchedule[R1, C, D]): ZSchedule[R1, (A, C), (B, D)]
Split the input
- final def *>[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, C]
The same as
&&, but ignores the left output. - 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.
- final def <*[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, B]
The same as
&&, but ignores the right output. - final def <<<[R1 <: R, C](that: ZSchedule[R1, C, A]): ZSchedule[R1, C, B]
A backwards version of
>>>. - final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- 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.
- 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. - 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.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def both[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, (B, C)]
A named alias for
&&. - 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
bothfollowed bymap. - 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.
- def clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws(classOf[java.lang.CloneNotSupportedException])
- final def collect: ZSchedule[R, A, List[B]]
Returns a new schedule that collects the outputs of this one into a list.
- 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)]
- final def compose[R1 <: R, C](that: ZSchedule[R1, C, A]): ZSchedule[R1, C, B]
An alias for
<<< - final def const[C](c: ⇒ C): ZSchedule[R, A, C]
Returns a new schedule that maps this schedule to a constant output.
- 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.
- 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.
- 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.
- final def either[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, (B, C)]
A named alias for
||. - 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
eitherfollowed bymap. - 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. TheSchedulemay not initialize or the driver of the schedule may not run to completion. However, if theScheduleever decides not to continue, then the finalizer will be run. - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- 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.
- 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.
- 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.
- final def forever: ZSchedule[R, A, B]
Returns a new schedule that loops this one forever, resetting the state when this schedule is done.
- final def getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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.
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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.
- final def jittered: ZSchedule[R with Random, A, B]
Applies random jitter to the schedule bounded by the factors 0.0 and 1.0.
- 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.
- 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.
- final def logOutput[R1 <: R](f: (B) ⇒ ZIO[R1, Nothing, Unit]): ZSchedule[R1, A, B]
Sends every output value to the specified sink.
- 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.
- 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.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- final def synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def unary_!: ZSchedule[R, A, B]
Returns a new schedule that inverts the decision to continue.
- 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.
- 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.
- 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.
- final def void: ZSchedule[R, A, Unit]
Returns a new schedule that maps this schedule to a Unit output.
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws(classOf[java.lang.InterruptedException])
- 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.
- 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.
- final def zipLeft[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, B]
Named alias for
<*. - final def zipRight[R1 <: R, A1 <: A, C](that: ZSchedule[R1, A1, C]): ZSchedule[R1, A1, C]
Named alias for
*>. - 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.
- 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.