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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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