catcher

package
v0.0.0-...-ac8452e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Catcher

type Catcher struct {
	// Channels for intercepted messages
	ChSystemInbound chan *Envelope
	ChUserInbound   chan *Envelope
	ChUserOutbound  chan *Envelope

	// Channels for intercepted spawning of children
	ChSpawning chan *actor.PID

	// One followed actor per catcher
	AssignedActor *actor.PID

	Options options.Options
}

Catcher is the working horse of the interception mechanism. It seats in front of every tested actor and watches for messages and system events.

func New

func New() *Catcher

New creates a new instance of Catcher.

func (*Catcher) ShouldNotSendOrReceive

func (catcher *Catcher) ShouldNotSendOrReceive(pid *actor.PID) string

func (*Catcher) ShouldReceive

func (catcher *Catcher) ShouldReceive(sender *actor.PID, msg interface{}) string

func (*Catcher) ShouldReceiveSysMsg

func (catcher *Catcher) ShouldReceiveSysMsg(msg interface{}) string

func (*Catcher) ShouldSend

func (catcher *Catcher) ShouldSend(receiver *actor.PID, msg interface{}) string

func (*Catcher) ShouldSpawn

func (catcher *Catcher) ShouldSpawn(match string) string

func (*Catcher) Spawn

func (catcher *Catcher) Spawn(props *actor.Props, opts ...options.Options) (*actor.PID, error)

Spawn an actor with injected middleware.

type Context

type Context struct {
	actor.Context // This is the original context to pass calls to
	// contains filtered or unexported fields
}

This is a wrapper around a real actor.Context object to intercept calls for testing purposes. This should implement the actor.Context interface

func NewContext

func NewContext(catcher *Catcher, ctx actor.Context) *Context

func (*Context) Spawn

func (ctx *Context) Spawn(props *actor.Props) *actor.PID

func (*Context) SpawnNamed

func (ctx *Context) SpawnNamed(props *actor.Props, id string) (*actor.PID, error)

func (*Context) SpawnPrefix

func (ctx *Context) SpawnPrefix(props *actor.Props, prefix string) *actor.PID

type Envelope

type Envelope struct {
	Sender  *actor.PID
	Target  *actor.PID
	Message interface{}
}

Envelope is a wrapper that is used for all intercepted messages

type NullReceiver

type NullReceiver struct{}

func (*NullReceiver) Receive

func (nr *NullReceiver) Receive(ctx actor.Context)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL