t

Stream._extend._trigger

trait _trigger[A] extends AnyRef

Trigger Interface.

Allows to provide status of ongoing processing

(1 <> 5000).all
  .peek(_ => {
    // Some expensive processing
    App.pause(1.Millis)
  })
  .triggerFirst(t => "Started at: " + t.dayTime lp)
  .triggerEvery(1.Second, (i, t) => "Processed " + i + " in " + t lp)
  .triggerLast((i, t) => "Grand Total " + i + " in " + t lp)
  .drain

  // Output
  Started at: 7:23:56.095
  Processed 962 in 1 sec
  Processed 1959 in 2 sec
  Processed 2959 in 3 sec
  Processed 3959 in 4 sec
  Processed 4960 in 5 sec
  Grand Total 5000 in 5.045 sec
Self Type
Stream[A]
Ordering
  1. Alphabetic
Inherited
  1. Stream._extend._trigger
  2. scala.AnyRef
  3. scala.Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Method

  1. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  2. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  3. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  4. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  6. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  7. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  8. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. final def notify(): Unit
    Definition Classes
    AnyRef
  10. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  11. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  12. def toString(): String
    Definition Classes
    AnyRef → Any
  13. def triggerEmpty(f: ⇒ Unit): ~[A]

    Run for empty

    Run for empty

    Runs the given function if pipeline is empty

    Note: This method might not execute for some pumping methods, if they determine that pipeline is empty from the Stream._info, and would not even attempt to pump elements. Please, test

    Definition Classes
    _trigger
  14. def triggerEvery(time: Duration, f: (Int, Duration) ⇒ Unit): ~[A]

    Run on timer

    Run on timer

    Runs given function every time period, while elements are being pumped

    Note, it will not run even once if all elements pumped in less than the given time length

    time

    period to run

    f

    function with cumulative element count and time length as arguments

    Definition Classes
    _trigger
  15. def triggerFirst(f: (Time) ⇒ Unit): ~[A]

    Runs before first

    Runs before first

    Runs given function when the first element pumped, but before it is passed down the pipeline

    This will not run for empty pipeline

    f

    Function with current time as argument

    Definition Classes
    _trigger
  16. def triggerLast(f: (Int, Duration) ⇒ Unit): ~[A]

    Runs after last

    Runs after last

    Runs given function when pumping for the next element brings nothing

    This will not run for empty pipeline

    f

    Function with element count and the Duration it took to pump all elements

    Definition Classes
    _trigger
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Operator

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
Linear Supertypes
AnyRef, Any
Source: _trigger.scala