singular

package
v0.0.0-...-be26699 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2015 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PingInterval = 10 * time.Second

Functions

func New

func New(underlying worker.Runner, conn Conn) (worker.Runner, error)

New returns a Runner that can be used to start workers that will only run a single instance. The conn value is used to determine whether to run the workers or not.

If conn.IsMaster returns true, any workers started will be started on the underlying runner.

If conn.IsMaster returns false, any workers started will actually start do-nothing placeholder workers on the underlying runner that continually ping the connection until a ping fails and then exit with that error.

Types

type Conn

type Conn interface {
	// IsMaster reports whether this connection is currently held by
	// the (singular) master of the resource.
	IsMaster() (bool, error)

	// Ping probes the resource and returns an error if the the
	// connection has failed. If the master changes, this method
	// must return an error.
	Ping() error
}

Conn represents a connection to some resource.

Jump to

Keyboard shortcuts

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