dot

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: 2 Imported by: 0

Documentation

Index

Constants

View Source
const DotCAP = 10

DotCAP is the capacity of the buffered proxy channel

View Source
const DotQUE = 16

DotQUE is the allocated size of the circular queue

Variables

This section is empty.

Functions

func ChanDot

func ChanDot(inp ...*dot.Dot) (out <-chan *dot.Dot)

ChanDot returns a channel to receive all inputs before close.

func ChanDotFuncErr

func ChanDotFuncErr(act func() (*dot.Dot, error)) (out <-chan *dot.Dot)

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

func ChanDotFuncNil

func ChanDotFuncNil(act func() *dot.Dot) (out <-chan *dot.Dot)

ChanDotFuncNil returns a channel to receive all results of act until nil before close.

func ChanDotFuncNok

func ChanDotFuncNok(act func() (*dot.Dot, bool)) (out <-chan *dot.Dot)

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

func ChanDotSlice

func ChanDotSlice(inp ...[]*dot.Dot) (out <-chan *dot.Dot)

ChanDotSlice returns a channel to receive all inputs before close.

func DoneDot

func DoneDot(inp <-chan *dot.Dot) (done <-chan struct{})

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

func DoneDotFunc

func DoneDotFunc(inp <-chan *dot.Dot, act func(a *dot.Dot)) (out <-chan struct{})

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

func DoneDotSlice

func DoneDotSlice(inp <-chan *dot.Dot) (done <-chan []*dot.Dot)

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

func DotDaisy

func DotDaisy(inp <-chan *dot.Dot, tube DotTube) (out <-chan *dot.Dot)

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

func DotDaisyChain

func DotDaisyChain(inp <-chan *dot.Dot, tubes ...DotTube) (out <-chan *dot.Dot)

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

func JoinDot

func JoinDot(out chan<- *dot.Dot, inp ...*dot.Dot) (done <-chan struct{})

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

func JoinDotChan

func JoinDotChan(out chan<- *dot.Dot, inp <-chan *dot.Dot) (done <-chan struct{})

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

func JoinDotSlice

func JoinDotSlice(out chan<- *dot.Dot, inp ...[]*dot.Dot) (done <-chan struct{})

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

func MakeDotChan

func MakeDotChan() (out chan *dot.Dot)

MakeDotChan returns a new open channel (simply a 'chan *dot.Dot' that is).

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

This is useful to easily create corresponding variables such as

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

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 PipeDotBuffer) the channel is unbuffered.

func PipeDotBuffer

func PipeDotBuffer(inp <-chan *dot.Dot, cap int) (out <-chan *dot.Dot)

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

func PipeDotFork

func PipeDotFork(inp <-chan *dot.Dot) (out1, out2 <-chan *dot.Dot)

PipeDotFork 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 PipeDotFunc

func PipeDotFunc(inp <-chan *dot.Dot, act func(a *dot.Dot) *dot.Dot) (out <-chan *dot.Dot)

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

func SendProxyDot

func SendProxyDot(out chan<- *dot.Dot) chan<- *dot.Dot

SendProxyDot 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 DotTube

type DotTube func(inp <-chan *dot.Dot, out <-chan *dot.Dot)

DotTube 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