task

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: Apache-2.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 GoroutineRunner

type GoroutineRunner struct {
}

GoroutineRunner is an implementation of Runner that uses goroutines.

func NewGoroutineRunner

func NewGoroutineRunner() *GoroutineRunner

NewGoroutineRunner creates a new GoroutineRunner instance.

func (*GoroutineRunner) RunTask

func (*GoroutineRunner) RunTask(ctx context.Context, runnable Runnable) error

type Runnable

type Runnable func(context.Context) error

Runnable defines a task that can be ran.

type Runner

type Runner interface {
	// RunTask runs a given task.
	RunTask(ctx context.Context, runnable Runnable) error
}

Runner defines a means of running tasks. This is intended to run tasks with a finite lifetime. For any tasks that should run for the duration of an application, consider using a conventional goroutine.

type SynchronousRunner

type SynchronousRunner struct {
}

SynchronousRunner is a synchronous implementation of Runner, executing the tasks as blocking units of work.

func NewSynchronousRunner

func NewSynchronousRunner() *SynchronousRunner

NewSynchronousRunner creates a new instance of SynchronousRunner.

func (*SynchronousRunner) RunTask

func (*SynchronousRunner) RunTask(ctx context.Context, runnable Runnable) error

Jump to

Keyboard shortcuts

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