Class/Object

fs2

Scheduler

Related Docs: object Scheduler | package fs2

Permalink

abstract class Scheduler extends AnyRef

Provides the ability to schedule evaluation of thunks in the future.

Source
Scheduler.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Scheduler
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Scheduler()

    Permalink

Abstract Value Members

  1. abstract def scheduleAtFixedRate(period: FiniteDuration)(thunk: ⇒ Unit): () ⇒ Unit

    Permalink

    Evaluates the thunk every period.

    Evaluates the thunk every period. Returns a thunk that when evaluated, cancels the execution.

    Attributes
    protected
  2. abstract def scheduleOnce(delay: FiniteDuration)(thunk: ⇒ Unit): () ⇒ Unit

    Permalink

    Evaluates the thunk after the delay.

    Evaluates the thunk after the delay. Returns a thunk that when evaluated, cancels the execution.

    Attributes
    protected

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Scheduler to any2stringadd[Scheduler] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Scheduler, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Scheduler to ArrowAssoc[Scheduler] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def awakeEvery[F[_]](d: FiniteDuration)(implicit F: Effect[F], ec: ExecutionContext): Stream[F, FiniteDuration]

    Permalink

    Discrete stream that every d emits elapsed duration since the start time of stream consumption.

    Discrete stream that every d emits elapsed duration since the start time of stream consumption.

    For example: awakeEvery[IO](5 seconds) will return (approximately) 5s, 10s, 15s, and will lie dormant between emitted values.

    This uses an implicit Scheduler for the timed events, and runs the consumer using the F Effect[F], to allow for the stream to decide whether result shall be run on different thread pool.

    Note: for very small values of d, it is possible that multiple periods elapse and only some of those periods are visible in the stream. This occurs when the scheduler fires faster than periods are able to be published internally, possibly due to an execution context that is slow to evaluate.

    d

    FiniteDuration between emits of the resulting stream

  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def debounce[F[_], O](d: FiniteDuration)(implicit F: Effect[F], ec: ExecutionContext): Pipe[F, O, O]

    Permalink

    Debounce the stream with a minimum period of d between each element.

    Debounce the stream with a minimum period of d between each element.

    Example:
    1. scala> import scala.concurrent.duration._, scala.concurrent.ExecutionContext.Implicits.global, cats.effect.IO
      scala> val s2 = Scheduler[IO](1).flatMap { scheduler =>
           |   val s = Stream(1, 2, 3) ++ scheduler.sleep_[IO](500.millis) ++ Stream(4, 5) ++ scheduler.sleep_[IO](10.millis) ++ Stream(6)
           |   s.through(scheduler.debounce(100.milliseconds))
           | }
      scala> s2.runLog.unsafeRunSync
      res0: Vector[Int] = Vector(3, 6)
  10. def delayedExecutionContext(delay: FiniteDuration, reporter: (Throwable) ⇒ Unit = ExecutionContext.defaultReporter): ExecutionContext

    Permalink

    Returns an execution context that executes all tasks after a specified delay.

  11. def duration[F[_]](implicit F: Sync[F]): Stream[F, FiniteDuration]

    Permalink

    A continuous stream of the elapsed time, computed using System.nanoTime.

    A continuous stream of the elapsed time, computed using System.nanoTime. Note that the actual granularity of these elapsed times depends on the OS, for instance the OS may only update the current time every ten milliseconds or so.

  12. def ensuring(cond: (Scheduler) ⇒ Boolean, msg: ⇒ Any): Scheduler

    Permalink
    Implicit information
    This member is added by an implicit conversion from Scheduler to Ensuring[Scheduler] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: (Scheduler) ⇒ Boolean): Scheduler

    Permalink
    Implicit information
    This member is added by an implicit conversion from Scheduler to Ensuring[Scheduler] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: Boolean, msg: ⇒ Any): Scheduler

    Permalink
    Implicit information
    This member is added by an implicit conversion from Scheduler to Ensuring[Scheduler] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean): Scheduler

    Permalink
    Implicit information
    This member is added by an implicit conversion from Scheduler to Ensuring[Scheduler] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  18. def every[F[_]](d: FiniteDuration): Stream[F, Boolean]

    Permalink

    A continuous stream which is true after d, 2d, 3d... elapsed duration, and false otherwise.

    A continuous stream which is true after d, 2d, 3d... elapsed duration, and false otherwise. If you'd like a 'discrete' stream that will actually block until d has elapsed, use awakeEvery instead.

  19. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from Scheduler to StringFormat[Scheduler] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  21. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  22. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  23. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  24. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  25. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  26. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  27. def sleep[F[_]](d: FiniteDuration)(implicit F: Async[F], ec: ExecutionContext): Stream[F, Unit]

    Permalink

    A single-element Stream that waits for the duration d before emitting unit.

    A single-element Stream that waits for the duration d before emitting unit. This uses the implicit Scheduler to signal duration and avoid blocking on thread. After the signal, the execution continues on the supplied execution context.

  28. def sleep_[F[_]](d: FiniteDuration)(implicit F: Async[F], ec: ExecutionContext): Stream[F, Nothing]

    Permalink

    Alias for sleep(d).drain.

    Alias for sleep(d).drain. Often used in conjunction with ++ (i.e., sleep_(..) ++ s) as a more performant version of sleep(..) >> s.

  29. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  30. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  31. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. def [B](y: B): (Scheduler, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from Scheduler to ArrowAssoc[Scheduler] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Scheduler to any2stringadd[Scheduler]

Inherited by implicit conversion StringFormat from Scheduler to StringFormat[Scheduler]

Inherited by implicit conversion Ensuring from Scheduler to Ensuring[Scheduler]

Inherited by implicit conversion ArrowAssoc from Scheduler to ArrowAssoc[Scheduler]

Ungrouped