actor

package
v0.0.0-...-9eea049 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2018 License: Apache-2.0 Imports: 4 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Actor

type Actor struct {
	*Mailbox

	Server
	// contains filtered or unexported fields
}

type BasicServerInner

type BasicServerInner struct {
	Logger log.Logger
}

func NewBasicServerInner

func NewBasicServerInner(logger log.Logger) *BasicServerInner

func (*BasicServerInner) HandleBeat

func (inner *BasicServerInner) HandleBeat() (bool, error)

func (*BasicServerInner) HandleMsg

func (inner *BasicServerInner) HandleMsg(msg Msg) (terminate bool, err error)

func (*BasicServerInner) HandleShutdown

func (inner *BasicServerInner) HandleShutdown(err error) bool

func (*BasicServerInner) Init

func (inner *BasicServerInner) Init(*Actor) (bool, error)

type BasicServerOuter

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

func NewBasicServerOuter

func NewBasicServerOuter(mailbox *Mailbox) *BasicServerOuter

func (*BasicServerOuter) EnqueueFuncAsync

func (outer *BasicServerOuter) EnqueueFuncAsync(fun func() (bool, error)) bool

func (*BasicServerOuter) ShutdownSync

func (outer *BasicServerOuter) ShutdownSync()

type EnqueueFuncActor

type EnqueueFuncActor interface {
	EnqueueFuncAsync(func() (bool, error)) bool
}

type EnqueueMsgActor

type EnqueueMsgActor interface {
	EnqueueMsg(Msg) bool
	TerminatedChan() <-chan struct{}
}

type Mailbox

type Mailbox struct {
	Terminated <-chan struct{}
	// contains filtered or unexported fields
}

func Spawn

func Spawn(server Server) (*Mailbox, error)

func (*Mailbox) EnqueueMsg

func (mailbox *Mailbox) EnqueueMsg(msg Msg) bool

func (*Mailbox) TerminatedChan

func (mailbox *Mailbox) TerminatedChan() <-chan struct{}

type Msg

type Msg interface{}

type MsgExec

type MsgExec interface {
	Exec() (bool, error)
}

type MsgExecFunc

type MsgExecFunc func() (bool, error)

func (MsgExecFunc) Exec

func (mef MsgExecFunc) Exec() (bool, error)

type MsgShutdown

type MsgShutdown struct{}

func (MsgShutdown) Error

func (shutdown MsgShutdown) Error() string

type MsgSync

type MsgSync interface {
	InitMsg(actor EnqueueMsgActor)
	Close() bool
	Wait() bool
}

type MsgSyncQuery

type MsgSyncQuery struct {
	WaitChan       chan struct{}
	TerminatedChan <-chan struct{}
}

func (*MsgSyncQuery) Close

func (msq *MsgSyncQuery) Close() bool

func (*MsgSyncQuery) InitMsg

func (msq *MsgSyncQuery) InitMsg(actor EnqueueMsgActor)

func (*MsgSyncQuery) MustClose

func (msq *MsgSyncQuery) MustClose()

func (*MsgSyncQuery) Wait

func (msq *MsgSyncQuery) Wait() bool

Returns true iff Close() is called on MsgSyncQuery (i.e MsgSyncQuery.WaitChan is closed). Blocks until either MsgSyncQuery.WaitChan is closed, or MsgSyncQuery.TerminatedChan is closed.

type Server

type Server interface {
	Init(*Actor) (bool, error)
	HandleBeat() (bool, error)
	HandleMsg(Msg) (bool, error)
	HandleShutdown(error) bool
}

type Shutdownable

type Shutdownable interface {
	ShutdownSync()
}

type ShutdownableActor

type ShutdownableActor interface {
	ShutdownSync()
}

Jump to

Keyboard shortcuts

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