op

package
v5.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2017 License: Apache-2.0 Imports: 3 Imported by: 518

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sig

func Sig(s Signaler, err error)

Sig will send the Completed or Failed event to s depending on err being set if s is not nil.

func SigAll

func SigAll(signalers []Signaler, err error)

SigAll send the Completed or Failed event to all given signalers depending on err being set.

func SigCompleted

func SigCompleted(s Signaler)

SigCompleted sends the Completed event to s if s is not nil.

func SigFailed

func SigFailed(s Signaler, err error)

SigFailed sends the Failed event to s if s is not nil.

Types

type Canceler

type Canceler struct {
	// contains filtered or unexported fields
}

func NewCanceler

func NewCanceler() *Canceler

func (*Canceler) Cancel

func (c *Canceler) Cancel()

func (*Canceler) Done

func (c *Canceler) Done() <-chan struct{}

type SignalCallback

type SignalCallback func(SignalResponse)

SignalCallback converts a function accepting SignalResponse into a Signaler.

func (SignalCallback) Canceled

func (f SignalCallback) Canceled()

func (SignalCallback) Completed

func (f SignalCallback) Completed()

func (SignalCallback) Failed

func (f SignalCallback) Failed()

type SignalChannel

type SignalChannel struct {
	C chan SignalResponse
}

func NewSignalChannel

func NewSignalChannel() *SignalChannel

func (*SignalChannel) Canceled

func (s *SignalChannel) Canceled()

func (*SignalChannel) Completed

func (s *SignalChannel) Completed()

func (*SignalChannel) Failed

func (s *SignalChannel) Failed()

func (*SignalChannel) Wait

func (s *SignalChannel) Wait() SignalResponse

type SignalResponse

type SignalResponse uint8
const (
	SignalCompleted SignalResponse = iota + 1
	SignalFailed
	SignalCanceled
)

func (SignalResponse) Apply

func (code SignalResponse) Apply(s Signaler)

type Signaler

type Signaler interface {
	Completed()
	Failed()
	Canceled()
}

func CancelableSignaler

func CancelableSignaler(c *Canceler, s Signaler) Signaler

func CombineSignalers

func CombineSignalers(signalers ...Signaler) Signaler

NewCompositeSignaler creates a new composite signaler.

func SplitSignaler

func SplitSignaler(s Signaler, count int) Signaler

NewSplitSignaler creates a new splitSignal if s is not nil. If s is nil, nil will be returned. The count is the number of events to be received before publishing the final event to the guarded Signaler.

Jump to

Keyboard shortcuts

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