Class: Actor
Child modules and classes
Class Actor::Mailbox
Class Actor::Scheduler
Constants
| Name | Value |
|---|---|
| TCP | Revactor::TCP unless defined? Actor::TCP |
| Filter | Revactor::Filter unless defined? Actor::Filter |
| Delegator | Revactor::Delegator unless defined? Actor::Delegator |
Aliases
| Old name | New name |
|---|---|
| to_s | inspect |
Attributes
| Name | Read/write? |
|---|---|
| fiber | R |
| mailbox | R |
| scheduler | R |
Public Class Methods
[] (key)
Look up an actor in the global dictionary
[]= (key, actor)
Register this actor in the global dictionary
delete (key, &block)
Delete an actor from the global dictionary
receive (&filter)
Wait for messages matching a given filter. The filter object is yielded to be block passed to receive. You can then invoke the when argument which takes a parameter and a block. Messages are compared (using ===) against the parameter. The Case gem includes several tools for matching messages using ===
The first filter to match a message in the mailbox is executed. If no filters match then the actor sleeps.
reschedule ()
Reschedule the current actor for execution later
sleep (seconds)
Sleep for the specified number of seconds
Protected Class Methods
Public Instance Methods
<< (message)
Send a message to an actor
[] (key)
Look up value in the actor‘s dictionary
[]= (key, value)
Store a value in the actor‘s dictionary
delete (key, &block)
Delete a value from the actor‘s dictionary
link (actor)
Establish a bidirectional link to the given Actor and notify it of any system events which occur in this Actor (namely exits due to exceptions)
notify_exited (actor, reason)
Notify this actor that one of the Actors it‘s linked to has exited
notify_link (actor)
Notify this actor that it‘s now linked to the given one
notify_unlink (actor)
Notify this actor that it‘s now unlinked from the given one
send (message)
Alias for #<<
trap_exit= (value)
Actors trapping exit do not die when an error occurs in an Actor they are linked to. Instead the exit message is sent to their regular mailbox in the form [:exit, actor, reason]. This allows certain Actors to supervise sets of others and restart them in the event of an error.
trap_exit? ()
Is the Actor trapping exit?
unlink (actor)
Unestablish a link with the given actor
Protected Instance Methods
process_events ()
Process the Actor‘s system event queue