broadcast

package module
v0.0.0-...-e7365c5 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 6 Imported by: 0

README

broadcast

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcast

type Broadcast[T any] struct {
	// contains filtered or unexported fields
}

A Broadcast is used to run given number of workers to process jobs.

func NewBroadcast

func NewBroadcast[T any](job func(ctx context.Context, data T) error, workers int) *Broadcast[T]

NewBroadcast returns a Broadcast with given job and workers.

func (*Broadcast[T]) Send

func (b *Broadcast[T]) Send(data T)

func (*Broadcast[T]) Start

func (b *Broadcast[T]) Start() error

Start starts a Broadcast.

func (*Broadcast[T]) Stop

func (b *Broadcast[T]) Stop() error

type PerpetualMotion

type PerpetualMotion struct {
	Debug bool
	// contains filtered or unexported fields
}

A PerpetualMotion is used to run given number of workers to process jobs.

func NewPerpetualMotion

func NewPerpetualMotion(job func(ctx context.Context) (time.Duration, error), workers int) PerpetualMotion

NewPerpetualMotion returns a NewPerpetualMotion with given job and workers.

func (*PerpetualMotion) Start

func (m *PerpetualMotion) Start() error

Start starts a WorkerGroup.

func (*PerpetualMotion) Stop

func (m *PerpetualMotion) Stop() error

type Watch

type Watch[T any] struct {
	// contains filtered or unexported fields
}

A Watch is used to run given number of workers to process jobs.

func NewWatch

func NewWatch[T any](job func(ctx context.Context, data T) error, workers int) *Watch[T]

NewWatch returns a Watch with given job and workers.

func (*Watch[T]) Send

func (b *Watch[T]) Send(data T)

func (*Watch[T]) Start

func (b *Watch[T]) Start() error

Start starts a Broadcast.

func (*Watch[T]) Stop

func (b *Watch[T]) Stop() error

Jump to

Keyboard shortcuts

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