Documentation
¶
Index ¶
- func DiscoverNodePortTypes(node Node)
- func DiscoverPortTypes(factory *refutil.TypeFactory)
- func DynamicAnyValue(port OutputPort) (any, bool)
- func DynamicArrayOf(sample OutputPort, values []any) (any, bool)
- func Generation() uint64
- func GetOutputReference[G any](result ExecutionRecorder, output Output[G]) *G
- func GetOutputValue[G any](recorder ExecutionRecorder, output Output[G]) G
- func GetOutputValues[G any](recorder ExecutionRecorder, output []Output[G]) []G
- func IsPortTypeKnown(typeName string) bool
- func KnownPortTypes() []string
- func Touch()
- func TryGetOutputReference[G any](result ExecutionRecorder, output Output[G], fallback *G) *G
- func TryGetOutputValue[G any](recorder ExecutionRecorder, output Output[G], fallback G) G
- func Zip1[A, R any](out *Lifted[R], a LiftedPort[A], kernel func(A) R)
- func Zip2[A, B, R any](out *Lifted[R], a LiftedPort[A], b LiftedPort[B], kernel func(A, B) R)
- func Zip3[A, B, C, R any](out *Lifted[R], a LiftedPort[A], b LiftedPort[B], c LiftedPort[C], ...)
- func Zip4[A, B, C, D, R any](out *Lifted[R], a LiftedPort[A], b LiftedPort[B], c LiftedPort[C], ...)
- func ZipAll[A, R any](out *Lifted[R], ports []LiftedPort[A], kernel func([]A) R)
- type ArrayValueInputPort
- type ConstOutput
- func (co ConstOutput[T]) BuildDynamicArrayOutput(source DynamicSource) OutputPort
- func (co ConstOutput[T]) BuildDynamicOutput(source DynamicSource) OutputPort
- func (co ConstOutput[T]) BuildProxyOutput(source ProxySource) OutputPort
- func (co ConstOutput[T]) Description() string
- func (co ConstOutput[T]) Name() string
- func (co ConstOutput[T]) Node() Node
- func (so ConstOutput[T]) Type() string
- func (co ConstOutput[T]) Value() T
- func (ConstOutput[T]) Version() int
- type Describable
- type Dynamic
- type DynamicArray
- type DynamicArrayOutputBuilder
- type DynamicOutputBuilder
- type DynamicPort
- type DynamicSource
- type DynamicType
- type DynamicallyTyped
- type DynamicallyTypedPort
- type ExecutionRecorder
- type ExecutionReport
- type InputPort
- type InstanceTyped
- type InvalidInputError
- type Keyworded
- type LazyProxySource
- type Lifted
- type LiftedPort
- type Named
- type NilInputError
- type Node
- type NodeState
- type ObservableExecution
- type Output
- type OutputPort
- type Pathed
- type Port
- type ProxyOutputBuilder
- type ProxySource
- type SingleValueInputPort
- type StepTiming
- type Struct
- func (sn Struct[T]) Description() string
- func (s *Struct[T]) DynamicTypes() map[string]string
- func (s *Struct[T]) Inputs() map[string]InputPort
- func (sn Struct[T]) Keywords() []string
- func (sn Struct[T]) Name() string
- func (s *Struct[T]) Outputs() map[string]OutputPort
- func (sn Struct[T]) Path() string
- func (sn Struct[T]) Type() string
- type StructOutput
- func (so StructOutput[T]) BuildDynamicArrayOutput(source DynamicSource) OutputPort
- func (so StructOutput[T]) BuildDynamicOutput(source DynamicSource) OutputPort
- func (so StructOutput[T]) BuildProxyOutput(source ProxySource) OutputPort
- func (so *StructOutput[T]) CaptureError(err error)
- func (so *StructOutput[T]) CaptureTiming(title string, timing time.Duration)
- func (so StructOutput[T]) Description() string
- func (so StructOutput[T]) ExecutionReport() ExecutionReport
- func (so StructOutput[T]) Name() string
- func (so StructOutput[T]) Node() Node
- func (so *StructOutput[T]) Set(v T)
- func (so StructOutput[T]) Type() string
- func (so *StructOutput[T]) Value() T
- func (so StructOutput[T]) Version() int
- type TypeOptions
- type Typed
- type UnsetInputError
- type Value
- type VersionData
- type Versioned
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoverNodePortTypes ¶ added in v0.42.0
func DiscoverNodePortTypes(node Node)
func DiscoverPortTypes ¶ added in v0.42.0
func DiscoverPortTypes(factory *refutil.TypeFactory)
A sample port of each type is kept because the port is itself a factory for more ports of that type.
func DynamicAnyValue ¶ added in v0.42.0
func DynamicAnyValue(port OutputPort) (any, bool)
DynamicAnyValue reads a dynamic input without knowing its type, which is what a node generic over every type has to do.
func DynamicArrayOf ¶ added in v0.42.0
func DynamicArrayOf(sample OutputPort, values []any) (any, bool)
T comes from the sample port, not the values, so an array of an interface type does not collapse to whatever concrete type happened to be first.
func Generation ¶ added in v0.42.0
func Generation() uint64
func GetOutputReference ¶ added in v0.32.0
func GetOutputReference[G any](result ExecutionRecorder, output Output[G]) *G
func GetOutputValue ¶ added in v0.32.0
func GetOutputValue[G any](recorder ExecutionRecorder, output Output[G]) G
func GetOutputValues ¶ added in v0.32.0
func GetOutputValues[G any](recorder ExecutionRecorder, output []Output[G]) []G
func IsPortTypeKnown ¶ added in v0.42.0
func KnownPortTypes ¶ added in v0.42.0
func KnownPortTypes() []string
func TryGetOutputReference ¶ added in v0.32.0
func TryGetOutputReference[G any](result ExecutionRecorder, output Output[G], fallback *G) *G
func TryGetOutputValue ¶ added in v0.17.0
func TryGetOutputValue[G any](recorder ExecutionRecorder, output Output[G], fallback G) G
func Zip1 ¶ added in v0.42.0
func Zip1[A, R any](out *Lifted[R], a LiftedPort[A], kernel func(A) R)
func Zip2 ¶ added in v0.42.0
func Zip2[A, B, R any](out *Lifted[R], a LiftedPort[A], b LiftedPort[B], kernel func(A, B) R)
func Zip3 ¶ added in v0.42.0
func Zip3[A, B, C, R any](out *Lifted[R], a LiftedPort[A], b LiftedPort[B], c LiftedPort[C], kernel func(A, B, C) R)
func Zip4 ¶ added in v0.42.0
func Zip4[A, B, C, D, R any]( out *Lifted[R], a LiftedPort[A], b LiftedPort[B], c LiftedPort[C], d LiftedPort[D], kernel func(A, B, C, D) R, )
func ZipAll ¶ added in v0.42.0
func ZipAll[A, R any](out *Lifted[R], ports []LiftedPort[A], kernel func([]A) R)
Hands the kernel one element from each connection, unwired holes left out. The slice is reused between elements, so a kernel keeping it has to copy.
Types ¶
type ArrayValueInputPort ¶ added in v0.23.0
type ArrayValueInputPort interface {
InputPort
Value() []OutputPort
Add(port OutputPort) error
Remove(port OutputPort) error
Replace(index int, port OutputPort) error
}
type ConstOutput ¶ added in v0.25.0
func (ConstOutput[T]) BuildDynamicArrayOutput ¶ added in v0.42.0
func (co ConstOutput[T]) BuildDynamicArrayOutput(source DynamicSource) OutputPort
func (ConstOutput[T]) BuildDynamicOutput ¶ added in v0.42.0
func (co ConstOutput[T]) BuildDynamicOutput(source DynamicSource) OutputPort
func (ConstOutput[T]) BuildProxyOutput ¶ added in v0.39.0
func (co ConstOutput[T]) BuildProxyOutput(source ProxySource) OutputPort
func (ConstOutput[T]) Description ¶ added in v0.25.0
func (co ConstOutput[T]) Description() string
func (ConstOutput[T]) Name ¶ added in v0.25.0
func (co ConstOutput[T]) Name() string
func (ConstOutput[T]) Node ¶ added in v0.25.0
func (co ConstOutput[T]) Node() Node
func (ConstOutput[T]) Type ¶ added in v0.25.0
func (so ConstOutput[T]) Type() string
func (ConstOutput[T]) Value ¶ added in v0.25.0
func (co ConstOutput[T]) Value() T
func (ConstOutput[T]) Version ¶ added in v0.25.0
func (ConstOutput[T]) Version() int
type Describable ¶ added in v0.21.0
type Describable interface {
Description() string
}
type Dynamic ¶ added in v0.42.0
type Dynamic[V any] struct { // contains filtered or unexported fields }
The counterpart to StructOutput[T]; its type parameter names the variable the output carries.
func (*Dynamic[V]) CaptureError ¶ added in v0.42.0
func (*Dynamic[V]) CaptureTiming ¶ added in v0.42.0
func (*Dynamic[V]) Forward ¶ added in v0.42.0
func (d *Dynamic[V]) Forward(port OutputPort)
The value is never copied or boxed, so forwarding costs nothing whatever is flowing through.
type DynamicArray ¶ added in v0.42.0
type DynamicArray struct {
// contains filtered or unexported fields
}
DynamicArray is an array-carrying dynamic input, read elementwise without naming its type. Results built from it keep the original element type.
func DynamicArrayValue ¶ added in v0.42.0
func DynamicArrayValue(port OutputPort) (DynamicArray, bool)
DynamicArrayValue reads a port declared DynamicPort[[]V].
func (DynamicArray) At ¶ added in v0.42.0
func (a DynamicArray) At(index int) any
func (DynamicArray) Build ¶ added in v0.42.0
func (a DynamicArray) Build(values []any) any
Build makes a new array of the same element type from values.
func (DynamicArray) Flatten ¶ added in v0.42.0
func (a DynamicArray) Flatten() (any, bool)
Flatten joins an array of arrays into one array of the inner element type.
func (DynamicArray) Len ¶ added in v0.42.0
func (a DynamicArray) Len() int
func (DynamicArray) Range ¶ added in v0.42.0
func (a DynamicArray) Range(from, to int) any
Range is Build for a contiguous run, clamped to what is actually there.
func (DynamicArray) Values ¶ added in v0.42.0
func (a DynamicArray) Values() []any
type DynamicArrayOutputBuilder ¶ added in v0.42.0
type DynamicArrayOutputBuilder interface {
BuildDynamicArrayOutput(source DynamicSource) OutputPort
}
The port it returns deliberately cannot build a further array of itself: a method returning the slice of its own parameter is an instantiation cycle.
func LookupPortTypeDynamicArray ¶ added in v0.42.0
func LookupPortTypeDynamicArray(typeName string) (DynamicArrayOutputBuilder, bool)
LookupPortTypeDynamicArray returns a factory for a port carrying an array of the given value type.
type DynamicOutputBuilder ¶ added in v0.42.0
type DynamicOutputBuilder interface {
BuildDynamicOutput(source DynamicSource) OutputPort
}
Every typed output port is a factory for a runtime-typed port of the same value type, so every type a node produces is covered with no registration.
func LookupPortTypeDynamic ¶ added in v0.42.0
func LookupPortTypeDynamic(typeName string) (DynamicOutputBuilder, bool)
LookupPortTypeDynamic returns a factory for a runtime-typed port of the given value type.
type DynamicPort ¶ added in v0.42.0
type DynamicPort[V any] interface { OutputPort }
Value type decided at runtime, so the node is registered once for every type. Ports sharing a variable settle on one type together.
type DynamicSource ¶ added in v0.42.0
type DynamicSource interface {
Port
Version() int
Type() string
// CurrentSource is the port being passed through, nil when the node
// computed a value instead.
CurrentSource() OutputPort
AnyValue() any
}
DynamicSource is what a runtime-typed output port reads from: either a port to pass through, or a computed value.
type DynamicType ¶ added in v0.42.0
type DynamicType any
A node declares one per independent type it carries: type SelectType nodes.DynamicType
type DynamicallyTyped ¶ added in v0.42.0
Keyed by the type variable each one belongs to.
type DynamicallyTypedPort ¶ added in v0.42.0
type DynamicallyTypedPort interface {
// The port's type written in terms of its variable, which is what to
// show while nothing is connected.
DynamicPattern() string
// The graph offers the peer's type before connecting, so an unbound
// port can take its type from either end of the wire.
BindType(concrete string) error
// Released once the last connection holding the type goes, so a node
// wired up wrong can be rewired rather than thrown away.
ReleaseType()
}
type ExecutionRecorder ¶ added in v0.32.0
type ExecutionReport ¶ added in v0.32.0
type ExecutionReport struct {
Errors []string `json:"errors,omitempty"` // Any errors that occurred during execution
Logs []string `json:"logs,omitempty"` // Log messages produced
TotalTime time.Duration `json:"totalTime"` // Total time taken to compute the output
SelfTime *time.Duration `json:"selfTime,omitempty"` // Time spent within the node itself, not counting waiting on other outputs
Steps []StepTiming `json:"steps,omitempty"` // Detailed timing of sub-operations, all sub operation times should result in TotalTime - SelfTime
}
type InputPort ¶ added in v0.23.0
type InputPort interface {
Port
// Remove any connections to this port
Clear()
}
type InstanceTyped ¶ added in v0.42.0
type InstanceTyped interface {
InstanceType() string
}
type InvalidInputError ¶ added in v0.35.1
type InvalidInputError struct {
Input OutputPort
Message string
}
func (InvalidInputError) Error ¶ added in v0.35.1
func (nie InvalidInputError) Error() string
type LazyProxySource ¶ added in v0.42.0
type LazyProxySource interface {
SourceForValue() OutputPort
}
LazyProxySource has nothing behind it until a value is asked for, so CurrentSource can be nil where SourceForValue is not.
type Lifted ¶ added in v0.42.0
type Lifted[T any] struct { // contains filtered or unexported fields }
Filled by Zip rather than by the author, so rank alignment is decided in one place instead of in every node.
func (*Lifted[T]) BuildDynamicArrayOutput ¶ added in v0.42.0
func (l *Lifted[T]) BuildDynamicArrayOutput(source DynamicSource) OutputPort
func (*Lifted[T]) BuildDynamicOutput ¶ added in v0.42.0
func (l *Lifted[T]) BuildDynamicOutput(source DynamicSource) OutputPort
The handle is its own port factory, so a lifted output never consults the type registry: its element type is known at compile time.
func (*Lifted[T]) CaptureError ¶ added in v0.42.0
func (*Lifted[T]) CaptureTiming ¶ added in v0.42.0
type LiftedPort ¶ added in v0.42.0
type LiftedPort[T any] interface { OutputPort }
Takes either a T or an array of them, so a node written once against a single T works both ways. Only the count is decided at runtime, not the type.
func LiftedOr ¶ added in v0.42.0
func LiftedOr[T any](port LiftedPort[T], value T) LiftedPort[T]
An absent port is indistinguishable from one carrying the zero value, so a default has to be substituted here rather than inside the kernel.
type NilInputError ¶ added in v0.37.0
type NilInputError struct {
Input OutputPort
}
func (NilInputError) Error ¶ added in v0.37.0
func (nie NilInputError) Error() string
type ObservableExecution ¶ added in v0.32.0
type ObservableExecution interface {
ExecutionReport() ExecutionReport
}
ObservableOutput represents an output whose execution report can be inspected.
type Output ¶ added in v0.11.0
type Output[T any] interface { OutputPort Value() T }
type OutputPort ¶ added in v0.23.0
func NewDynamicOutput ¶ added in v0.42.0
func NewDynamicOutput[T any](source DynamicSource) OutputPort
func NewProxyOutput ¶ added in v0.39.0
func NewProxyOutput[T any](source ProxySource) OutputPort
type ProxyOutputBuilder ¶ added in v0.39.0
type ProxyOutputBuilder interface {
BuildProxyOutput(source ProxySource) OutputPort
}
ProxyOutputBuilder is implemented by typed output ports that can manufacture a proxy output port carrying the same value type. Because the implementations are generic, every value type produced by any registered node automatically has a proxy implementation compiled into the binary, which lets runtime-typed ports (like sub-graph boundaries) expose a strongly typed nodes.Output[T] without per-type registration.
func LookupPortTypeProxy ¶ added in v0.42.0
func LookupPortTypeProxy(typeName string) (ProxyOutputBuilder, bool)
LookupPortTypeProxy returns a factory for a pass-through port of the given value type, if any registered node produces that type.
type ProxySource ¶ added in v0.39.0
type ProxySource interface {
Port
Version() int
Type() string
// CurrentSource returns the port that values should be read from, or nil
// if nothing is currently connected.
CurrentSource() OutputPort
}
type SingleValueInputPort ¶ added in v0.23.0
type SingleValueInputPort interface {
InputPort
Value() OutputPort
Set(port OutputPort) error
}
type StepTiming ¶ added in v0.32.0
type StepTiming struct {
Label string `json:"label,omitempty"` // Descriptive name for this step
Duration time.Duration `json:"duration"` // Time taken by this step
Steps []StepTiming `json:"steps,omitempty"` // Detailed timing of sub-operations
}
StepTiming represents the duration of a labeled sub-operation within an execution.
type Struct ¶
type Struct[T any] struct { Data T // contains filtered or unexported fields }
func (Struct[T]) Description ¶ added in v0.21.0
func (*Struct[T]) DynamicTypes ¶ added in v0.42.0
func (*Struct[T]) Outputs ¶ added in v0.20.0
func (s *Struct[T]) Outputs() map[string]OutputPort
type StructOutput ¶ added in v0.20.0
type StructOutput[T any] struct { // contains filtered or unexported fields }
func (StructOutput[T]) BuildDynamicArrayOutput ¶ added in v0.42.0
func (so StructOutput[T]) BuildDynamicArrayOutput(source DynamicSource) OutputPort
func (StructOutput[T]) BuildDynamicOutput ¶ added in v0.42.0
func (so StructOutput[T]) BuildDynamicOutput(source DynamicSource) OutputPort
func (StructOutput[T]) BuildProxyOutput ¶ added in v0.39.0
func (so StructOutput[T]) BuildProxyOutput(source ProxySource) OutputPort
func (*StructOutput[T]) CaptureError ¶ added in v0.32.0
func (so *StructOutput[T]) CaptureError(err error)
func (*StructOutput[T]) CaptureTiming ¶ added in v0.32.0
func (so *StructOutput[T]) CaptureTiming(title string, timing time.Duration)
func (StructOutput[T]) Description ¶ added in v0.25.0
func (so StructOutput[T]) Description() string
func (StructOutput[T]) ExecutionReport ¶ added in v0.32.0
func (so StructOutput[T]) ExecutionReport() ExecutionReport
The report of executing the output function
func (StructOutput[T]) Name ¶ added in v0.20.0
func (so StructOutput[T]) Name() string
func (StructOutput[T]) Node ¶ added in v0.20.0
func (so StructOutput[T]) Node() Node
func (*StructOutput[T]) Set ¶ added in v0.23.0
func (so *StructOutput[T]) Set(v T)
Set the result of the output
func (StructOutput[T]) Type ¶ added in v0.23.0
func (so StructOutput[T]) Type() string
func (*StructOutput[T]) Value ¶ added in v0.20.0
func (so *StructOutput[T]) Value() T
func (StructOutput[T]) Version ¶ added in v0.23.0
func (so StructOutput[T]) Version() int
type TypeOptions ¶ added in v0.42.0
type TypeOptions interface {
AcceptedTypes() []string
}
type UnsetInputError ¶ added in v0.37.0
type UnsetInputError struct {
Input OutputPort
}
func (UnsetInputError) Error ¶ added in v0.37.0
func (nie UnsetInputError) Error() string
type Value ¶
type Value[T any] struct { VersionData // contains filtered or unexported fields }
func (*Value[T]) Outputs ¶ added in v0.23.0
func (tn *Value[T]) Outputs() map[string]OutputPort
type VersionData ¶
type VersionData struct {
// contains filtered or unexported fields
}
func (*VersionData) Increment ¶
func (v *VersionData) Increment() int
func (VersionData) Version ¶
func (v VersionData) Version() int