worker

package
v0.0.0-...-d62e3dc Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(impl sdefine.IWorkerImplement, optionFuncs ...OptionFunc) sdefine.IWorker

Types

type OptionFunc

type OptionFunc func(option *option)

func WithDecider

func WithDecider(decider sadefine.DeciderFunc) OptionFunc

func WithMailBoxSize

func WithMailBoxSize(mailBoxSize int) OptionFunc

func WithStartedWaitGroup

func WithStartedWaitGroup(startedWg *sync.WaitGroup) OptionFunc

func WithStoppedWaitGroup

func WithStoppedWaitGroup(stoppedWg *sync.WaitGroup) OptionFunc

type Super

type Super struct {
	sdefine.IWorker
}

func (*Super) AfterTriggerTimer

func (s *Super) AfterTriggerTimer(err error, id satimer.ID, tag satimer.Tag, ctx sadefine.Context)

func (*Super) BeforeTriggerTimer

func (s *Super) BeforeTriggerTimer(id satimer.ID, tag satimer.Tag, ctx sadefine.Context) (ok bool, err error)

func (*Super) Create

func (s *Super) Create(impl sdefine.IWorkerImplement, optionFuncs ...OptionFunc)

func (*Super) Destroy

func (s *Super) Destroy()

Destroy 子类要么不覆盖,要么确保调用到父类的Destroy,否则会循环引用导致内存泄露

func (*Super) OnActorTerminated

func (s *Super) OnActorTerminated(who *sadefine.PID, ctx sadefine.Context)

func (*Super) OnReceiveMessage

func (s *Super) OnReceiveMessage(ctx sadefine.Context)

func (*Super) OnRestarted

func (s *Super) OnRestarted(ctx sadefine.Context)

func (*Super) OnRestarting

func (s *Super) OnRestarting(ctx sadefine.Context)

func (*Super) OnStarted

func (s *Super) OnStarted(ctx sadefine.Context)

func (*Super) OnStopped

func (s *Super) OnStopped(ctx sadefine.Context)

func (*Super) OnStopping

func (s *Super) OnStopping(ctx sadefine.Context)

type Worker

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

func (*Worker) Dispatch

func (w *Worker) Dispatch(timeout time.Duration, work sawork.IDispatchWork) error

func (*Worker) HasStart

func (w *Worker) HasStart() bool

func (*Worker) HasStop

func (w *Worker) HasStop() bool

func (*Worker) NewLoopTimer

func (w *Worker) NewLoopTimer(dur time.Duration, tag satimer.ID, cb satimer.Callback) satimer.ID

func (*Worker) NewTimer

func (w *Worker) NewTimer(dur time.Duration, tag satimer.Tag, cb satimer.Callback) satimer.ID

func (*Worker) PID

func (w *Worker) PID() *sadefine.PID

func (*Worker) ParentPID

func (w *Worker) ParentPID() *sadefine.PID

func (*Worker) Post

func (w *Worker) Post(work sawork.IPostWork) error

func (*Worker) Receive

func (w *Worker) Receive(ctx sadefine.Context)

func (*Worker) SetSign

func (w *Worker) SetSign(sign string)

func (*Worker) Sign

func (w *Worker) Sign() string

func (*Worker) Start

func (w *Worker) Start(ctx sadefine.Context, name string, startFunc func() error, wait bool) (err error)

func (*Worker) Started

func (w *Worker) Started() bool

func (*Worker) Stop

func (w *Worker) Stop(stopFunc func(), wait bool) error

func (*Worker) StopTimer

func (w *Worker) StopTimer(id satimer.ID) error

Jump to

Keyboard shortcuts

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