sessionworker

package
v1.64.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DoFunc

type DoFunc func(ctx context.Context, h *Handle)

type Handle

type Handle struct {
	Key
	// contains filtered or unexported fields
}

func Get

func Get(session *bbgo.ExchangeSession, id string) *Handle

Get finds and returns the worker instance from the pool

func Start

func Start(ctx context.Context, session *bbgo.ExchangeSession, id string, w Worker) *Handle

Start starts a worker with the given exchange session, Please note the worker function will be executed immediately.

func (*Handle) Session

func (w *Handle) Session() *bbgo.ExchangeSession

func (*Handle) SetValue

func (w *Handle) SetValue(v any)

func (*Handle) Start

func (w *Handle) Start(ctx context.Context)

func (*Handle) Value

func (w *Handle) Value() any

type Key

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

type Pool

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

func (*Pool) Add

func (p *Pool) Add(session *bbgo.ExchangeSession, id string, w Worker) *Handle

func (*Pool) Get

func (p *Pool) Get(session *bbgo.ExchangeSession, id string) *Handle

func (*Pool) Start

func (p *Pool) Start(ctx context.Context)

type Worker

type Worker interface {
	Run(ctx context.Context, h *Handle)
}

Jump to

Keyboard shortcuts

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