pat

package
v0.0.0-...-5012a73 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const CAP = 10

CAP is the capacity of the buffered proxy channel

View Source
const PatSCAP = 10

PatSCAP is the capacity of the buffered proxy channel

View Source
const PatSQUE = 16

PatSQUE is the allocated size of the circular queue

View Source
const QUE = 16

QUE is the allocated size of the circular queue

Variables

This section is empty.

Functions

func Chan

func Chan(inp ...struct{}) (out <-chan struct{})

Chan returns a channel to receive all inputs before close.

func ChanFuncErr

func ChanFuncErr(act func() (struct{}, error)) (out <-chan struct{})

ChanFuncErr returns a channel to receive all results of act until err != nil before close.

func ChanFuncNok

func ChanFuncNok(act func() (struct{}, bool)) (out <-chan struct{})

ChanFuncNok returns a channel to receive all results of act until nok before close.

func ChanPatS

func ChanPatS(inp ...[]struct{}) (out <-chan []struct{})

ChanPatS returns a channel to receive all inputs before close.

func ChanPatSFuncErr

func ChanPatSFuncErr(act func() ([]struct{}, error)) (out <-chan []struct{})

ChanPatSFuncErr returns a channel to receive all results of act until err != nil before close.

func ChanPatSFuncNok

func ChanPatSFuncNok(act func() ([]struct{}, bool)) (out <-chan []struct{})

ChanPatSFuncNok returns a channel to receive all results of act until nok before close.

func ChanPatSSlice

func ChanPatSSlice(inp ...[][]struct{}) (out <-chan []struct{})

ChanPatSSlice returns a channel to receive all inputs before close.

func ChanSlice

func ChanSlice(inp ...[]struct{}) (out <-chan struct{})

ChanSlice returns a channel to receive all inputs before close.

func Daisy

func Daisy(inp <-chan struct{}, tube Tube) (out <-chan struct{})

Daisy returns a channel to receive all inp after having passed thru tube.

func DaisyChain

func DaisyChain(inp <-chan struct{}, tubes ...Tube) (out <-chan struct{})

DaisyChain returns a channel to receive all inp after having passed thru all tubes.

func Done

func Done(inp <-chan struct{}) (done <-chan struct{})

Done returns a channel to receive one signal before close after inp has been drained.

func DoneFunc

func DoneFunc(inp <-chan struct{}, act func(a struct{})) (out <-chan struct{})

DoneFunc returns a channel to receive one signal before close after act has been applied to all inp.

func DonePatS

func DonePatS(inp <-chan []struct{}) (done <-chan struct{})

DonePatS returns a channel to receive one signal before close after inp has been drained.

func DonePatSFunc

func DonePatSFunc(inp <-chan []struct{}, act func(a []struct{})) (out <-chan struct{})

DonePatSFunc returns a channel to receive one signal before close after act has been applied to all inp.

func DonePatSSlice

func DonePatSSlice(inp <-chan []struct{}) (done <-chan [][]struct{})

DonePatSSlice returns a channel which will receive a slice of all the PatSs received on inp channel before close. Unlike DonePatS, a full slice is sent once, not just an event.

func DoneSlice

func DoneSlice(inp <-chan struct{}) (done <-chan []struct{})

DoneSlice returns a channel which will receive a slice of all the s received on inp channel before close. Unlike Done, a full slice is sent once, not just an event.

func Join

func Join(out chan<- struct{}, inp ...struct{}) (done <-chan struct{})

Join sends inputs on the given out channel and returns a done channel to receive one signal when inp has been drained

func JoinChan

func JoinChan(out chan<- struct{}, inp <-chan struct{}) (done <-chan struct{})

JoinChan sends inputs on the given out channel and returns a done channel to receive one signal when inp has been drained

func JoinPatS

func JoinPatS(out chan<- []struct{}, inp ...[]struct{}) (done <-chan struct{})

JoinPatS sends inputs on the given out channel and returns a done channel to receive one signal when inp has been drained

func JoinPatSChan

func JoinPatSChan(out chan<- []struct{}, inp <-chan []struct{}) (done <-chan struct{})

JoinPatSChan sends inputs on the given out channel and returns a done channel to receive one signal when inp has been drained

func JoinPatSSlice

func JoinPatSSlice(out chan<- []struct{}, inp ...[][]struct{}) (done <-chan struct{})

JoinPatSSlice sends inputs on the given out channel and returns a done channel to receive one signal when inp has been drained

func JoinSlice

func JoinSlice(out chan<- struct{}, inp ...[]struct{}) (done <-chan struct{})

JoinSlice sends inputs on the given out channel and returns a done channel to receive one signal when inp has been drained

func MakeChan

func MakeChan() (out chan struct{})

MakeChan returns a new open channel (simply a 'chan struct{}' that is).

Note: No '-producer' is launched here yet! (as is in all the other functions).

This is useful to easily create corresponding variables such as

var myPipelineStartsHere := MakeChan()
// ... lot's of code to design and build Your favourite "myWorkflowPipeline"
// ...
// ... *before* You start pouring data into it, e.g. simply via:
for drop := range water {
	myPipelineStartsHere <- drop
}
close(myPipelineStartsHere)

Hint: especially helpful, if Your piping library operates on some hidden (non-exported) type (or on a type imported from elsewhere - and You don't want/need or should(!) have to care.)

Note: as always (except for PipeBuffer) the channel is unbuffered.

func MakePatSChan

func MakePatSChan() (out chan []struct{})

MakePatSChan returns a new open channel (simply a 'chan []struct{}' that is).

Note: No 'PatS-producer' is launched here yet! (as is in all the other functions).

This is useful to easily create corresponding variables such as

var myPatSPipelineStartsHere := MakePatSChan()
// ... lot's of code to design and build Your favourite "myPatSWorkflowPipeline"
// ...
// ... *before* You start pouring data into it, e.g. simply via:
for drop := range water {
	myPatSPipelineStartsHere <- drop
}
close(myPatSPipelineStartsHere)

Hint: especially helpful, if Your piping library operates on some hidden (non-exported) type (or on a type imported from elsewhere - and You don't want/need or should(!) have to care.)

Note: as always (except for PipePatSBuffer) the channel is unbuffered.

func PatSDaisy

func PatSDaisy(inp <-chan []struct{}, tube PatSTube) (out <-chan []struct{})

PatSDaisy returns a channel to receive all inp after having passed thru tube.

func PatSDaisyChain

func PatSDaisyChain(inp <-chan []struct{}, tubes ...PatSTube) (out <-chan []struct{})

PatSDaisyChain returns a channel to receive all inp after having passed thru all tubes.

func PipeBuffer

func PipeBuffer(inp <-chan struct{}, cap int) (out <-chan struct{})

PipeBuffer returns a buffered channel with capacity cap to receive all inp before close.

func PipeFork

func PipeFork(inp <-chan struct{}) (out1, out2 <-chan struct{})

PipeFork returns two channels to receive every result of inp before close.

Note: Yes, it is a VERY simple fanout - but sometimes all You need.

func PipeFunc

func PipeFunc(inp <-chan struct{}, act func(a struct{}) struct{}) (out <-chan struct{})

PipeFunc returns a channel to receive every result of act applied to inp before close. Note: it 'could' be PipeMap for functional people, but 'map' has a very different meaning in go lang.

func PipePatSBuffer

func PipePatSBuffer(inp <-chan []struct{}, cap int) (out <-chan []struct{})

PipePatSBuffer returns a buffered channel with capacity cap to receive all inp before close.

func PipePatSFork

func PipePatSFork(inp <-chan []struct{}) (out1, out2 <-chan []struct{})

PipePatSFork returns two channels to receive every result of inp before close.

Note: Yes, it is a VERY simple fanout - but sometimes all You need.

func PipePatSFunc

func PipePatSFunc(inp <-chan []struct{}, act func(a []struct{}) []struct{}) (out <-chan []struct{})

PipePatSFunc returns a channel to receive every result of act applied to inp before close. Note: it 'could' be PipePatSMap for functional people, but 'map' has a very different meaning in go lang.

func SendProxy

func SendProxy(out chan<- struct{}) chan<- struct{}

SendProxy returns a channel to serve as a sending proxy to 'out'. Uses a goroutine to receive values from 'out' and store them in an expanding buffer, so that sending to 'out' never blocks.

Note: the expanding buffer is implemented via "container/ring"

func SendProxyPatS

func SendProxyPatS(out chan<- []struct{}) chan<- []struct{}

SendProxyPatS returns a channel to serve as a sending proxy to 'out'. Uses a goroutine to receive values from 'out' and store them in an expanding buffer, so that sending to 'out' never blocks.

Note: the expanding buffer is implemented via "container/ring"

Types

type PatSTube

type PatSTube func(inp <-chan []struct{}, out <-chan []struct{})

PatSTube is the signature for a pipe function.

type Tube

type Tube func(inp <-chan struct{}, out <-chan struct{})

Tube is the signature for a pipe function.

Jump to

Keyboard shortcuts

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