actors

package
v0.0.0-...-3511abf Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotifyAfter

func NotifyAfter(ctx *actor.Context, d time.Duration, msg actor.Message) (*actor.Ref, bool)

NotifyAfter asynchronously notifies the context's recipient with the provided message when after the provided duration.

func NotifyOnSignal

func NotifyOnSignal(ctx *actor.Context, signals ...os.Signal)

NotifyOnSignal relays incoming signals to the caller. If no signals are provided, all incoming signals will be relayed. Otherwise, just the provided signals will.

func NotifyOnStop

func NotifyOnStop(context *actor.Context, ref *actor.Ref, msg actor.Message) <-chan struct{}

NotifyOnStop asynchronously notifies the context's recipient when the provided actor ref has stopped. Returns a channel that is closed when the recipient has been notified.

Types

type AskChild

type AskChild struct {
	ID      *string
	Message actor.Message
}

AskChild asks the child with the provided ID about the provided message. If the ID is not set, all children are asked about the message.

type Children

type Children struct{}

Children asks the actor for the list of actor references to all children.

type ForwardThroughMock

type ForwardThroughMock struct {
	To  *actor.Ref
	Msg actor.Message
}

ForwardThroughMock forwards a message (Msg) to another actor (To), using tell and ask appropriately.

type Group

type Group struct{}

Group is an actor that manages a set of child actors.

func (Group) Receive

func (g Group) Receive(ctx *actor.Context) error

Receive implements the actor.Actor interface.

type MockActor

type MockActor struct {
	Messages  []actor.Message
	Responses map[string]*MockResponse
	// contains filtered or unexported fields
}

MockActor is a convenience actor for testing hierarchies of actors without instantiating off of them.

func (*MockActor) AssertExpectations

func (a *MockActor) AssertExpectations() error

AssertExpectations asserts mocked expectations were met.

func (*MockActor) Expect

func (a *MockActor) Expect(t string, r MockResponse)

Expect sets up an expectation to send some response.

func (*MockActor) Receive

func (a *MockActor) Receive(ctx *actor.Context) error

Receive implements actor.Actor.

func (*MockActor) String

func (a *MockActor) String() string

String implements fmt.Stringer.

type MockResponse

type MockResponse struct {
	Msg      actor.Message
	Consumed bool
}

MockResponse sets up a respond to use in respond to a message of a given type.

type NewChild

type NewChild struct {
	ID    string
	Actor actor.Actor
}

NewChild creates a new child actor in the group.

type TellChild

type TellChild struct {
	ID      *string
	Message actor.Message
}

TellChild tells the child with the provided ID about the provided message. If the ID is not set, all children are told about the message.

Jump to

Keyboard shortcuts

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