actor

package
v0.0.0-...-bac99df Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAlreadyStop = errors.New("already stop")
View Source
var RootContext = actor.EmptyRootContext

Functions

func Close

func Close()

func DefaultDecider

func DefaultDecider(reason interface{}) actor.Directive

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func Init

func Init(logLevel alog.Level, logger mlog.ILogger)

func IsPIDPtrEmpty

func IsPIDPtrEmpty(pid *actor.PID) bool

func IsPIDValueEmpty

func IsPIDValueEmpty(pid actor.PID) bool

func Logger

func Logger() log.ILogger

Types

type ISuper

type ISuper interface {
	actor.Actor

	PID() *actor.PID
	ParentPID() *actor.PID

	Sign() string
	SetSign(sign string)

	Logger() mlog.ILogger
	SetLogger(logger mlog.ILogger)

	Start(ctx actor.Context, name string) error
	StartWithPrefix(ctx actor.Context, prefix string) error
	WaitForStarted()
	IsStop() bool
	Stop() error
	WaitForStopped()
	StopAndWait() error
	Poison() error
	PoisonAndWait() error

	NewTimer(dur time.Duration, cb TimerCallback) TimerID
	NewTimerWithTag(dur time.Duration, tag TimerID, cb TimerCallback) TimerID
	NewLoopTimer(interval time.Duration, cb TimerCallback) TimerID
	NewLoopTimerWithTag(dur time.Duration, tag TimerID, cb TimerCallback) TimerID
	StopTimer(id TimerID) error

	Debug(format string, args ...interface{})
	Info(format string, args ...interface{})
	Warn(format string, args ...interface{})
	Error(format string, args ...interface{})
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func NewSuper

func NewSuper(options ...OptionFunc) ISuper

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

type OptionFunc

type OptionFunc func(option *option)

func WithDecider

func WithDecider(decider actor.DeciderFunc) OptionFunc

func WithLogger

func WithLogger(logger mlog.ILogger) OptionFunc

func WithMailBoxSize

func WithMailBoxSize(mailBoxSize int) OptionFunc

func WithOnActorTerminateHandler

func WithOnActorTerminateHandler(vf VFOnActorTerminated) OptionFunc

func WithOnReceiveMessageHandler

func WithOnReceiveMessageHandler(vf VFOnReceiveMessage) OptionFunc

func WithOnRestartedHandler

func WithOnRestartedHandler(vf VFOnRestarted) OptionFunc

func WithOnRestartingHandler

func WithOnRestartingHandler(vf VFOnRestarting) OptionFunc

func WithOnStartedHandler

func WithOnStartedHandler(vf VFOnStarted) OptionFunc

func WithOnStoppedHandler

func WithOnStoppedHandler(vf VFOnStopped) OptionFunc

func WithOnStoppingHandler

func WithOnStoppingHandler(vf VFOnStopping) OptionFunc

func WithOnTimeoutHandler

func WithOnTimeoutHandler(vf VFOnTimeout) OptionFunc

func WithStartedWaitGroup

func WithStartedWaitGroup(startedWg *sync.WaitGroup) OptionFunc

func WithStoppedWaitGroup

func WithStoppedWaitGroup(stoppedWg *sync.WaitGroup) OptionFunc

type Super

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

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func (*Super) Debug

func (s *Super) Debug(format string, args ...interface{})

func (*Super) Error

func (s *Super) Error(format string, args ...interface{})

func (*Super) Info

func (s *Super) Info(format string, args ...interface{})

func (Super) IsStop

func (s Super) IsStop() bool

func (Super) Logger

func (s Super) Logger() mlog.ILogger

func (*Super) NewLoopTimer

func (s *Super) NewLoopTimer(interval time.Duration, cb TimerCallback) TimerID

func (*Super) NewLoopTimerWithTag

func (s *Super) NewLoopTimerWithTag(dur time.Duration, tag TimerID, cb TimerCallback) TimerID

func (*Super) NewTimer

func (s *Super) NewTimer(dur time.Duration, cb TimerCallback) TimerID

func (*Super) NewTimerWithTag

func (s *Super) NewTimerWithTag(dur time.Duration, tag TimerID, cb TimerCallback) TimerID

func (Super) PID

func (s Super) PID() *actor.PID

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func (Super) ParentPID

func (s Super) ParentPID() *actor.PID

func (*Super) Poison

func (s *Super) Poison() error

func (*Super) PoisonAndWait

func (s *Super) PoisonAndWait() error

func (*Super) Receive

func (s *Super) Receive(ctx actor.Context)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

func (*Super) SetLogger

func (s *Super) SetLogger(logger mlog.ILogger)

func (*Super) SetSign

func (s *Super) SetSign(sign string)

func (Super) Sign

func (s Super) Sign() string

func (*Super) Start

func (s *Super) Start(ctx actor.Context, name string) (err error)

func (*Super) StartWithPrefix

func (s *Super) StartWithPrefix(ctx actor.Context, prefix string) (err error)

func (*Super) Stop

func (s *Super) Stop() error

func (*Super) StopAndWait

func (s *Super) StopAndWait() error

func (*Super) StopTimer

func (s *Super) StopTimer(id TimerID) error

func (*Super) WaitForStarted

func (s *Super) WaitForStarted()

func (*Super) WaitForStopped

func (s *Super) WaitForStopped()

func (*Super) Warn

func (s *Super) Warn(format string, args ...interface{})

type Timeout

type Timeout struct {
	ID  TimerID
	Tag TimerID
}

type TimerCallback

type TimerCallback func(id TimerID, tag TimerID)

type TimerID

type TimerID = uint64

func GenerateTimerTag

func GenerateTimerTag() TimerID

type TimerManager

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

func NewTimerManager

func NewTimerManager(pid *actor.PID) *TimerManager

func (*TimerManager) NewLoopTimer

func (m *TimerManager) NewLoopTimer(dur time.Duration, callback TimerCallback) TimerID

func (*TimerManager) NewLoopTimerWithTag

func (m *TimerManager) NewLoopTimerWithTag(dur time.Duration, tag TimerID, callback TimerCallback) TimerID

func (*TimerManager) NewTimer

func (m *TimerManager) NewTimer(dur time.Duration, callback TimerCallback) TimerID

func (*TimerManager) NewTimerWithTag

func (m *TimerManager) NewTimerWithTag(dur time.Duration, tag TimerID, callback TimerCallback) TimerID

func (*TimerManager) Stop

func (m *TimerManager) Stop(id TimerID) error

func (*TimerManager) StopAll

func (m *TimerManager) StopAll()

func (*TimerManager) Trigger

func (m *TimerManager) Trigger(id TimerID) error

type VFOnActorTerminated

type VFOnActorTerminated func(who *actor.PID, ctx actor.Context)

type VFOnReceiveMessage

type VFOnReceiveMessage func(ctx actor.Context)

type VFOnRestarted

type VFOnRestarted func(ctx actor.Context)

type VFOnRestarting

type VFOnRestarting func(ctx actor.Context)

type VFOnStarted

type VFOnStarted func(ctx actor.Context)

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

type VFOnStopped

type VFOnStopped func(ctx actor.Context)

type VFOnStopping

type VFOnStopping func(ctx actor.Context)

type VFOnTimeout

type VFOnTimeout func(ctx actor.Context, id TimerID, tag TimerID)

Jump to

Keyboard shortcuts

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