Documentation ¶
Overview ¶
The `server` package implements a generic server, which runs multiple tasks until any single task is completed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event interface { Context() context.Context // Returns the context of the emitted event from the source Key() any // Returns the key (or "type") of the event. Returns nil if an error event Value() any // Returns the value of the event. Returns an error if an error event Error() error // Returns the error or nil if not an error event // Emit an event on a channel. If the channel is buffered, returns false if the // event could not be sent (buffered channel is full). Blocks if an unbuferred channel. // Returns false if an error occured. Emit(chan<- Event) bool }
Event encapsulates a transmitted message with key, value pair. It can also encapsulate an error.
type EventSource ¶ added in v1.0.48
EventSource is the interface for subscribing and unsubscribing from events
type Plugin ¶
type Plugin interface { // Return the name of the task. This should be unique amongst all registered plugins Name() string // Return the label for the task. This should be unique amongst all plugins with the same name Label() string // Create a new task with provider of other tasks New(context.Context, Provider) (Task, error) }
Plugin creates a task from a configuration
type Provider ¶
type Provider interface { Task plugin.Log // Create a new task from a plugin and return it. This should only // be called during the initialisation phase of the provider, not once // the provider is running. New(context.Context, Plugin) (Task, error) // Return the task labels. Ideally these should be in the order they are created, to // satisfy any dependencies. Keys() []string // Return a task with name and label. Two arguments are required if the first argument is // the task name and the second is the task label. Returns nil if there isn't exactly one // task to return. Get(...string) Task }
Provider runs many tasks simultaneously. It subscribes to events from the tasks and emits them on its own event channel.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
nginx
* nginx - A client to restart, reload and test nginx
|
* nginx - A client to restart, reload and test nginx |
server
* go-server - A server for running tasks
|
* go-server - A server for running tasks |
npm
|
|
pkg
|
|
client
client impleemts a generic REST API client which can be used for creating gateway-specific clients
|
client impleemts a generic REST API client which can be used for creating gateway-specific clients |
client/html
html implements a generic API client which parses HTML and XML files.
|
html implements a generic API client which parses HTML and XML files. |
client/ipify
ipify implements a generic API client which parses a JSON response.
|
ipify implements a generic API client which parses a JSON response. |
config/json
The `json` package provides a decoder for JSON configuration files.
|
The `json` package provides a decoder for JSON configuration files. |
context
The `context` package provides functions to embed parameters within a context object, and also functions to create contexts.
|
The `context` package provides functions to embed parameters within a context object, and also functions to create contexts. |
dnsregister
The `dnsregister` task implements a server which can register DNS entries
|
The `dnsregister` task implements a server which can register DNS entries |
event
The event package implements events, an event source and an event receiver.
|
The event package implements events, an event source and an event receiver. |
expr
The `expr` package implements a generic expression parser and evaluator, and interpolation for strings.
|
The `expr` package implements a generic expression parser and evaluator, and interpolation for strings. |
httpserver
The `httpserver` task implements a server which can serve requests over HTTP, HTTPS and FCGI
|
The `httpserver` task implements a server which can serve requests over HTTP, HTTPS and FCGI |
httpserver/fcgi
Package fcgi implements the FastCGI protocol.
|
Package fcgi implements the FastCGI protocol. |
httpserver/router
router package implements a http.Handler and the ability to register routes on a gateway
|
router package implements a http.Handler and the ability to register routes on a gateway |
httpserver/static
static package implements a http.Handler for serving static files
|
static package implements a http.Handler for serving static files |
httpserver/tokenauth
tokenauth package implements authentication tokens for HTTP servers
|
tokenauth package implements authentication tokens for HTTP servers |
httpserver/util
The `util` package provides utility methods for decoding request parameters and bodies, and providing responses over HTTP
|
The `util` package provides utility methods for decoding request parameters and bodies, and providing responses over HTTP |
log
Package `log` implements a simple logger that can be used to log messages
|
Package `log` implements a simple logger that can be used to log messages |
mdns
Package `mdns` implements a multicast DNS client and server to be used to discover and register services over local networks
|
Package `mdns` implements a multicast DNS client and server to be used to discover and register services over local networks |
nginx
The `nginx` task spawns an nginx server, and can test and reload the nginx configuration.
|
The `nginx` task spawns an nginx server, and can test and reload the nginx configuration. |
nginx/client
nginx.client package is the REST API client for the nginx gateway.
|
nginx.client package is the REST API client for the nginx gateway. |
task
package `task` implements a generic task runner, which can be a source of events
|
package `task` implements a generic task runner, which can be a source of events |
types
The `types` package implements variable types which can be used in configurations.
|
The `types` package implements variable types which can be used in configurations. |
Click to show internal directories.
Click to hide internal directories.