startstop

package module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: BSD-3-Clause Imports: 5 Imported by: 0

README

startstop Build Status

Documentation: https://godoc.org/github.com/facebookgo/startstop

Modified from the original to continue Stop() even if an object in the graph returns an error from Stop() or Close()

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(ctx context.Context, objects []*inject.Object, log Logger) error

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

func Stop

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

Stop stops the graph, in the right order. Stop will call Stop if an object satisfies the associated interface. Unlike Start(), logs and continues if a Stop call returns an error.

Types

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 Starter

type Starter interface {
	Start(context.Context) error
}

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

type Stopper

type Stopper interface {
	Stop(context.Context) 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