Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Leased ¶ added in v1.0.5
type Leased struct { Plug // contains filtered or unexported fields }
leased uses a Leaser to control Start and Stop on a Plug
func NewLeased ¶ added in v1.0.5
NewLeased creates a Plug that starts when a lease is acquired and stops when it is lost.
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 nil value // when the lease is held, and closed when the lease is lost. If an error is sent the lease // is also considered lost. AcquireAndHold(chan error) Release() }
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. Start() // 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. An error // may be returned with the stop. Stop(err error) // Blocks until Start() is invoked WaitForStart() // Blocks until Stop() is invoked WaitForStop() error // Returns true if Start() has been invoked IsStarted() bool }
Plug represents a synchronization primitive that holds and releases execution for other objects.
Click to show internal directories.
Click to hide internal directories.