actor

package
v0.0.0-...-534b11b Latest Latest
Warning

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

Go to latest
Published: May 3, 2016 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package actor is a generated protocol buffer package.

It is generated from these files:

protos.proto

It has these top-level messages:

PID
Restarting
Stopping
Stopped
PoisonPill
Started

Index

Constants

View Source
const (
	MailboxIdle    int32 = iota
	MailboxRunning int32 = iota
)
View Source
const (
	MailboxHasNoMessages   int32 = iota
	MailboxHasMoreMessages int32 = iota
)

Variables

View Source
var (
	ErrInvalidLengthProtos = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProtos   = fmt.Errorf("proto: integer overflow")
)
View Source
var ProcessRegistry = &ProcessRegistryValue{
	Host:           "nonhost",
	LocalPids:      make(map[string]ActorRef),
	RemoteHandlers: make([]HostResolver, 0),
}

Functions

func RequestResponsePID

func RequestResponsePID() (*PID, *Response)

Types

type Actor

type Actor interface {
	Receive(message Context)
}

type ActorCell

type ActorCell struct {
	// contains filtered or unexported fields
}

func NewActorCell

func NewActorCell(props Props, parent *PID) *ActorCell

func (*ActorCell) Become

func (cell *ActorCell) Become(behavior Receive)

func (*ActorCell) BecomeStacked

func (cell *ActorCell) BecomeStacked(behavior Receive)

func (*ActorCell) Children

func (cell *ActorCell) Children() []*PID

func (*ActorCell) Parent

func (cell *ActorCell) Parent() *PID

func (*ActorCell) Self

func (cell *ActorCell) Self() *PID

func (*ActorCell) Spawn

func (cell *ActorCell) Spawn(props Props) *PID

func (*ActorCell) SpawnNamed

func (cell *ActorCell) SpawnNamed(props Props, name string) *PID

func (*ActorCell) UnbecomeStacked

func (cell *ActorCell) UnbecomeStacked()

func (*ActorCell) Unwatch

func (cell *ActorCell) Unwatch(who *PID)

func (*ActorCell) Watch

func (cell *ActorCell) Watch(who *PID)

type ActorProducer

type ActorProducer func() Actor

type ActorRef

type ActorRef interface {
	Tell(message interface{})
	SendSystemMessage(message SystemMessage)
	Stop()
}

type BoundedBatchingMailbox

type BoundedBatchingMailbox struct {
	// contains filtered or unexported fields
}

func (*BoundedBatchingMailbox) PostSystemMessage

func (mailbox *BoundedBatchingMailbox) PostSystemMessage(message SystemMessage)

func (*BoundedBatchingMailbox) PostUserMessage

func (mailbox *BoundedBatchingMailbox) PostUserMessage(message interface{})

func (*BoundedBatchingMailbox) RegisterHandlers

func (mailbox *BoundedBatchingMailbox) RegisterHandlers(userInvoke func(interface{}), systemInvoke func(SystemMessage))

func (*BoundedBatchingMailbox) Resume

func (mailbox *BoundedBatchingMailbox) Resume()

func (*BoundedBatchingMailbox) Suspend

func (mailbox *BoundedBatchingMailbox) Suspend()

type BoundedMailbox

type BoundedMailbox struct {
	// contains filtered or unexported fields
}

func (*BoundedMailbox) PostSystemMessage

func (mailbox *BoundedMailbox) PostSystemMessage(message SystemMessage)

func (*BoundedMailbox) PostUserMessage

func (mailbox *BoundedMailbox) PostUserMessage(message interface{})

func (*BoundedMailbox) RegisterHandlers

func (mailbox *BoundedMailbox) RegisterHandlers(userInvoke func(interface{}), systemInvoke func(SystemMessage))

func (*BoundedMailbox) Resume

func (mailbox *BoundedMailbox) Resume()

func (*BoundedMailbox) Suspend

func (mailbox *BoundedMailbox) Suspend()

type Context

type Context interface {
	Watch(*PID)
	Unwatch(*PID)
	Message() interface{}
	Become(Receive)
	BecomeStacked(Receive)
	UnbecomeStacked()
	Self() *PID
	Parent() *PID
	Spawn(Props) *PID
	SpawnNamed(Props, string) *PID
	Children() []*PID
	Stash()
}

func NewContext

func NewContext(cell *ActorCell, message interface{}) Context

type ContextValue

type ContextValue struct {
	*ActorCell
	// contains filtered or unexported fields
}

func (*ContextValue) Message

func (context *ContextValue) Message() interface{}

func (*ContextValue) Stash

func (context *ContextValue) Stash()

type DeadLetterActorRef

type DeadLetterActorRef struct {
}

func (DeadLetterActorRef) SendSystemMessage

func (DeadLetterActorRef) SendSystemMessage(message SystemMessage)

func (DeadLetterActorRef) Stop

func (DeadLetterActorRef) Stop()

func (DeadLetterActorRef) Tell

func (DeadLetterActorRef) Tell(message interface{})

type Decider

type Decider func(child *PID, cause interface{}) Directive

type Directive

type Directive int
const (
	ResumeDirective Directive = iota
	RestartDirective
	StopDirective
	EscalateDirective
)

func DefaultDecider

func DefaultDecider(child *PID, reason interface{}) Directive

type EmptyActor

type EmptyActor struct {
	// contains filtered or unexported fields
}

func (*EmptyActor) Receive

func (state *EmptyActor) Receive(context Context)

type GroupRouterConfig

type GroupRouterConfig interface {
	RouterConfig
	GroupRouter()
}

func NewRoundRobinGroup

func NewRoundRobinGroup(routees ...*PID) GroupRouterConfig

type HostResolver

type HostResolver func(*PID) (ActorRef, bool)

type LocalActorRef

type LocalActorRef struct {
	// contains filtered or unexported fields
}

func NewLocalActorRef

func NewLocalActorRef(mailbox Mailbox) *LocalActorRef

func (*LocalActorRef) Resume

func (ref *LocalActorRef) Resume()

func (*LocalActorRef) SendSystemMessage

func (ref *LocalActorRef) SendSystemMessage(message SystemMessage)

func (*LocalActorRef) Stop

func (ref *LocalActorRef) Stop()

func (*LocalActorRef) Suspend

func (ref *LocalActorRef) Suspend()

func (*LocalActorRef) Tell

func (ref *LocalActorRef) Tell(message interface{})

type Mailbox

type Mailbox interface {
	PostUserMessage(message interface{})
	PostSystemMessage(message SystemMessage)
	Suspend()
	Resume()
	RegisterHandlers(userInvoke func(interface{}), systemInvoke func(SystemMessage))
}

type MailboxProducer

type MailboxProducer func() Mailbox

func NewBoundedBatchingMailbox

func NewBoundedBatchingMailbox(batchSize int, size int) MailboxProducer

func NewBoundedMailbox

func NewBoundedMailbox(throughput int, size int) MailboxProducer

func NewUnboundedBatchingMailbox

func NewUnboundedBatchingMailbox(batchSize int) MailboxProducer

func NewUnboundedMailbox

func NewUnboundedMailbox(throughput int) MailboxProducer

type OneForOneStrategy

type OneForOneStrategy struct {
	// contains filtered or unexported fields
}

func (*OneForOneStrategy) Handle

func (strategy *OneForOneStrategy) Handle(child *PID, reason interface{}) Directive

type PID

type PID struct {
	Host string `protobuf:"bytes,1,opt,name=Host,json=host,proto3" json:"Host,omitempty"`
	Id   string `protobuf:"bytes,2,opt,name=Id,json=id,proto3" json:"Id,omitempty"`
}

func NewPID

func NewPID(host, id string) *PID

func Spawn

func Spawn(props Props) *PID

func SpawnNamed

func SpawnNamed(props Props, name string) *PID

func (*PID) Descriptor

func (*PID) Descriptor() ([]byte, []int)

func (*PID) Marshal

func (m *PID) Marshal() (data []byte, err error)

func (*PID) MarshalTo

func (m *PID) MarshalTo(data []byte) (int, error)

func (*PID) ProtoMessage

func (*PID) ProtoMessage()

func (*PID) Reset

func (m *PID) Reset()

func (*PID) Size

func (m *PID) Size() (n int)

func (*PID) Stop

func (pid *PID) Stop()

func (*PID) String

func (m *PID) String() string

func (*PID) Tell

func (pid *PID) Tell(message interface{})

func (*PID) Unmarshal

func (m *PID) Unmarshal(data []byte) error

type PoisonPill

type PoisonPill struct {
}

func (*PoisonPill) Descriptor

func (*PoisonPill) Descriptor() ([]byte, []int)

func (*PoisonPill) Marshal

func (m *PoisonPill) Marshal() (data []byte, err error)

func (*PoisonPill) MarshalTo

func (m *PoisonPill) MarshalTo(data []byte) (int, error)

func (*PoisonPill) ProtoMessage

func (*PoisonPill) ProtoMessage()

func (*PoisonPill) Reset

func (m *PoisonPill) Reset()

func (*PoisonPill) Size

func (m *PoisonPill) Size() (n int)

func (*PoisonPill) String

func (m *PoisonPill) String() string

func (*PoisonPill) Unmarshal

func (m *PoisonPill) Unmarshal(data []byte) error

type PoolRouterConfig

type PoolRouterConfig interface {
	RouterConfig
	PoolRouter()
}

func NewRoundRobinPool

func NewRoundRobinPool(poolSize int) PoolRouterConfig

type ProcessRegistryValue

type ProcessRegistryValue struct {
	Host           string
	LocalPids      map[string]ActorRef //maybe this should be replaced with something lockfree like ctrie instead
	RemoteHandlers []HostResolver
	SequenceID     uint64
	// contains filtered or unexported fields
}

func (*ProcessRegistryValue) RegisterHostResolver

func (pr *ProcessRegistryValue) RegisterHostResolver(handler HostResolver)

type Properties

type Properties interface {
	ProduceActor() Actor
	ProduceMailbox() Mailbox
	Supervisor() SupervisionStrategy
	RouterConfig() RouterConfig
}

type Props

type Props struct {
	// contains filtered or unexported fields
}

func FromFunc

func FromFunc(receive Receive) Props

func FromGroupRouter

func FromGroupRouter(router GroupRouterConfig) Props

func FromInstance

func FromInstance(template Actor) Props

func FromProducer

func FromProducer(actorProducer ActorProducer) Props

func (Props) ProduceActor

func (props Props) ProduceActor() Actor

func (Props) ProduceMailbox

func (props Props) ProduceMailbox() Mailbox

func (Props) RouterConfig

func (props Props) RouterConfig() RouterConfig

func (Props) Supervisor

func (props Props) Supervisor() SupervisionStrategy

func (Props) WithMailbox

func (props Props) WithMailbox(mailbox MailboxProducer) Props

func (Props) WithPoolRouter

func (props Props) WithPoolRouter(routerConfig PoolRouterConfig) Props

func (Props) WithSupervisor

func (props Props) WithSupervisor(supervisor SupervisionStrategy) Props

type Receive

type Receive func(Context)

type Response

type Response struct {
	// contains filtered or unexported fields
}

func (*Response) Result

func (ref *Response) Result() interface{}

func (*Response) ResultChannel

func (ref *Response) ResultChannel() <-chan interface{}

func (*Response) ResultOrTimeout

func (ref *Response) ResultOrTimeout(timeout time.Duration) (interface{}, error)

func (*Response) SendSystemMessage

func (ref *Response) SendSystemMessage(message SystemMessage)

func (*Response) Stop

func (ref *Response) Stop()

func (*Response) Tell

func (ref *Response) Tell(message interface{})

type Restarting

type Restarting struct {
}

user messages

func (*Restarting) Descriptor

func (*Restarting) Descriptor() ([]byte, []int)

func (*Restarting) Marshal

func (m *Restarting) Marshal() (data []byte, err error)

func (*Restarting) MarshalTo

func (m *Restarting) MarshalTo(data []byte) (int, error)

func (*Restarting) ProtoMessage

func (*Restarting) ProtoMessage()

func (*Restarting) Reset

func (m *Restarting) Reset()

func (*Restarting) Size

func (m *Restarting) Size() (n int)

func (*Restarting) String

func (m *Restarting) String() string

func (*Restarting) Unmarshal

func (m *Restarting) Unmarshal(data []byte) error

type RoundRobinGroupRouter

type RoundRobinGroupRouter struct {
	// contains filtered or unexported fields
}

func (*RoundRobinGroupRouter) Create

func (config *RoundRobinGroupRouter) Create() RouterState

func (*RoundRobinGroupRouter) GroupRouter

func (config *RoundRobinGroupRouter) GroupRouter()

func (*RoundRobinGroupRouter) OnStarted

func (config *RoundRobinGroupRouter) OnStarted(context Context, props Props, router RouterState)

type RoundRobinPoolRouter

type RoundRobinPoolRouter struct {
	// contains filtered or unexported fields
}

func (*RoundRobinPoolRouter) Create

func (config *RoundRobinPoolRouter) Create() RouterState

func (*RoundRobinPoolRouter) OnStarted

func (config *RoundRobinPoolRouter) OnStarted(context Context, props Props, router RouterState)

func (*RoundRobinPoolRouter) PoolRouter

func (config *RoundRobinPoolRouter) PoolRouter()

type RoundRobinState

type RoundRobinState struct {
	// contains filtered or unexported fields
}

func (*RoundRobinState) Route

func (state *RoundRobinState) Route(message interface{})

func (*RoundRobinState) SetRoutees

func (state *RoundRobinState) SetRoutees(routees []*PID)

type RouterActorRef

type RouterActorRef struct {
	ActorRef
	// contains filtered or unexported fields
}

func (*RouterActorRef) Tell

func (ref *RouterActorRef) Tell(message interface{})

type RouterConfig

type RouterConfig interface {
	OnStarted(context Context, props Props, router RouterState)
	Create() RouterState
}

type RouterState

type RouterState interface {
	Route(message interface{})
	SetRoutees(routees []*PID)
}

type Started

type Started struct {
}

func (*Started) Descriptor

func (*Started) Descriptor() ([]byte, []int)

func (*Started) Marshal

func (m *Started) Marshal() (data []byte, err error)

func (*Started) MarshalTo

func (m *Started) MarshalTo(data []byte) (int, error)

func (*Started) ProtoMessage

func (*Started) ProtoMessage()

func (*Started) Reset

func (m *Started) Reset()

func (*Started) Size

func (m *Started) Size() (n int)

func (*Started) String

func (m *Started) String() string

func (*Started) Unmarshal

func (m *Started) Unmarshal(data []byte) error

type Stopped

type Stopped struct {
}

func (*Stopped) Descriptor

func (*Stopped) Descriptor() ([]byte, []int)

func (*Stopped) Marshal

func (m *Stopped) Marshal() (data []byte, err error)

func (*Stopped) MarshalTo

func (m *Stopped) MarshalTo(data []byte) (int, error)

func (*Stopped) ProtoMessage

func (*Stopped) ProtoMessage()

func (*Stopped) Reset

func (m *Stopped) Reset()

func (*Stopped) Size

func (m *Stopped) Size() (n int)

func (*Stopped) String

func (m *Stopped) String() string

func (*Stopped) Unmarshal

func (m *Stopped) Unmarshal(data []byte) error

type Stopping

type Stopping struct {
}

func (*Stopping) Descriptor

func (*Stopping) Descriptor() ([]byte, []int)

func (*Stopping) Marshal

func (m *Stopping) Marshal() (data []byte, err error)

func (*Stopping) MarshalTo

func (m *Stopping) MarshalTo(data []byte) (int, error)

func (*Stopping) ProtoMessage

func (*Stopping) ProtoMessage()

func (*Stopping) Reset

func (m *Stopping) Reset()

func (*Stopping) Size

func (m *Stopping) Size() (n int)

func (*Stopping) String

func (m *Stopping) String() string

func (*Stopping) Unmarshal

func (m *Stopping) Unmarshal(data []byte) error

type SupervisionStrategy

type SupervisionStrategy interface {
	Handle(child *PID, cause interface{}) Directive
}

func DefaultSupervisionStrategy

func DefaultSupervisionStrategy() SupervisionStrategy

func NewOneForOneStrategy

func NewOneForOneStrategy(maxNrOfRetries int, withinTimeRangeMilliseconds int, decider Decider) SupervisionStrategy

type SystemMessage

type SystemMessage interface {
	// contains filtered or unexported methods
}

type UnboundedBatchingMailbox

type UnboundedBatchingMailbox struct {
	// contains filtered or unexported fields
}

func (*UnboundedBatchingMailbox) PostSystemMessage

func (mailbox *UnboundedBatchingMailbox) PostSystemMessage(message SystemMessage)

func (*UnboundedBatchingMailbox) PostUserMessage

func (mailbox *UnboundedBatchingMailbox) PostUserMessage(message interface{})

func (*UnboundedBatchingMailbox) RegisterHandlers

func (mailbox *UnboundedBatchingMailbox) RegisterHandlers(userInvoke func(interface{}), systemInvoke func(SystemMessage))

func (*UnboundedBatchingMailbox) Resume

func (mailbox *UnboundedBatchingMailbox) Resume()

func (*UnboundedBatchingMailbox) Suspend

func (mailbox *UnboundedBatchingMailbox) Suspend()

type UnboundedMailbox

type UnboundedMailbox struct {
	// contains filtered or unexported fields
}

func (*UnboundedMailbox) PostSystemMessage

func (mailbox *UnboundedMailbox) PostSystemMessage(message SystemMessage)

func (*UnboundedMailbox) PostUserMessage

func (mailbox *UnboundedMailbox) PostUserMessage(message interface{})

func (*UnboundedMailbox) RegisterHandlers

func (mailbox *UnboundedMailbox) RegisterHandlers(userInvoke func(interface{}), systemInvoke func(SystemMessage))

func (*UnboundedMailbox) Resume

func (mailbox *UnboundedMailbox) Resume()

func (*UnboundedMailbox) Suspend

func (mailbox *UnboundedMailbox) Suspend()

Jump to

Keyboard shortcuts

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