core

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Broadcaster

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

func NewBroadcaster

func NewBroadcaster[T any](name string) *Broadcaster[T]

func (*Broadcaster[T]) Broadcast

func (b *Broadcaster[T]) Broadcast(msg T)

func (*Broadcaster[T]) Subscribe

func (b *Broadcaster[T]) Subscribe() chan T

func (*Broadcaster[T]) Unsubscribe

func (b *Broadcaster[T]) Unsubscribe(ch chan T)

type Listener

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

func NewListener

func NewListener[T any](broadcaster *Broadcaster[T]) (*Listener[T], error)

func (*Listener[T]) Listen

func (l *Listener[T]) Listen(ctx context.Context, ready chan struct{}, notifyFunction func(data T))

func (*Listener[T]) Notify

func (l *Listener[T]) Notify(data T)

func (*Listener[T]) WaitForNotificationsProcessed

func (l *Listener[T]) WaitForNotificationsProcessed()

type Retryer

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

func NewRetryer

func NewRetryer(function func() error, options *model.OnError) (*Retryer, error)

func (*Retryer) Retry

func (r *Retryer) Retry() (err error)

type Runner

type Runner struct {
	Options    *model.Options
	Task       interface{}
	Parameters model.Parameters
	// Result channel to return results
	ResultsChannel chan []interface{}
	ErrorChannel   chan error
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(options *model.Options, task interface{}, parameters ...interface{}) (*Runner, error)

func NewRunnerFromJob

func NewRunnerFromJob(task *model.Task, job *model.Job) (*Runner, error)

func (*Runner) Cancel

func (r *Runner) Cancel(onCancel ...func())

func (*Runner) Run

func (r *Runner) Run(ctx context.Context)

Run executes the task with the provided parameters. It will return results on ResultsChannel and errors on ErrorChannel. If the task panics, it will send the panic value to ErrorChannel. The main intended use of this function is to run the task in a separate goroutine

type Scheduler

type Scheduler struct {
	Task       interface{}
	Parameters model.Parameters
	StartTime  *time.Time
}

func NewScheduler

func NewScheduler(startTime *time.Time, task interface{}, parameters ...interface{}) (*Scheduler, error)

func (*Scheduler) Go

func (s *Scheduler) Go(ctx context.Context)

type Ticker

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

Ticker represents a recurring task runner.

func NewTicker

func NewTicker(interval time.Duration, task interface{}, parameters ...interface{}) (*Ticker, error)

NewTicker creates and returns a new Ticker instance.

func (*Ticker) Go

func (t *Ticker) Go(ctx context.Context)

Go starts the Ticker. It runs the task at the specified interval until the provided context is cancelled.

Jump to

Keyboard shortcuts

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