server

package
v0.0.0-...-f287a1d Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component func(stop <-chan struct{}) error

type Instance

type Instance interface {
	// Start this Server. Any components that were already added
	// will be run immediately. If any error is returned,
	// Start will terminate and return the error immediately.
	//
	// Once all startup components have been run, starts a polling
	// loop to continue monitoring for new components and returns nil.
	Start(stop <-chan struct{}) error

	// RunComponent adds the given component to the server's run queue.
	RunComponent(name string, t Component)

	// RunComponentAsync runs the given component asynchronously.
	RunComponentAsync(name string, t Component)

	// RunComponentAsyncAndWait runs the given component asynchronously. When
	// the server Instance is shutting down, it will wait for the component
	// to complete before exiting.
	// Note: this is best effort; a process can die at any time.
	RunComponentAsyncAndWait(name string, t Component)

	// Wait for this server Instance to shutdown.
	Wait()
}

Instance is a server that is composed a number of Component tasks.

func New

func New() Instance

New creates a new server Instance.

Jump to

Keyboard shortcuts

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