edgerunner

package module
v2.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 7 Imported by: 0

README

SMARTY DISCLAIMER: Subject to the terms of the associated license agreement, this software is freely available for your use. This software is FREE, AS IN PUPPIES, and is a gift. Enjoy your new responsibility. This means that while we may consider enhancement requests, we may or may not choose to entertain requests at our sole and absolute discretion.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Options singleton

Functions

This section is empty.

Types

type ListenCloser

type ListenCloser interface {
	// Listen starts a long-lived component.
	// It is the caller's responsibility to call Listen on the Runner.
	// It is the Runner's responsibility to call Listen on Task values
	// provided via the TaskFactory.
	Listen()

	// Closer should cause the Listen method to terminate.
	// The Runner waits until Listen has finished.
	io.Closer
}

type Runner

type Runner interface {
	ListenCloser

	// Reload sends a signal to the Runner to invoke the supplied
	// TaskFactory to build a new Task instance. If the new Task
	// initializes without error and indicates its readiness via
	// the supplied `chan<- bool` (see the TaskFactory) the runner
	// will call Close on the previously running Task (if any).
	// Both the old and new Task values will be running simultaneously
	// for a short time (by design).
	Reload()
}

func New

func New(options ...option) Runner

type Task

type Task interface {
	// Initialize provides an opportunity for the task to load its
	// configuration, incorporating the supplied context.Context for
	// operations that support it. This step should only prepare to
	// perform the work but should not perform any significant work
	// which might block termination signals from being handled.
	Initialize(ctx context.Context) error
	ListenCloser
}

Task describes a type supplied by the caller, via the TaskFactory. Generally a task is a long-lived component (like an HTTP server).

type TaskFactory

type TaskFactory func(id int, ready func(bool)) Task

TaskFactory is a callback for building whatever task will be managed by the Runner. The supplied task should call the ready func to indicate its readiness to begin working. Only the first call has any effect.

Jump to

Keyboard shortcuts

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