io

reactors

package reactors

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. reactors
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. trait Channel[T] extends AnyRef

    Channel is a shareable reference to a writing endpoint of an isolate.

    Channel is a shareable reference to a writing endpoint of an isolate.

    By calling the channel's ! method, an event is sent to the channel. The event is eventually emitted on the channel's corresponding event stream, which is readable only by the isolate that owns that channel.

    T

    type of the events propagated by this channel

  2. class ChannelBuilder extends AnyRef

    Used for building channel objects.

  3. case class ChannelUrl(reactorUrl: ReactorUrl, anchor: String) extends Product with Serializable

  4. class Connector[T] extends Identifiable

    A pair of a channel and its event stream.

    A pair of a channel and its event stream.

    Allows closing the channel with its seal operation.

  5. trait EventQueue[T] extends AnyRef

    A queue that buffers events that arrive on the corresponding channel.

    A queue that buffers events that arrive on the corresponding channel.

    The enqueue method may have FIFO queue, priority queue, or some other semantics, depending on the implementation.

  6. trait Events[T] extends AnyRef

    A basic event stream.

    A basic event stream.

    Event streams are special objects that may produce events of a certain type T. Clients may subscribe side-effecting functions (i.e. callbacks) to these events with onReaction, onEvent, onMatch and on -- each of these methods will invoke the callback when an event is produced, but some may be more suitable depending on the use-case.

    An event stream produces events until it unreacts. After the event stream unreacts, it never produces an event again.

    Event streams can also be manipulated using declarative combinators such as map, filter, until, after and scanPast:

    def positiveSquares(r: Events[Int]) = r.map(x => x * x).filter(_ != 0)

    With the exception of onX family of methods, and unless otherwise specified, operators passed to these declarative combinators should be pure -- they should not have any side-effects.

    The result of applying a declarative combinator on Events[T] is usually another Events[S], possibly with a type parameter S different from T. Event sink combinators, such as onEvent, return a Subscription object used to unsubscribe from their event source.

    Combinators that start with the prefix on, to or get are called *sink combinators*. Calling these combinators subscribes to the event stream and creates a subscription object. The event source is from there on responsible for propagating events to sink combinators until it either *unreacts*, meaning that it will not emit any other events, or the event sink gets *unsubscribed*. The event sink can be unsubscribed by calling the unsubscribe method of the Subscription object. The client is responsible for unsubscribing from an event source once the events are no longer needed. Failure to do so risks *time leaks*, a form of resource leak in which the program gets slower and slower (because it needs to propagate no longer needed events).

    Event streams are specialized for Int, Long and Double.

    Every event stream is bound to a specific Reactor, the basic unit of concurrency. Within a reactor, at most a single event stream propagates events at a time. An event stream will only produce events during the execution of that reactor -- events are never triggered on a different reactor. It is forbidden to share event streams between reactors.

    T

    type of the events in this event stream

  7. trait Hash[T] extends AnyRef

  8. class IVar[T] extends Signal[T]

    An event stream that can be either completed, or unreacted at most once.

    An event stream that can be either completed, or unreacted at most once.

    Assigning a value propagates an event to all the subscribers, and then propagates an unreaction. To assign a value:

    val iv = new Events.IVar[Int]
    iv := 5
    assert(iv() == 5)

    To unreact (i.e. seal, or close) an ivar without assigning a value:

    val iv = new Events.IVar[Int]
    iv.unreact()
    assert(iv.isUnreacted)
    T

    type of the value in the IVar

  9. trait Identifiable extends AnyRef

    Any object that contains a unique id within some scope.

  10. trait Observer[T] extends AnyRef

    An object that can act upon an event or be signalled that there will be no more events.

    An object that can act upon an event or be signalled that there will be no more events.

    T

    type of events the observer responds to

  11. final class Proto[+I <: Reactor[_]] extends AnyRef

    A prototype for instantiating a reactor that takes specific parameters.

    A prototype for instantiating a reactor that takes specific parameters.

    I

    type of the reactor

  12. trait Protocol extends AnyRef

    An encapsulation of a set of event streams and channels.

  13. class RCell[T] extends Signal[T] with Observer[T]

    The reactive cell abstraction represents a mutable memory location whose changes may produce events.

    The reactive cell abstraction represents a mutable memory location whose changes may produce events.

    An RCell is conceptually similar to a reactive emitter lifted into a signal.

    T

    the type of the values it stores

  14. trait Reactor[T] extends AnyRef

    A reactor is a basic unit of concurrency.

    A reactor is a basic unit of concurrency.

    A concurrent program in the Reactors framework is composed of multiple reactors, which execute concurrently, and in isolation. The only way they can communicate is by exchanging events using entities called *channels*.

    A Reactor[T] object accepts events of type T on its input channel. One reactor can propagate events concurrently to other reactors. Event streams cannot be shared between reactors -- it is an error to use an event stream originating in one reactor in some different reactor.

    Reactors are defined by extending the Reactor trait. The events passed to reactors can be subscribed to using their main.events stream. Here is an example:

    class MyPrinter extends Reactor[String] {
      main.events onEvent {
        e => println(e)
      }
    }

    Separate reactor instances that exist at runtime are created using reactor systems. Each reactor belongs to a specific reactor system. Usually there is a single reactor system within a single program instance. Here is an example:

    val reactorSystem = ReactorSystem.default("MyReactorSystem")
    val channel = reactorSystem.spawn(Proto[MyPrinter])

    Creating a reactor returns its channel. Events can be sent to a channel using the ! method:

    channel ! "Hi!" // eventually, this is printed by `MyPrinter`

    To stop, a reactor must seal its main channel. The following reactor seals its main channel after receiving the first event:

    class MyPrinter extends Reactor[String] {
      main.events onEvent {
        e =>
        println(e)
        main.seal()
      }
    }

    Reactors also receive special SysEvent events on the internal.events stream.

    T

    the type of events, which this reactor produces

  15. case class ReactorDied(t: Throwable) extends SysEvent with Product with Serializable

    Denotes that the isolate died due to an exception.

    Denotes that the isolate died due to an exception.

    This event is sent after ReactorStarted. This event is sent before ReactorTerminated, *unless* the exception is thrown while ReactorTerminated is being processed, in which case the ReactorDied is not sent.

    Note that, if the exception is thrown during the isolate constructor invocation and before the appropriate event handler is created, this event cannot be sent to that event handler.

    t

    the exception that the isolate threw

  16. case class ReactorError(msg: String, cause: Throwable) extends Error with Product with Serializable

    Thrown when an error in reactor execution occurs.

  17. class ReactorSystem extends Services

    A system used to create, track and identify reactors.

    A system used to create, track and identify reactors.

    A reactor system is composed of a set of reactors that have a common configuration.

  18. case class ReactorUrl(systemUrl: SystemUrl, name: String) extends Product with Serializable

  19. class Remote extends Service

  20. trait Scheduler extends AnyRef

    An object that schedules reactors for execution.

    An object that schedules reactors for execution.

    After a reactor is instantiated, its reactor frame is assigned a scheduler by the reactor system. A reactor that is assigned a specific scheduler will always be executed on that same scheduler.

    After creating a reactor, every reactor system will first call the startSchedule method on the reactor frame. Then, the reactor system will call the schedule method every time there are events ready for the reactor.

    Note: Clients never invoke Scheduler operations directly, but can implement their own scheduler if necessary.

    See also

    org.reactors.ReactorSystem

  21. trait Signal[T] extends Events[T] with Subscription

    A special type of an event stream that caches the last emitted event.

    A special type of an event stream that caches the last emitted event.

    This last event is called the signal's value. It can be read using the Signal's apply method.

    T

    the type of the events in this signal

  22. class Spec[T] extends AnyRef

    Evidence value for specialized type parameters.

    Evidence value for specialized type parameters.

    Used to artificially insert the type into a type signature.

  23. trait Subscription extends AnyRef

    A subscription to a certain kind of event, event processing or computation.

    A subscription to a certain kind of event, event processing or computation.

    Calling unsubscribe on the subscription causes the events to no longer be propagated to this subscription, or some computation to cease.

    Unsubscribing is idempotent -- calling unsubscribe second time does nothing.

  24. sealed trait SysEvent extends AnyRef

    System events are a special kind of internal events that can be observed by isolates.

  25. case class SystemUrl(schema: String, host: String, port: Int) extends Product with Serializable

  26. case class UnhandledException(cause: Throwable) extends Exception with Product with Serializable

    Thrown when an exception is propagated to an event handler, such as onEvent.

  27. type spec = specialized

Value Members

  1. object Channel

    Default channel implementations.

  2. object EventQueue

    Contains default event queue implementations.

  3. object Events

    Contains useful Events implementations and factory methods.

  4. object IVar

  5. object Lethal

    Matches lethal throwables.

  6. object NonLethal

    Matches non-lethal throwables.

  7. object Proto

  8. object Protocol

  9. object RCell

  10. object Reactor

  11. object ReactorPreempted extends SysEvent with Product with Serializable

    Denotes that the isolate was preempted by the scheduler.

    Denotes that the isolate was preempted by the scheduler.

    Always sent after ReactorStarted and before ReactorTerminated.

    When the isolate is preempted, it loses control of the execution thread, until the scheduler schedules it again on some (possibly the same) thread. This event is typically used to send another message back to the isolate, indicating that he should be scheduled again later.

  12. object ReactorScheduled extends SysEvent with Product with Serializable

    Denotes that the isolate was scheduled for execution by the scheduler.

    Denotes that the isolate was scheduled for execution by the scheduler.

    Always sent after ReactorStarted and before ReactorTerminated.

    This event usually occurs when isolate is woken up to process incoming events, but may be invoked even if there are no pending events. This event is typically used in conjunction with a scheduler that periodically wakes up the isolate.

  13. object ReactorStarted extends SysEvent with Product with Serializable

    Denotes start of an isolate.

    Denotes start of an isolate.

    Produced before any other event.

  14. object ReactorSystem

    Contains factory methods for creating reactor systems.

  15. object ReactorTerminated extends SysEvent with Product with Serializable

    Denotes the termination of an isolate.

    Denotes the termination of an isolate.

    Called after all other events.

  16. object Remote

  17. object Scheduler

    Companion object for creating standard reactor schedulers.

  18. object Signal

  19. object Subscription

    Default subscription implementations.

  20. implicit def anySpec[T]: Spec[T]

  21. package concurrent

  22. implicit val doubleHash: Hash[Double]

  23. implicit val doubleSpec: Spec[Double]

  24. object exception

  25. val ignoreNonLethal: PartialFunction[Throwable, Unit]

    Partial function ignores non-lethal throwables.

    Partial function ignores non-lethal throwables.

    This is useful in composition with other exception handlers.

  26. implicit val intHash: Hash[Int]

  27. implicit val intSpec: Spec[Int]

  28. def isLethal(t: Throwable): Boolean

    Determines if the throwable is lethal, i.e.

    Determines if the throwable is lethal, i.e. should the program immediately stop.

  29. def isNonLethal(t: Throwable): Boolean

    Determines if the throwable is not lethal.

  30. package japi

  31. implicit val longHash: Hash[Long]

  32. implicit val longSpec: Spec[Long]

  33. package pickle

  34. implicit def refHash[T <: AnyRef]: Hash[T]

Inherited from AnyRef

Inherited from Any

Ungrouped