task_runner

package
v0.20.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Factory

func Factory(_ context.Context, config cfg.Config, _ log.Logger) (map[string]kernel.ModuleFactory, error)

func New

func New(ctx context.Context, _ cfg.Config, _ log.Logger) (kernel.Module, error)

func RunTask

func RunTask(ctx context.Context, task kernel.Module) error

RunTask gets the TaskRunner from the context and uses it to run the given task.

Types

type Settings

type Settings struct {
	Enabled bool `cfg:"enabled" default:"false"`
}

type TaskRunner

type TaskRunner interface {
	kernel.Module
	RunTask(task kernel.Module) error
}

A TaskRunner allows you to execute tasks instead of adding modules to the kernel. In general, you should give your modules a proper name and place in the kernel. This module provides an escape hatch if you need to add something to the kernel from outside gosoline (and don't want to add additional code to every service using your code).

Try to avoid using this module if possible. It is only meant as a last resort.

Enable it by setting task_runner.enabled = true

func Provide

func Provide(ctx context.Context) (TaskRunner, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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