IsUnsafe

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 QUE = 16

QUE is the allocated size of the circular queue

Variables

This section is empty.

Functions

func Chan

func Chan(inp ...uintptr) chan uintptr

Chan returns a channel to receive all inputs before close.

func ChanFuncErr

func ChanFuncErr(act func() (uintptr, error)) <-chan uintptr

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

func ChanFuncNok

func ChanFuncNok(act func() (uintptr, bool)) <-chan uintptr

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

func ChanSlice

func ChanSlice(inp ...[]uintptr) chan uintptr

ChanSlice returns a channel to receive all inputs before close.

func Daisy

func Daisy(inp <-chan uintptr, tube Tube) (out <-chan uintptr)

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

func DaisyChain

func DaisyChain(inp <-chan uintptr, tubes ...Tube) (out <-chan uintptr)

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

func Done

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

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

func DoneFunc

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

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

func DoneSlice

func DoneSlice(inp <-chan uintptr) chan []uintptr

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<- uintptr, inp ...uintptr) 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<- uintptr, inp <-chan uintptr) 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 JoinSlice

func JoinSlice(out chan<- uintptr, inp ...[]uintptr) 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() chan uintptr

MakeChan returns a new open channel (simply a 'chan uintptr' 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 PipeBuffer

func PipeBuffer(inp <-chan uintptr, cap int) chan uintptr

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

func PipeFork

func PipeFork(inp <-chan uintptr) (chan uintptr, chan uintptr)

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 uintptr, act func(a uintptr) uintptr) chan uintptr

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 SendProxy

func SendProxy(out chan<- uintptr) chan<- uintptr

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"

Types

type Tube

type Tube func(inp <-chan uintptr, out <-chan uintptr)

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