A Schedule[Env, In, Out]
defines a recurring schedule, which consumes
values of type In
, and which returns values of type Out
.
Schedules are defined as a possibly infinite set of intervals spread out over time. Each interval defines a window in which recurrence is possible.
When schedules are used to repeat or retry effects, the starting boundary of each interval produced by a schedule is used as the moment when the effect will be executed again.
Schedules compose in the following primary ways:
- Union. This performs the union of the intervals of two schedules. * Intersection. This performs the intersection of the intervals of two schedules. * Sequence. This concatenates the intervals of one schedule onto another.
In addition, schedule inputs and outputs can be transformed, filtered (to terminate a schedule early in response to some input or output), and so forth.
A variety of other operators exist for transforming and combining schedules,
and the companion object for Schedule
contains all common types of
schedules, both for performing retrying, as well as performing repetition.
- Companion:
- object
Value members
Concrete methods
Returns a new schedule that performs a geometric intersection on the intervals defined by both schedules.
Returns a new schedule that performs a geometric intersection on the intervals defined by both schedules.
Returns a new schedule that has both the inputs and outputs of this and the specified schedule.
Returns a new schedule that has both the inputs and outputs of this and the specified schedule.
Returns a new schedule that allows choosing between feeding inputs to this schedule, or feeding inputs to the specified schedule.
Returns a new schedule that allows choosing between feeding inputs to this schedule, or feeding inputs to the specified schedule.
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.
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.
Returns a new schedule with the given delay added to every interval defined by this schedule.
Returns a new schedule with the given delay added to every interval defined by this schedule.
Returns a new schedule with the given effectfully computed delay added to every interval defined by this schedule.
Returns a new schedule with the given effectfully computed delay added to every interval defined by this schedule.
Returns a new schedule that first executes this schedule to completion, and then executes the specified schedule to completion.
Returns a new schedule that first executes this schedule to completion, and then executes the specified schedule to completion.
Returns a new schedule that maps this schedule to a constant output.
Returns a new schedule that maps this schedule to a constant output.
Returns a new schedule that passes each input and output of this schedule to the specified function, and then determines whether or not to continue based on the return value of the function.
Returns a new schedule that passes each input and output of this schedule to the specified function, and then determines whether or not to continue based on the return value of the function.
Returns a new schedule that passes each input and output of this schedule to the specified function, and then determines whether or not to continue based on the return value of the function.
Returns a new schedule that passes each input and output of this schedule to the specified function, and then determines whether or not to continue based on the return value of the function.
Returns a new schedule that collects the outputs of this one into a chunk.
Returns a new schedule that collects the outputs of this one into a chunk.
Returns a new schedule that deals with a narrower class of inputs than this schedule.
Returns a new schedule that deals with a narrower class of inputs than this schedule.
Returns a new schedule that deals with a narrower class of inputs than this schedule.
Returns a new schedule that deals with a narrower class of inputs than this schedule.
Returns a new schedule with the specified effectfully computed delay added before the start of each interval produced by this schedule.
Returns a new schedule with the specified effectfully computed delay added before the start of each interval produced by this schedule.
Returns a new schedule with the specified effectfully computed delay added before the start of each interval produced by this schedule.
Returns a new schedule with the specified effectfully computed delay added before the start of each interval produced by this schedule.
Returns a new schedule that outputs the delay between each occurence.
Returns a new schedule that outputs the delay between each occurence.
Returns a new schedule that contramaps the input and maps the output.
Returns a new schedule that contramaps the input and maps the output.
Returns a new schedule that contramaps the input and maps the output.
Returns a new schedule that contramaps the input and maps the output.
Returns a driver that can be used to step the schedule, appropriately handling sleeping.
Returns a driver that can be used to step the schedule, appropriately handling sleeping.
The same as either
followed by map
.
The same as either
followed by map
.
Returns a new schedule that will run 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.
Returns a new schedule that will run 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.
Returns a new schedule that packs the input and output of this schedule into the first element of a tuple. This allows carrying information through this schedule.
Returns a new schedule that packs the input and output of this schedule into the first element of a tuple. This allows carrying information through this schedule.
Returns a new schedule that folds over the outputs of this one.
Returns a new schedule that folds over the outputs of this one.
Returns a new schedule that effectfully folds over the outputs of this one.
Returns a new schedule that effectfully folds over the outputs of this one.
Returns a new schedule that loops this one continuously, resetting the state when this schedule is done.
Returns a new schedule that loops this one continuously, resetting the state when this schedule is done.
Returns a new schedule that combines this schedule with the specified schedule, continuing as long as both schedules want to continue and merging the next intervals according to the specified merge function.
Returns a new schedule that combines this schedule with the specified schedule, continuing as long as both schedules want to continue and merging the next intervals according to the specified merge function.
Returns a new schedule that randomly modifies the size of the intervals of this schedule.
Returns a new schedule that randomly modifies the size of the intervals of this schedule.
Returns a new schedule that randomly modifies the size of the intervals of this schedule.
Returns a new schedule that randomly modifies the size of the intervals of this schedule.
Returns a new schedule that makes this schedule available on the Left
side of an Either
input, allowing propagating some type X
through this
channel on demand.
Returns a new schedule that makes this schedule available on the Left
side of an Either
input, allowing propagating some type X
through this
channel on demand.
Returns a new schedule that maps the output of this schedule through the specified function.
Returns a new schedule that maps the output of this schedule through the specified function.
Returns a new schedule that maps the output of this schedule through the specified effectful function.
Returns a new schedule that maps the output of this schedule through the specified effectful function.
Returns a new schedule that modifies the delay using the specified function.
Returns a new schedule that modifies the delay using the specified function.
Returns a new schedule that modifies the delay using the specified effectual function.
Returns a new schedule that modifies the delay using the specified effectual function.
Returns 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.
Returns 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.
Returns a new schedule with its environment provided to it, so the resulting schedule does not require any environment.
Returns a new schedule with its environment provided to it, so the resulting schedule does not require any environment.
Provides the part of the environment that is not part of the ZEnv
,
leaving a schedule that only depends on the ZEnv
.
Provides the part of the environment that is not part of the ZEnv
,
leaving a schedule that only depends on the ZEnv
.
Provides a layer to the schedule, which translates it to another level.
Provides a layer to the schedule, which translates it to another level.
Returns a new schedule with part of its environment provided to it, so the resulting schedule does not require any environment.
Returns a new schedule with part of its environment provided to it, so the resulting schedule does not require any environment.
Splits the environment into two parts, providing one part using the
specified layer and leaving the remainder Env0
.
Splits the environment into two parts, providing one part using the
specified layer and leaving the remainder Env0
.
Returns a new schedule that reconsiders every decision made by this schedule, possibly modifying the next interval and the output type in the process.
Returns a new schedule that reconsiders every decision made by this schedule, possibly modifying the next interval and the output type in the process.
Returns a new schedule that effectfully reconsiders every decision made by this schedule, possibly modifying the next interval and the output type in the process.
Returns a new schedule that effectfully reconsiders every decision made by this schedule, possibly modifying the next interval and the output type in the process.
Returns a new schedule that outputs the number of repetitions of this one.
Returns a new schedule that outputs the number of repetitions of this one.
Return a new schedule that automatically resets the schedule to its initial
state after some time of inactivity defined by duration
.
Return a new schedule that automatically resets the schedule to its initial
state after some time of inactivity defined by duration
.
Resets the schedule when the specified predicate on the schedule output evaluates to true.
Resets the schedule when the specified predicate on the schedule output evaluates to true.
Returns a new schedule that makes this schedule available on the Right
side of an Either
input, allowing propagating some type X
through this
channel on demand.
Returns a new schedule that makes this schedule available on the Right
side of an Either
input, allowing propagating some type X
through this
channel on demand.
Runs a schedule using the provided inputs, and collects all outputs.
Runs a schedule using the provided inputs, and collects all outputs.
Returns a new schedule that packs the input and output of this schedule into the second element of a tuple. This allows carrying information through this schedule.
Returns a new schedule that packs the input and output of this schedule into the second element of a tuple. This allows carrying information through this schedule.
Returns a new schedule that effectfully processes every input to this schedule.
Returns a new schedule that effectfully processes every input to this schedule.
Returns a new schedule that effectfully processes every output from this schedule.
Returns a new schedule that effectfully processes every output from this schedule.
Returns a new schedule that combines this schedule with the specified schedule, continuing as long as either schedule wants to continue and merging the next intervals according to the specified merge function.
Returns a new schedule that combines this schedule with the specified schedule, continuing as long as either schedule wants to continue and merging the next intervals according to the specified merge function.
Returns a new schedule that maps the output of this schedule to unit.
Returns a new schedule that maps the output of this schedule to unit.
Returns a new schedule that continues until the specified predicate on the input evaluates to true.
Returns a new schedule that continues until the specified predicate on the input evaluates to true.
Returns a new schedule that continues until the specified effectful predicate on the input evaluates to true.
Returns a new schedule that continues until the specified effectful predicate on the input evaluates to true.
Returns a new schedule that continues until the specified predicate on the output evaluates to true.
Returns a new schedule that continues until the specified predicate on the output evaluates to true.
Returns a new schedule that continues until the specified effectful predicate on the output evaluates to true.
Returns a new schedule that continues until the specified effectful predicate on the output evaluates to true.
Returns a new schedule that continues for as long the specified predicate on the input evaluates to true.
Returns a new schedule that continues for as long the specified predicate on the input evaluates to true.
Returns a new schedule that continues for as long the specified effectful predicate on the input evaluates to true.
Returns a new schedule that continues for as long the specified effectful predicate on the input evaluates to true.
Returns a new schedule that continues for as long the specified predicate on the output evaluates to true.
Returns a new schedule that continues for as long the specified predicate on the output evaluates to true.
Returns a new schedule that continues for as long the specified effectful predicate on the output evaluates to true.
Returns a new schedule that continues for as long the specified effectful predicate on the output evaluates to true.
Deprecated methods
Returns a new schedule that combines this schedule with the specified schedule, merging the next intervals according to the specified merge function.
Returns a new schedule that combines this schedule with the specified schedule, merging the next intervals according to the specified merge function.
- Deprecated