startstop

package module
v0.0.0-...-bc15841 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2016 License: BSD-3-Clause Imports: 4 Imported by: 10

README

Documentation

Overview

Package startstop provides automatic Start/Stop for inject eliminating the necessity for manual ordering.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Start

func Start(objects []*inject.Object, log Logger) error

Start the graph, in the right order. Start will call Start or Open if an object satisfies the associated interface.

func Stop

func Stop(objects []*inject.Object, log Logger) error

Stop the graph, in the right order. Stop will call Stop or Close if an object satisfies the associated interface.

func TryStart

func TryStart(objects []*inject.Object, log Logger) ([]*inject.Object, error)

TryStart will start the graph, in the right order. It will call Start or Open. It returns the list of objects that have been successfully started. This can be used to stop only the dependencies that have been correctly started.

Types

type Closer

type Closer interface {
	Close() error
}

Closer defines the Close method, objects satisfying this interface will be closed by Stop.

type Logger

type Logger interface {
	Debugf(f string, args ...interface{})
	Errorf(f string, args ...interface{})
}

Logger is used by Start/Stop to provide debug and error logging.

type Opener

type Opener interface {
	Open() error
}

Opener defines the Open method, objects satisfying this interface will be opened by Start.

type Starter

type Starter interface {
	Start() error
}

Starter defines the Start method, objects satisfying this interface will be started by Start.

type Stopper

type Stopper interface {
	Stop() error
}

Stopper defines the Stop method, objects satisfying this interface will be stopped by Stop.

Jump to

Keyboard shortcuts

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