cmdutil

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server interface {
	Run() error
	Stop(error)
}

A Server can be run synchronously and return an error.

Servers are typically used with oklog/run.Group.

func MultiServer

func MultiServer(srvs ...Server) Server

MultiServer returns a new kit.Server which will run all of the provided servers until one of them fails or the server is stopped.

func NewContextServer

func NewContextServer(fn func(context.Context) error) Server

NewContextServer returns a Server that runs the given function with a context that is canceled when the Server is stopped.

type ServerFunc

type ServerFunc func() error

ServerFunc is a function which implements the Server interface.

func (ServerFunc) Run

func (fn ServerFunc) Run() error

Run calls fn and returns any errors.

It implements the Server interface.

func (ServerFunc) Stop

func (fn ServerFunc) Stop(error)

Stop is a noop for gradual compatibility with oklog run.Group.

It implements the Server interface.

type ServerFuncs

type ServerFuncs struct {
	RunFunc  func() error
	StopFunc func(error)
}

ServerFuncs implements the Server interface with provided functions.

func (ServerFuncs) Run

func (sf ServerFuncs) Run() error

Run calls RunFunc and returns any errors.

It implements the Server interface.

func (ServerFuncs) Stop

func (sf ServerFuncs) Stop(err error)

Stop calls StopFunc, if it's non-nil.

It implements the Server interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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