Version: v1.0.8 Latest Latest

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

Go to latest
Published: Nov 7, 2015 License: Apache-2.0 Imports: 1 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type Leased added in v1.0.5

type Leased struct {
	// contains filtered or unexported fields

leased uses a Leaser to control Start and Stop on a Plug

func NewLeased added in v1.0.5

func NewLeased(leaser Leaser) *Leased

NewLeased creates a Plug that starts when a lease is acquired and stops when it is lost.

func (*Leased) Run added in v1.0.5

func (l *Leased) Run()

Run tries to acquire and hold a lease, invoking Start() when the lease is held and invoking Stop() when the lease is lost.

func (*Leased) Stop added in v1.0.5

func (l *Leased) Stop()

Stop releases the acquired lease

type Leaser added in v1.0.5

type Leaser interface {
	// AcquireAndHold tries to acquire the lease and hold it until it expires, the lease is deleted,
	// or we observe another party take the lease. The notify channel will be sent a value
	// when the lease is held, and closed when the lease is lost.
	AcquireAndHold(chan struct{})

Leaser controls access to a lease

type Plug

type Plug interface {
	// Begins operation of the plug and unblocks WaitForStart().
	// May be invoked multiple times but only the first invocation has
	// an effect.
	// Ends operation of the plug and unblocks WaitForStop()
	// May be invoked multiple times but only the first invocation has
	// an effect. Calling Stop() before Start() is undefined.
	// Blocks until Start() is invoked
	// Blocks until Stop() is invoked
	// Returns true if Start() has been invoked
	IsStarted() bool

Plug represents a synchronization primitive that holds and releases execution for other objects.

func New added in v1.0.5

func New(started bool) Plug

New returns a new plug that can begin in the Started state.

Source Files

Jump to

Keyboard shortcuts

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