fgbase

package module
v0.0.0-...-2aa4a6f Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: BSD-3-Clause Imports: 17 Imported by: 4

README

fgbase

Package of Go flowgraph primitives

Getting Started
go get -u github.com/vectaport/fgbase
go get -u github.com/vectaport/fgbase_test
cd $GOPATH/src/github.com/vectaport/fgbase_test
make
Overview

Go (Golang) offers direct support for concurrent programming with goroutines, channels, and the select statement. Used together they offer all the building blocks necessary for programming across many cores and many Unix boxes. But so much is possible with goroutines that constructing scaleable and reliable systems (that won't deadlock or be throttled by bottlenecks) requires the application or invention of additional concepts.

Flowgraphs are a distinct model of concurrent programming that augment channels with ready-send handshake mechanisms to ensure that no data is sent before the receiver is ready. MPI (a framework for supercomputer computation) directly supports flowgraph computation, but doesn't address flow-based computation within a single Unix process. Go with its goroutines (more efficient than threads according to Rob Pike) facilitates taking the MPI model down to whatever granularity the concurrent programmer wants.

It is not immediately obvious how to use goroutines, channels, and select to implement the flowgraph model. This framework is an attempt to illustrate one possible approach.

Features of github.com/vectaport/fgbase:

  • fgbase.Edge augments a channel with a ready-send acknowledge protocol
  • ready-send can guarantee that unbuffered writes never lead to deadlock
  • fgbase.Node augments a goroutine with an empty interface data protocol
  • an empty interface data protocol allows a small set of primitives to be reused for a wide variety of things
  • test benches at github.com/vectaport/fgbase_test

The fgbase package can be used to (manually) render flowgraphs drawn and simulated in github.com/vectaport/ipl into compilable Golang code. ipl is an implementation of a flowgraph language suggested by Karl Fant.

Wiki Topics:

Documentation

Overview

Package fgbase layers a ready-send flow mechanism on top of goroutines. https://github.com/vectaport/fgbase/wiki

Index

Constants

View Source
const (
	Old int = iota
	New
)
View Source
const EOF = Error("EOF")

Variables

View Source
var ChannelSize = 1

Buffer size for every channel.

View Source
var DotOutput = false

DotOutput is Graphviz .dot output

View Source
var EdgeID int64

EgdeID is a unique edge id.

View Source
var GlobalStats = false

GlobalStats will enable global flowgraph stats for uncommon debug-purposes. Otherwise it should be left false because it requires a global mutex.

View Source
var GmlOutput = false

GMLOutput is gml output

View Source
var NodeID int64

NodeID is a unique node id.

View Source
var RunTime time.Duration = -1

RunTime is the duration to run this flowgraph.

View Source
var StartTime time.Time

When the flowgraph started running.

View Source
var StderrLog = log.New(os.Stderr, "", 0)

Log for collecting error messages.

View Source
var StdoutLog = log.New(os.Stdout, "", 0)

Log for tracing flowgraph execution.

View Source
var TraceFireCnt = true

TraceFireCnt is the number of node executions.

View Source
var TraceIndent = false

TraceIndent is trace by Node id tabs.

View Source
var TraceLevel = Q

TraceLevel enables tracing, writes to StdoutLog if TraceLevel>Q.

View Source
var TraceLevels = map[string]TraceLevelType{
	"QQ":   QQ,
	"Q":    Q,
	"V":    V,
	"VV":   VV,
	"VVV":  VVV,
	"VVVV": VVVV,
}

Map from string to enum for trace flag checking.

View Source
var TracePointer = false

Trace Node pointer.

View Source
var TracePorts = false

TracePorts by name using dot notation

View Source
var TraceSeconds = false

TraceSeconds that have elapsed.

View Source
var TraceStyle = Old

TraceStyle is Old or New

View Source
var TraceTypes = false

TraceTypes in full detail, including common types.

Functions

func AddFire

func AddFire(n *Node) error

AddFire fire func for FuncAdd

func ArrayFire

func ArrayFire(n *Node) error

ArrayFire is fire func for FuncArray

func ConfigByFlag

func ConfigByFlag(defaults map[string]interface{})

ConfigByFlag initializes a standard set of command line arguments for flowgraph utilities, while at the same time parsing all other flags. Use the defaults argument to override default settings for ncore, chanz, sec, trace, trsec, trtyp, trport, summ, dot, and gml. Use -help to see the standard set.

func ConstFire

func ConstFire(n *Node) error

ConstFire is fire func for FuncConst

func CopySlice

func CopySlice(d interface{}) interface{}

CopySlice returns a copy of a slice from an empty interface (as an empty interface).

func DivFire

func DivFire(n *Node) error

DivFire is fire func for FuncDiv

func EqualsTest

func EqualsTest(n *Node, a, b interface{}) bool

EqualsTest returns true if two empty interfaces have the same numeric or string value.

func Index

func Index(d interface{}, i int) interface{}

Index returns the nth element of an empty interface (interface{}) that is a slice.

func Int

func Int(a interface{}) int

Int returns an int version of a value

func IsEOF

func IsEOF(v interface{}) (eof bool)

IsEOF returns true if interface{} is EOF error

func IsInt

func IsInt(d interface{}) bool

IsInt returns true if empty interface (interface{}) is an int.

func IsNada

func IsNada(d interface{}) bool

IsNada tests if a interface{} (an empty interface) is a struct{} (an empty struct)

func IsPtr

func IsPtr(d interface{}) bool

IsPtr returns true if empty interface (interface{}) is a pointer

func IsSlice

func IsSlice(d interface{}) bool

IsSlice returns true if empty interface (interface{}) is a slice.

func IsStruct

func IsStruct(d interface{}) bool

IsStruct returns true if empty interface (interface{}) is a struct.

func IsZero

func IsZero(d interface{}) bool

IsZero returns true if a interface{} has a golang zero value

func Len

func Len(d interface{}) int

Len returns the length of an empty interface (interface{}) if it is a slice.

func MakeGraph

func MakeGraph(sze, szn int) ([]Edge, []Node)

MakeGraph returns a slice of Edge and a slice of Node.

func ModFire

func ModFire(n *Node) error

ModFire is fire primitive for FuncMod

func MulFire

func MulFire(n *Node) error

MulFire is fire func for FuncMul

func NameEdges

func NameEdges(edges []Edge, names []string)

NameEdges adds a name to each Edge

func OutputDot

func OutputDot(nodes []*Node)

OutputDot outputs .dot graphviz format

func OutputGml

func OutputGml(nodes []*Node)

OutputGml outputs .gml graph modeling language format

func ParseDatum

func ParseDatum(s string) interface{}

ParseDatum parses a string for numeric constants, otherwise returns the string.

func Promote

func Promote(n *Node, a, b interface{}) (aBig, bBig interface{}, same bool)

Promote pair of numeric empty interfaces (interface{}) as necessary.

func RdyFire

func RdyFire(n *Node) error

RdyFire is fire func for FuncRdy

func ResolvePtr

func ResolvePtr(d interface{}) interface{}

ResolvePtr resolves an empty interface which is a pointer

func RunAll

func RunAll(nodes []Node)

RunAll calls Run for each Node, and times out after RunTime.

func RunGraph

func RunGraph(nodes []*Node)

RunGraph calls Run for each *Node, and times out after RunTime.

func SinkFire

func SinkFire(n *Node) error

func SteercFire

func SteercFire(n *Node) error

SteercRdy is fire func for FuncSteerc

func SteercRdy

func SteercRdy(n *Node) bool

SteercRdy is ready func for FuncSteerc

func SteervFire

func SteervFire(n *Node) error

SteervFire is fire func for FuncSteerv

func SteervRdy

func SteervRdy(n *Node) bool

SteervRdy is ready func for FuncSteerv

func String

func String(d interface{}) string

String returns a string representation of a interface{} with ellipse shortened slices if TraceLevel<VVVV.

func StringSlice

func StringSlice(d interface{}) string

StringSlice returns a string representation of a slice, ellipse shortened if TraceLevel<VVVV.

func StringStruct

func StringStruct(d interface{}) string

StringStruct returns a string representation of a struct with ellipse shortened slices if TraceLevel<VVVV.

func StringsToMap

func StringsToMap(strings []string) map[string]int

StringsToMap converts []string into map[string]int.

func SubFire

func SubFire(n *Node) error

SubFire is fire func for FuncFire

func TimeSinceStart

func TimeSinceStart() float64

TimeSinceStart returns time since start of running flowgraph.

func ZeroTest

func ZeroTest(a interface{}) bool

ZeroTest returns true if empty interface (interface{}) is a numeric zero.

Types

type Edge

type Edge struct {

	// values shared by upstream and downstream Nodes
	Name string              // for trace
	Data *[]chan interface{} // slice of data channels
	Ack  chan struct{}       // request (or acknowledge) channel

	// values unique to upstream and downstream Nodes
	Val    interface{}   // generic empty interface
	RdyCnt int           // readiness of I/O
	Flow   bool          // set true to allow one output, data or ack
	Ack2   chan struct{} // alternate channel for ack steering
	// contains filtered or unexported fields
}

Edge of a flowgraph.

func MakeEdge

func MakeEdge(name string, initVal interface{}) Edge

MakeEdge initializes optional data value to start flow.

func MakeEdges

func MakeEdges(sz int) []Edge

MakeEdges returns a slice of Edge.

func (*Edge) CloseData

func (e *Edge) CloseData()

CloseData closes all outgoing data channels.

func (*Edge) Const

func (e *Edge) Const(d interface{})

Const sets up an Edge to provide a constant value.

func (*Edge) Disconnect

func (e *Edge) Disconnect(n *Node)

Disconnect a node from an edge

func (*Edge) DotAttrs

func (e *Edge) DotAttrs() []string

DotAttrs returns the attribute strings used for outputting this edge in dot format

func (*Edge) DstCnt

func (e *Edge) DstCnt() int

DstCnt is the number of Node's downstream of an Edge

func (*Edge) DstJSON

func (e *Edge) DstJSON(n *Node, portString string)

DstJSON sets up an Edge with a remote JSON value destination.

func (*Edge) DstNode

func (e *Edge) DstNode(i int) *Node

DstNode returns the ith downstream Node of an Edge

func (*Edge) DstOrder

func (e *Edge) DstOrder(n *Node) int

DstOrder returns the order of a Node in an Edge's destinations

func (*Edge) DstPut

func (e *Edge) DstPut(v interface{})

DstPut sets the empty interface value flowing to the output Edge

func (*Edge) DstRdy

func (e *Edge) DstRdy(n *Node) bool

DstRdy tests if a destination Edge is ready.

func (*Edge) Dump

func (e *Edge) Dump()

Dump prints the edge details

func (*Edge) DumpEdgeNodes

func (e *Edge) DumpEdgeNodes()

DumpEdgeNodes dumps all the edgeNodes for this Edge

func (*Edge) IsConst

func (e *Edge) IsConst() bool

IsConst returns true if Edge provides a constant value.

func (*Edge) IsSink

func (e *Edge) IsSink() bool

IsSink returns true if Edge is a value sink.

func (*Edge) PoolEdge

func (e *Edge) PoolEdge(src *Edge) *Edge

PoolEdge returns an output Edge that is directed back into the Pool.

func (*Edge) RdyZero

func (e *Edge) RdyZero() bool

RdyZero tests if RdyCnt has returned to zero.

func (*Edge) Same

func (e *Edge) Same(e2 *Edge) bool

Same returns true if two edges are really the same

func (*Edge) SendAck

func (e *Edge) SendAck(n *Node) bool

SendAck writes struct{} to the Ack channel

func (*Edge) SendData

func (e *Edge) SendData(n *Node) bool

SendData writes to the Data channel

func (*Edge) SetDotAttrs

func (e *Edge) SetDotAttrs(attrs []string)

SetDotAttrs set the attribute string used for outputting this edge in dot format If more than one they are spread across dot edges.

func (*Edge) SetName

func (e *Edge) SetName(name string)

SetName sets the edge name in every copy

func (*Edge) Sink

func (e *Edge) Sink()

Sink sets up an Edge as a value sink.

func (*Edge) SrcCnt

func (e *Edge) SrcCnt() int

SrcCnt is the number of Node's upstream of an Edge

func (*Edge) SrcGet

func (e *Edge) SrcGet() interface{}

SrcGet returns the empty interface value flowing from the input Edge

func (*Edge) SrcJSON

func (e *Edge) SrcJSON(n *Node, portString string)

SrcJSON sets up an Edge with a remote JSON value source.

func (*Edge) SrcNode

func (e *Edge) SrcNode(i int) *Node

SrcNode returns the ith upstream Node of an Edge

func (*Edge) SrcRdy

func (e *Edge) SrcRdy(n *Node) bool

SrcRdy tests if a source Edge is ready.

type Error

type Error string

End of flow

func (Error) Error

func (e Error) Error() string

type Inter

type Inter interface {
	Int() int
}

Inter converts a value to an int

type Node

type Node struct {
	ID       int64       // unique id
	Name     string      // for tracing
	Cnt      int64       // execution count
	Srcs     []*Edge     // upstream Edge's
	Dsts     []*Edge     // downstream Edge's
	RdyFunc  NodeRdy     // func to test Edge readiness
	FireFunc NodeFire    // func to fire off the Node
	RunFunc  NodeRun     // func to repeatedly run Node
	Aux      interface{} // auxiliary empty interface to hold state
	RdyState int         // state of latest readiness
	Owner    interface{} // owner of this node
	// contains filtered or unexported fields
}

Node of a flowgraph.

func FuncAdd

func FuncAdd(a, b, x Edge) Node

FuncAdd adds values and returns the sum (x = a + b).

func FuncArbit

func FuncArbit(a, b, x Edge) Node

FuncArbit arbitrates between two values (select { case a: x = a case b: x = b }).

func FuncArray

func FuncArray(x Edge, arr []interface{}) Node

FuncArray streams the contents of an array then stops

func FuncCSVI

func FuncCSVI(x []Edge, r io.Reader, enums map[string]interface{}) Node

FuncCSVI reads a vector of input data values from a Reader and outputs them downstream. enums is an optional map from field.enum to an empty interface.

func FuncCSVO

func FuncCSVO(a []Edge, r io.Reader, enums map[string]interface{}) Node

FuncCSVO reads a vector of expected data values from a Reader and tests the against input from upstream. enums is an optional map from field.enum to an empty interface.

func FuncConst

func FuncConst(x Edge, c interface{}) Node

FuncConst produces a constant value (x = c). Can also be done with an Edge made const.

func FuncDecrypt

func FuncDecrypt(a Edge, x Edge, localPrivateKey, remotePublicKey *[32]byte, nonce [24]byte) Node

FuncDecrypt decrypts a buffer of byte data

func FuncDiv

func FuncDiv(a, b, x Edge) Node

FuncDiv divides values and returns the quotient (x = a / b).

func FuncDst

func FuncDst(a Edge, rw io.ReadWriter) Node

FuncDst writes data and waits for an acknowledging '\n'.

func FuncEither

func FuncEither(a, b, x Edge) Node

FuncEither passes on one of two values (if =a { x = a } else { x = b }).

func FuncEncrypt

func FuncEncrypt(a Edge, x Edge, localPrivateKey, remotePublicKey *[32]byte, nonce [24]byte) Node

FuncEncrypt encrypts a buffer of byte data

func FuncFork

func FuncFork(a, x, y Edge) Node

FuncFork sends a value two ways (x = a; y = a). If the value is a slice it is duplicated onto the second output.

func FuncLsh

func FuncLsh(a, b, x Edge) Node

FuncLsh left shifts a value(x = a << b).

func FuncMod

func FuncMod(a, b, x Edge) Node

FuncMod is the module operator (x = a % b).

func FuncMul

func FuncMul(a, b, x Edge) Node

FuncMul multiplies values and returns the product (x = a * b).

func FuncPass

func FuncPass(a, x Edge) Node

FuncPass passes a value on (x = a).

func FuncPrint

func FuncPrint(a Edge, x Edge, format string) Node

FuncPrint prints a data value using fmt.Printf

func FuncRdy

func FuncRdy(a, b, x Edge) Node

FuncRdy waits for two values before passing on the first (b; x = a).

func FuncRead

func FuncRead(x Edge, r io.Reader) Node

FuncRead reads a data value from a Reader

func FuncReduce

func FuncReduce(a, x Edge, reducer func(n *Node, datum, collection interface{}) interface{}, freerun bool) Node

FuncReduce reduces a stream of data into a single empty interface.

func FuncRsh

func FuncRsh(a, b, x Edge) Node

FuncRsh right shifts a value(x = a >> b).

func FuncSink

func FuncSink(a Edge) Node

FuncSink sinks a single value.

func FuncSrc

func FuncSrc(x Edge, rw io.ReadWriter) Node

FuncSrc reads a data value and writes a '\n' acknowledgement.

func FuncSteerc

func FuncSteerc(a, x, y Edge) Node

FuncSteerc steers a condition one of two ways (if a==0 { x = a } else { y = a }).

func FuncSteerv

func FuncSteerv(a, b, x, y Edge) Node

FuncSteerv steers the second value by the first (if a==0 { x = b } else { y = b }).

func FuncSub

func FuncSub(a, b, x Edge) Node

FuncSub subtracts values and returns the difference (x = a - b).

func FuncWrite

func FuncWrite(a Edge, w io.Writer) Node

FuncWrite writes a data value from a Writer

func MakeNode

func MakeNode(
	name string,
	srcs, dsts []*Edge,
	ready NodeRdy,
	fire NodeFire) Node

MakeNode returns a new Node with slices of input and output Edge's and functions for testing readiness then firing.

func MakeNodes

func MakeNodes(sz int) []Node

MakeNodes returns a slice of Node.

func (*Node) AckWrap

func (n *Node) AckWrap(d interface{}, ack chan struct{}) interface{}

AckWrap bundles a Node pointer, and an ack channel with an empty interface, in order to pass information about an upstream node downstream. Used for acking back in a Pool.

func (*Node) DefaultRdyFunc

func (n *Node) DefaultRdyFunc() bool

DefaultRdyFunc tests for everything ready.

func (*Node) DefaultRunFunc

func (n *Node) DefaultRunFunc() error

DefaultRunFunc is the default run func.

func (*Node) DotAttr

func (n *Node) DotAttr() string

DotAttr returns the attribute string used for outputting this node in dot format

func (*Node) Dst

func (n *Node) Dst(i int) *Edge

Dst gets the edge for a destination port

func (*Node) DstAppend

func (n *Node) DstAppend(e *Edge)

DstAppend appends an outgoing edge

func (*Node) DstByName

func (n *Node) DstByName(name string) *Edge

DstByName returns the outgoing edge by name

func (*Node) DstCnt

func (n *Node) DstCnt() int

DstCnt returns the number of destination edges.

func (*Node) DstNames

func (n *Node) DstNames() []string

DstNames returns the names of the outgoing edges

func (*Node) DstSet

func (n *Node) DstSet(i int, e *Edge)

DstSet sets the edge for a destination port

func (*Node) FindDst

func (n *Node) FindDst(name string) (*Edge, bool)

FindDst returns outgoing edge by name

func (*Node) FindDstIndex

func (n *Node) FindDstIndex(name string) (int, bool)

FindDstIndex returns index of outgoing edge by name

func (*Node) FindSrc

func (n *Node) FindSrc(name string) (*Edge, bool)

FindSrc returns incoming edge by name

func (*Node) FindSrcIndex

func (n *Node) FindSrcIndex(name string) (int, bool)

FindSrcIndex returns index of incoming edge by name

func (*Node) Fire

func (n *Node) Fire() error

Fire executes Node using function pointer.

func (*Node) Init

func (n *Node) Init()

Init initializes node internals after edges have been added

func (*Node) IsPool

func (n *Node) IsPool() bool

IsPool returns true if Node is part of a Pool.

func (n *Node) Link(in, ex *Edge)

Link links an internal stream to an external stream

func (*Node) LogError

func (n *Node) LogError(format string, v ...interface{})

LogError for logging of error messages. Uses atomic log mechanism.

func (*Node) Panicf

func (n *Node) Panicf(format string, v ...interface{})

Panicf for quitting with formatted panic message.

func (*Node) RdyAll

func (n *Node) RdyAll() (rdy bool)

RdyAll tests readiness of Node to execute.

func (*Node) Recursed

func (n *Node) Recursed() bool

Recursed returns true if a Node from the same Pool is upstream of this Node.

func (*Node) RecvOne

func (n *Node) RecvOne() (recvOK bool)

RecvOne reads one data or ack and decrements RdyCnt.

func (*Node) RemoveInputCase

func (n *Node) RemoveInputCase(e *Edge)

RemoveInputCase removes the input of a Node from the select switch. It is restored after RdyAll.

func (*Node) Run

func (n *Node) Run() error

Run is an event loop that runs forever for each Node.

func (*Node) SendAll

func (n *Node) SendAll() bool

SendAll writes all data and acks after new result is computed.

func (*Node) SetDotAttr

func (n *Node) SetDotAttr(attr string)

SetDotAttr set the attribute string used for outputting this node in dot format

func (*Node) SetDstNames

func (n *Node) SetDstNames(name ...string)

SetDstNames names the outgoing edges

func (*Node) SetDstNum

func (n *Node) SetDstNum(num int)

SetDstNum sets the number of result ports

func (*Node) SetSrcNames

func (n *Node) SetSrcNames(name ...string)

SetSrcNames names the incoming edges

func (*Node) SetSrcNum

func (n *Node) SetSrcNum(num int)

SetSrcNum sets the number of source ports

func (*Node) Src

func (n *Node) Src(i int) *Edge

Src gets the edge for a source port

func (*Node) SrcAppend

func (n *Node) SrcAppend(e *Edge)

SrcAppend appends an incoming edge

func (*Node) SrcByName

func (n *Node) SrcByName(name string) *Edge

SrcByName returns the incoming edge by name

func (*Node) SrcCnt

func (n *Node) SrcCnt() int

SrcCnt returns the number of source edges.

func (*Node) SrcNames

func (n *Node) SrcNames() []string

SrcNames returns the names of the incoming edges

func (*Node) SrcSet

func (n *Node) SrcSet(i int, e *Edge)

SrcSet sets the edge for a source port

func (*Node) String

func (n *Node) String() string

String returns a string representation of the node

func (*Node) TraceValRdy

func (n *Node) TraceValRdy()

TraceValRdy lists Node input values and output readiness when TraceLevel >= VVV.

func (*Node) TraceVals

func (n *Node) TraceVals()

TraceVals lists input and output values for a Node.

func (*Node) Tracef

func (n *Node) Tracef(format string, v ...interface{})

Tracef for debug trace printing. Uses atomic log mechanism.

type NodeFire

type NodeFire func(*Node) error

NodeFire is the function signature for executing a Node. Any error message should be written using Node.LogError and nil written to any output Edge.

type NodeRdy

type NodeRdy func(*Node) bool

NodeRdy is the function signature for evaluating readiness of a Node to fire.

type NodeRun

type NodeRun func(*Node) error

NodeRun is the function signature for an alternate Node event loop.

type Pool

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

Pool of Node's

func FuncMap

func FuncMap(a, x []Edge, mapper func(n *Node, datum interface{}) int) *Pool

FuncMap maps a value to one of n reducers.

func FuncQsort

func FuncQsort(a, x Edge, poolSz int) *Pool

FuncQsort recursively implements a quicksort with goroutines (x=qsort(a)).

func MakePool

func MakePool(
	size int,
	name string,
	srcs, dsts []Edge,
	ready NodeRdy,
	fire NodeFire,
	recurse, spread bool) *Pool

MakePool returns a Pool of Nodes that share both data channels and the source ack channel.

func (*Pool) Alloc

func (p *Pool) Alloc(n *Node, decr int) bool

Alloc decrements the number of free Node's in the Pool.

func (*Pool) Free

func (p *Pool) Free(n *Node, incr int) bool

Free increments the number of free Node's in the Pool.

func (*Pool) Mutex

func (p *Pool) Mutex() *sync.Mutex

Mutex returns the mutex for this Pool.

func (*Pool) Nodes

func (p *Pool) Nodes() []Node

Nodes returns the Pool's slice of Node.

func (*Pool) NumFree

func (p *Pool) NumFree() int

NumFree is the number of available Nodes in the Pool of Node's

func (*Pool) Size

func (p *Pool) Size() int

Size is the total size of the Pool of Node's.

func (*Pool) Trace

func (p *Pool) Trace(n *Node)

Trace logs the current number of free Pool Node's using "*" (or "X" every ten if Pool larger than 100).

type RecursiveSort

type RecursiveSort interface {
	sort.Interface

	// SubSlice returns a sub-slice.
	SubSlice(n, m int) interface{}

	// Slice returns current slice.
	Slice() []int
	// Original returns original slice
	Original() []int

	// Depth returns the depth of a recursive sort
	Depth() int64
	// ID returns a unique ID for the original slice.
	ID() int64
}

RecursiveSort extends sort.Interface for recursive sorting.

type SinkStats

type SinkStats struct {
	Cnt int
	Sum int
}

SinkStats to use with Sinker interface

func (*SinkStats) Sink

func (s *SinkStats) Sink(v []interface{})

type Sinker

type Sinker interface {
	Sink(source []interface{})
}

Sinker consumes wavefronts of values one at a time forever

type TraceLevelType

type TraceLevelType int

Trace level constants.

const (
	QQ   TraceLevelType = iota // ultra-quiet for minimal stats
	Q                          // quiet, default
	V                          // trace Node execution
	VV                         // trace channel IO
	VVV                        // trace state before select
	VVVV                       // full-length array dumps
)

func (TraceLevelType) String

func (t TraceLevelType) String() string

String method for TraceLevelType

type ZeroTester

type ZeroTester interface {
	ZeroTest() bool
}

ZeroTester tests if an empty interface represents zero

Directories

Path Synopsis
Package imglab extends the fgbase package with imaging primitives.
Package imglab extends the fgbase package with imaging primitives.
Package regexp builds regular expressions out of scalable flowgraphs
Package regexp builds regular expressions out of scalable flowgraphs
Package weblab extends the fgbase package with web and http primitives.
Package weblab extends the fgbase package with web and http primitives.

Jump to

Keyboard shortcuts

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