actor

package
v0.0.0-...-61c5fd2 Latest Latest
Warning

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

Go to latest
Published: May 29, 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
Foo

Index

Constants

This section is empty.

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 NewActorCell

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

func RequestResponsePID

func RequestResponsePID() (*PID, *Response)

Types

type Actor

type Actor interface {
	Receive(message Context)
}

type ActorProducer

type ActorProducer func() Actor

type ActorRef

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

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()
}

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 Foo

type Foo struct {
}

func (*Foo) Descriptor

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

func (*Foo) Marshal

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

func (*Foo) MarshalTo

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

func (*Foo) ProtoMessage

func (*Foo) ProtoMessage()

func (*Foo) Reset

func (m *Foo) Reset()

func (*Foo) Size

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

func (*Foo) String

func (m *Foo) String() string

func (*Foo) Unmarshal

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

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 NewBoundedMailbox

func NewBoundedMailbox(throughput int, size 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 NewLocalPID

func NewLocalPID(id string) *PID

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) SendSystemMessage

func (ref *RouterActorRef) SendSystemMessage(message SystemMessage)

func (*RouterActorRef) Stop

func (ref *RouterActorRef) Stop()

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
}

Jump to

Keyboard shortcuts

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