Categorygithub.com/golangsam/pipe
modulepackage
0.2.2
Repository: https://github.com/golangsam/pipe.git
Documentation: pkg.go.dev

# README

pipe/s

A pipers bag - generic functions to gain concurrency - batteries included :-)

Software License Go Report Card Build Status GoDoc

pipe/s - an extensive and systematic ensemble of concurrency-based mechanisms

  • as ready-to-use generic production-grade code

  • in different sizes such s and m (mind You: one size never fit's all)

  • with comprehensively explained concepts, formulas and terminology - readme

  • complemented with lots of 'how-to-do' and 'how-to-use' expamples.

  • Follow a (hopefully) enlightening evolution.

  • Begin with oversimplified (but popular!) code.

  • Encounter dangerous pitfalls and easy-to-do mistakes along the way.

  • Improve Your use of vaccines and protective habits.

  • Ascend to implementations of some higher-level concepts such as 'load balancer', 'circular crawler' ...

  • Eventually encounter the little-known land of concurrent lazy evaluation.

That's where we aim to go here - using go, common sense and playful discipline.

Are You ready for this?

    go get -u github.com/GoLangsam/pipe

Still in doubt? Have a peek at the short prolog.

And the overview is a good place to start...

May what You find here in this repo be a trustworthy and helpful companion along Your journey. Enjoy!

Please feel free and encouraged to suggest, improve, comment or ask - You'll be welcome!


Think deep - code happy - be simple - see clear :-)


Support on Beerpay

Hey dude! Help me out for a couple of :beers:!

Beerpay Beerpay

# Packages

No description provided by the author
No description provided by the author
package pipe provides functions useful to build a network of concurrent pipe processes the components of which are connected by channels.
package pipe provides functions useful to build a network of concurrent pipe processes the components of which are connected by channels.
package pipe provides functions useful to build a network of concurrent pipe processes the components of which are connected by channels.
package pipe provides functions useful to build a network of concurrent pipe processes the components of which are connected by channels.
package pipe provides functions useful to build a network of concurrent pipe processes the components of which are connected by channels.
package pipe provides functions useful to build a network of concurrent pipe processes the components of which are connected by channels.
package pipe provides functions useful to build a network of concurrent pipe processes the components of which are connected by channels.
package pipe provides functions useful to build a network of concurrent pipe processes the components of which are connected by channels.

# Functions

AnyChan returns a channel to receive all inputs before close.
AnyChanFuncErr returns a channel to receive all results of generator `gen` until `err != nil` before close.
AnyChanFuncNok returns a channel to receive all results of generator `gen` until `!ok` before close.
AnyChanSlice returns a channel to receive all inputs before close.
AnyDaisyChain returns a channel to receive all inp after having passed thru the process(es) (`from` right `into` left) before close.
AnyDaisyChaiN returns a channel to receive all inp after having passed `somany` times thru the process(es) (`from` right `into` left) before close.
AnyDone returns a channel to receive one signal upon close and after `inp` has been drained.
AnyDoneFreq returns a channel to receive a frequency histogram (as a `map[Any]int64`) upon close.
AnyDoneFreqAttr returns a channel to receive a frequency histogram (as a `map[interface{}]int64`) upon close.
AnyDoneFunc will apply `act` to every `inp` and returns a channel to receive one signal upon close.
AnyDoneLeave returns a channel to receive one signal after all throughput on `inp` has been registered as departure on the given `sync.WaitGroup` before close.
AnyDoneSlice returns a channel to receive a slice with every Any received on `inp` upon close.
AnyDoneWait returns a channel to receive one signal after wg.Wait() has returned and out has been closed before close.
AnyFan2 returns a channel to receive everything from `inp` as well as all inputs before close.
AnyFan2Chan returns a channel to receive everything from `inp` as well as everything from `inp2` before close.
AnyFan2FuncErr returns a channel to receive everything from `inp` as well as all results of generator `gen` until `err != nil` before close.
AnyFan2FuncNok returns a channel to receive everything from `inp` as well as all results of generator `gen` until `!ok` before close.
AnyFan2Slice returns a channel to receive everything from `inp` as well as all inputs before close.
AnyFanIn returns a channel to receive all inputs arriving on variadic inps before close.
AnyFanIn1 returns a channel to receive all inputs arriving on variadic inps before close.
AnyFanIn2 returns a channel to receive all from both `inp1` and `inp2` before close.
AnyFanOut returns a slice (of size = size) of channels each of which shall receive any inp before close.
AnyFini returns a closure around `AnyDone(_)`.
AnyFiniFunc returns a closure around `AnyDoneFunc(_, act)`.
AnyFiniLeave returns a closure around `AnyDoneLeave(_, wg)` registering throughput as departure on the given `sync.WaitGroup`.
AnyFiniSlice returns a closure around `AnyDoneSlice(_)`.
AnyFiniWait returns a closure around `AnyDoneWait(_, wg)`.
AnyFork returns two channels either of which is to receive every result of inp before close.
AnyForkSeen returns two channels, `new` and `old`, where `new` is to receive all `inp` not been seen before and `old` all `inp` seen before (internally growing a `sync.Map` to discriminate) until close.
AnyForkSeenAttr returns two channels, `new` and `old`, where `new` is to receive all `inp` whose attribute `attr` has not been seen before and `old` all `inp` seen before (internally growing a `sync.Map` to discriminate) until close.
AnyJoin sends inputs on the given out channel and returns a done channel to receive one signal when inp has been drained.
AnyJoinChan sends inputs on the given out channel and returns a done channel to receive one signal when inp has been drained.
AnyJoinSlice sends inputs on the given out channel and returns a done channel to receive one signal when inp has been drained.
AnyMakeChan returns a new open channel (simply a 'chan Any' that is).
AnyMerge returns a channel to receive all inputs sorted and free of duplicates.
AnyPair returns a pair of channels to receive every result of inp before close.
AnyPipeAdjust returns a channel to receive all `inp` buffered by a AnySendProxy process before close.
AnyPipeBuffered returns a buffered channel with capacity `cap` to receive all `inp` before close.
AnyPipeDone returns a channel to receive every `inp` before close and a channel to signal this closing.
AnyPipeEnter returns a channel to receive all `inp` and registers throughput as arrival on the given `sync.WaitGroup` until close.
AnyPipeFunc returns a channel to receive every result of action `act` applied to `inp` before close.
AnyPipeFuncMany returns a channel to receive every result of action `act` applied to `inp` by `many` parallel processing goroutines before close.
AnyPipeLeave returns a channel to receive all `inp` and registers throughput as departure on the given `sync.WaitGroup` until close.
AnyPipeSeen returns a channel to receive all `inp` not been seen before while silently dropping everything seen before (internally growing a `sync.Map` to discriminate) until close.
AnyPipeSeenAttr returns a channel to receive all `inp` whose attribute `attr` has not been seen before while silently dropping everything seen before (internally growing a `sync.Map` to discriminate) until close.
AnyPlug returns a channel to receive every `inp` before close and a channel to signal this closing.
AnyPlugAfter returns a channel to receive every `inp` before close and a channel to signal this closing.
AnySame reads values from two channels in lockstep and iff they have the same contents then `true` is sent on the returned bool channel before close.
AnySendProxy returns a channel to serve as a sending proxy to 'out'.
AnyStrew returns a slice (of size = size) of channels one of which shall receive each inp before close.
AnyTubeAdjust returns a closure around AnyPipeAdjust (_, sizes ...int).
AnyTubeBuffered returns a closure around PipeAnyBuffer (_, cap).
AnyTubeEnter returns a closure around AnyPipeEnter (_, wg) registering throughput as arrival on the given `sync.WaitGroup`.
AnyTubeFunc returns a closure around PipeAnyFunc (_, act).
AnyTubeLeave returns a closure around AnyPipeLeave (_, wg) registering throughput as departure on the given `sync.WaitGroup`.
AnyTubeSeen returns a closure around AnyPipeSeen() (silently dropping every Any seen before).
AnyTubeSeenAttr returns a closure around AnyPipeSeenAttr() (silently dropping every Any whose attribute `attr` was seen before).

# Interfaces

AnyWaiter - as implemented by `*sync.WaitGroup` - attends Flapdoors and keeps counting who enters and who leaves.

# Type aliases

Any is the generic type flowing thru the pipe network.
AnyProc is the signature of the inner process of any linear pipe-network Example: the identity proc: samesame := func(into chan<- Any, from <-chan Any) { into <- <-from } Note: type AnyProc is provided for documentation purpose only.