Schedule

zio.Schedule$
See theSchedule companion trait
object Schedule

Attributes

Companion:
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

object Decision

Attributes

Companion:
trait
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait Decision

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Continue
object Done.type
final case class Driver[+State, -Env, -In, +Out](next: In => ZIO[Env, None.type, Out], last: IO[NoSuchElementException, Out], reset: UIO[Unit], state: UIO[State])

Attributes

Graph
Supertypes
trait Product
trait Equals
class Object
trait Matchable
class Any
sealed abstract class Interval

An Interval represents an interval of time. Intervals can encompass all time, or no time at all.

An Interval represents an interval of time. Intervals can encompass all time, or no time at all.

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
sealed abstract case class Intervals

Intervals represents a set of intervals.

Intervals represents a set of intervals.

Attributes

Companion:
object
Graph
Supertypes
trait Product
trait Equals
class Object
trait Matchable
class Any
Self type
object Intervals

Attributes

Companion:
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Types

type WithState[State0, -Env, -In0, +Out0] = Schedule[Env, In0, Out0] { type State = State0; }

Value members

Concrete methods

def collectAll[A](implicit trace: Trace): WithState[(Unit, Chunk[A]), Any, A, Chunk[A]]

A schedule that recurs anywhere, collecting all inputs into a list.

A schedule that recurs anywhere, collecting all inputs into a list.

Attributes

def collectUntil[A](f: A => Boolean)(implicit trace: Trace): WithState[(Unit, Chunk[A]), Any, A, Chunk[A]]

A schedule that recurs until the condition f fails, collecting all inputs into a list.

A schedule that recurs until the condition f fails, collecting all inputs into a list.

Attributes

def collectUntilZIO[Env, A](f: A => URIO[Env, Boolean])(implicit trace: Trace): WithState[(Unit, Chunk[A]), Env, A, Chunk[A]]

A schedule that recurs until the effectful condition f fails, collecting all inputs into a list.

A schedule that recurs until the effectful condition f fails, collecting all inputs into a list.

Attributes

def collectWhile[A](f: A => Boolean)(implicit trace: Trace): WithState[(Unit, Chunk[A]), Any, A, Chunk[A]]

A schedule that recurs as long as the condition f holds, collecting all inputs into a list.

A schedule that recurs as long as the condition f holds, collecting all inputs into a list.

Attributes

def collectWhileZIO[Env, A](f: A => URIO[Env, Boolean])(implicit trace: Trace): WithState[(Unit, Chunk[A]), Env, A, Chunk[A]]

A schedule that recurs as long as the effectful condition holds, collecting all inputs into a list.

A schedule that recurs as long as the effectful condition holds, collecting all inputs into a list.

Attributes

def dayOfMonth(day: Int)(implicit trace: Trace): WithState[(OffsetDateTime, Long), Any, Any, Long]

Cron-like schedule that recurs every specified day of month. Won't recur on months containing less days than specified in day param.

Cron-like schedule that recurs every specified day of month. Won't recur on months containing less days than specified in day param.

It triggers at zero hour of the day. Producing a count of repeats: 0, 1, 2.

NOTE: day parameter is validated lazily. Must be in range 1...31.

Attributes

def dayOfWeek(day: Int)(implicit trace: Trace): WithState[(OffsetDateTime, Long), Any, Any, Long]

Cron-like schedule that recurs every specified day of each week. It triggers at zero hour of the week. Producing a count of repeats: 0, 1, 2.

Cron-like schedule that recurs every specified day of each week. It triggers at zero hour of the week. Producing a count of repeats: 0, 1, 2.

NOTE: day parameter is validated lazily. Must be in range 1 (Monday)...7 (Sunday).

Attributes

def delayed[Env, In](schedule: Schedule[Env, In, Duration])(implicit trace: Trace): WithState[State, Env, In, Duration]

Takes a schedule that produces a delay, and returns a new schedule that uses this delay to further delay intervals in the resulting schedule.

Takes a schedule that produces a delay, and returns a new schedule that uses this delay to further delay intervals in the resulting schedule.

Attributes

def duration(duration: Duration): WithState[Boolean, Any, Any, Duration]

A schedule that can recur one time, the specified amount of time into the future.

A schedule that can recur one time, the specified amount of time into the future.

Attributes

def exponential(base: Duration, factor: Double)(implicit trace: Trace): WithState[Long, Any, Any, Duration]

A schedule that always recurs, but will wait a certain amount between repetitions, given by base * factor.pow(n), where n is the number of repetitions so far. Returns the current duration between recurrences.

A schedule that always recurs, but will wait a certain amount between repetitions, given by base * factor.pow(n), where n is the number of repetitions so far. Returns the current duration between recurrences.

Attributes

def fibonacci(one: Duration)(implicit trace: Trace): WithState[(Duration, Duration), Any, Any, Duration]

A schedule that always recurs, increasing delays by summing the preceding two delays (similar to the fibonacci sequence). Returns the current duration between recurrences.

A schedule that always recurs, increasing delays by summing the preceding two delays (similar to the fibonacci sequence). Returns the current duration between recurrences.

Attributes

def fixed(interval: Duration): WithState[(Option[(Long, Long)], Long), Any, Any, Long]

A schedule that recurs on a fixed interval. Returns the number of repetitions of the schedule so far.

A schedule that recurs on a fixed interval. Returns the number of repetitions of the schedule so far.

If the action run between updates takes longer than the interval, then the action will be run immediately, but re-runs will not "pile up".

|-----interval-----|-----interval-----|-----interval-----|
|---------action--------||action|-----|action|-----------|

Attributes

def fromDuration(duration: Duration): WithState[Boolean, Any, Any, Duration]

A schedule that recurs once with the specified delay.

A schedule that recurs once with the specified delay.

Attributes

def fromDurations(duration: Duration, durations: Duration*): WithState[(::[Duration], Boolean), Any, Any, Duration]

A schedule that recurs once for each of the specified durations, delaying each time for the length of the specified duration. Returns the length of the current duration between recurrences.

A schedule that recurs once for each of the specified durations, delaying each time for the length of the specified duration. Returns the length of the current duration between recurrences.

Attributes

def fromFunction[A, B](f: A => B)(implicit trace: Trace): WithState[Unit, Any, A, B]

A schedule that always recurs, mapping input values through the specified function.

A schedule that always recurs, mapping input values through the specified function.

Attributes

def hourOfDay(hour: Int)(implicit trace: Trace): WithState[(OffsetDateTime, Long), Any, Any, Long]

Cron-like schedule that recurs every specified hour of each day. It triggers at zero minute of the hour. Producing a count of repeats: 0, 1, 2.

Cron-like schedule that recurs every specified hour of each day. It triggers at zero minute of the hour. Producing a count of repeats: 0, 1, 2.

NOTE: hour parameter is validated lazily. Must be in range 0...23.

Attributes

def identity[A]: WithState[Unit, Any, A, A]

A schedule that always recurs, which returns inputs as outputs.

A schedule that always recurs, which returns inputs as outputs.

Attributes

def linear(base: Duration)(implicit trace: Trace): WithState[Long, Any, Any, Duration]

A schedule that always recurs, but will repeat on a linear time interval, given by base * n where n is the number of repetitions so far. Returns the current duration between recurrences.

A schedule that always recurs, but will repeat on a linear time interval, given by base * n where n is the number of repetitions so far. Returns the current duration between recurrences.

Attributes

def minuteOfHour(minute: Int)(implicit trace: Trace): WithState[(OffsetDateTime, Long), Any, Any, Long]

Cron-like schedule that recurs every specified minute of each hour. It triggers at zero second of the minute. Producing a count of repeats: 0, 1, 2.

Cron-like schedule that recurs every specified minute of each hour. It triggers at zero second of the minute. Producing a count of repeats: 0, 1, 2.

NOTE: minute parameter is validated lazily. Must be in range 0...59.

Attributes

def once(implicit trace: Trace): WithState[Long, Any, Any, Unit]

A schedule that recurs one time.

A schedule that recurs one time.

Attributes

def recurUntil[A](f: A => Boolean)(implicit trace: Trace): WithState[Unit, Any, A, A]

A schedule that recurs for until the predicate evaluates to true.

A schedule that recurs for until the predicate evaluates to true.

Attributes

def recurUntil[A, B](pf: PartialFunction[A, B])(implicit trace: Trace): WithState[Unit, Any, A, Option[B]]

A schedule that recurs for until the input value becomes applicable to partial function and then map that value with given function.

A schedule that recurs for until the input value becomes applicable to partial function and then map that value with given function.

Attributes

def recurUntilEquals[A](a: => A)(implicit trace: Trace): WithState[Unit, Any, A, A]

A schedule that recurs for until the predicate is equal.

A schedule that recurs for until the predicate is equal.

Attributes

def recurUntilZIO[Env, A](f: A => URIO[Env, Boolean])(implicit trace: Trace): WithState[Unit, Env, A, A]

A schedule that recurs for until the predicate evaluates to true.

A schedule that recurs for until the predicate evaluates to true.

Attributes

def recurWhile[A](f: A => Boolean)(implicit trace: Trace): WithState[Unit, Any, A, A]

A schedule that recurs for as long as the predicate evaluates to true.

A schedule that recurs for as long as the predicate evaluates to true.

Attributes

def recurWhileEquals[A](a: => A)(implicit trace: Trace): WithState[Unit, Any, A, A]

A schedule that recurs for as long as the predicate is equal.

A schedule that recurs for as long as the predicate is equal.

Attributes

def recurWhileZIO[Env, A](f: A => URIO[Env, Boolean]): WithState[Unit, Env, A, A]

A schedule that recurs for as long as the effectful predicate evaluates to true.

A schedule that recurs for as long as the effectful predicate evaluates to true.

Attributes

def recurs(n: Long)(implicit trace: Trace): WithState[Long, Any, Any, Long]

A schedule spanning all time, which can be stepped only the specified number of times before it terminates.

A schedule spanning all time, which can be stepped only the specified number of times before it terminates.

Attributes

def recurs(n: Int)(implicit trace: Trace): WithState[Long, Any, Any, Long]

A schedule spanning all time, which can be stepped only the specified number of times before it terminates.

A schedule spanning all time, which can be stepped only the specified number of times before it terminates.

Attributes

def secondOfMinute(second0: Int)(implicit trace: Trace): WithState[(OffsetDateTime, Long), Any, Any, Long]

Cron-like schedule that recurs every specified second of each minute. It triggers at zero nanosecond of the second. Producing a count of repeats: 0, 1, 2.

Cron-like schedule that recurs every specified second of each minute. It triggers at zero nanosecond of the second. Producing a count of repeats: 0, 1, 2.

NOTE: second parameter is validated lazily. Must be in range 0...59.

Attributes

def spaced(duration: Duration)(implicit trace: Trace): WithState[Long, Any, Any, Long]

Returns a schedule that recurs continuously, each repetition spaced the specified duration from the last run.

Returns a schedule that recurs continuously, each repetition spaced the specified duration from the last run.

Attributes

def stop(implicit trace: Trace): WithState[Long, Any, Any, Unit]

A schedule that does not recur, it just stops.

A schedule that does not recur, it just stops.

Attributes

def succeed[A](a: => A)(implicit trace: Trace): WithState[Long, Any, Any, A]

Returns a schedule that repeats one time, producing the specified constant value.

Returns a schedule that repeats one time, producing the specified constant value.

Attributes

def unfold[A](a: => A)(f: A => A): WithState[A, Any, Any, A]

Unfolds a schedule that repeats one time from the specified state and iterator.

Unfolds a schedule that repeats one time from the specified state and iterator.

Attributes

def upTo(duration: Duration)(implicit trace: Trace): WithState[Option[OffsetDateTime], Any, Any, Duration]

A schedule that recurs during the given duration

A schedule that recurs during the given duration

Attributes

def windowed(interval: Duration): WithState[(Option[Long], Long), Any, Any, Long]

A schedule that divides the timeline to interval-long windows, and sleeps until the nearest window boundary every time it recurs.

A schedule that divides the timeline to interval-long windows, and sleeps until the nearest window boundary every time it recurs.

For example, windowed(10.seconds) would produce a schedule as follows:

    10s        10s        10s       10s
|----------|----------|----------|----------|
|action------|sleep---|act|-sleep|action----|

Attributes

Concrete fields

val count: WithState[Long, Any, Any, Long]

A schedule that always recurs, which counts the number of recurrences.

A schedule that always recurs, which counts the number of recurrences.

Attributes

A schedule that occurs everywhere, which returns the total elapsed duration since the first step.

A schedule that occurs everywhere, which returns the total elapsed duration since the first step.

Attributes

val forever: WithState[Long, Any, Any, Long]

A schedule that always recurs, producing a count of repeats: 0, 1, 2.

A schedule that always recurs, producing a count of repeats: 0, 1, 2.

Attributes