Documentation
¶
Index ¶
- func Run(ctx context.Context, prog Program, registry map[string]FuncCreator) error
- type ArrayInport
- type ArrayOutport
- type BoolMsg
- func (msg BoolMsg) Bool() bool
- func (BoolMsg) Dict() map[string]Msg
- func (msg BoolMsg) Equal(other Msg) bool
- func (BoolMsg) Float() float64
- func (BoolMsg) Int() int64
- func (BoolMsg) List() []Msg
- func (msg BoolMsg) MarshalJSON() ([]byte, error)
- func (BoolMsg) Str() string
- func (msg BoolMsg) String() string
- func (BoolMsg) Struct() StructMsg
- type DebugInterceptor
- type DictMsg
- func (DictMsg) Bool() bool
- func (msg DictMsg) Dict() map[string]Msg
- func (msg DictMsg) Equal(other Msg) bool
- func (DictMsg) Float() float64
- func (DictMsg) Int() int64
- func (DictMsg) List() []Msg
- func (msg DictMsg) MarshalJSON() ([]byte, error)
- func (DictMsg) Str() string
- func (msg DictMsg) String() string
- func (DictMsg) Struct() StructMsg
- type FloatMsg
- func (FloatMsg) Bool() bool
- func (FloatMsg) Dict() map[string]Msg
- func (msg FloatMsg) Equal(other Msg) bool
- func (msg FloatMsg) Float() float64
- func (FloatMsg) Int() int64
- func (FloatMsg) List() []Msg
- func (msg FloatMsg) MarshalJSON() ([]byte, error)
- func (FloatMsg) Str() string
- func (msg FloatMsg) String() string
- func (FloatMsg) Struct() StructMsg
- type FuncCall
- type FuncCreator
- type IO
- type Inport
- type Inports
- type IntMsg
- func (IntMsg) Bool() bool
- func (IntMsg) Dict() map[string]Msg
- func (msg IntMsg) Equal(other Msg) bool
- func (IntMsg) Float() float64
- func (msg IntMsg) Int() int64
- func (IntMsg) List() []Msg
- func (msg IntMsg) MarshalJSON() ([]byte, error)
- func (IntMsg) Str() string
- func (msg IntMsg) String() string
- func (IntMsg) Struct() StructMsg
- type Interceptor
- type ListMsg
- func (ListMsg) Bool() bool
- func (ListMsg) Dict() map[string]Msg
- func (msg ListMsg) Equal(other Msg) bool
- func (ListMsg) Float() float64
- func (ListMsg) Int() int64
- func (msg ListMsg) List() []Msg
- func (msg ListMsg) MarshalJSON() ([]byte, error)
- func (ListMsg) Str() string
- func (msg ListMsg) String() string
- func (ListMsg) Struct() StructMsg
- type Msg
- type OrderedMsg
- type Outport
- type Outports
- type PortAddr
- type PortSlotAddr
- type ProdInterceptor
- type Program
- type SelectedMsg
- type SingleInport
- type SingleOutport
- type StringMsg
- func (StringMsg) Bool() bool
- func (StringMsg) Dict() map[string]Msg
- func (msg StringMsg) Equal(other Msg) bool
- func (StringMsg) Float() float64
- func (StringMsg) Int() int64
- func (StringMsg) List() []Msg
- func (msg StringMsg) MarshalJSON() ([]byte, error)
- func (msg StringMsg) Str() string
- func (msg StringMsg) String() string
- func (StringMsg) Struct() StructMsg
- type StructMsg
- func (StructMsg) Bool() bool
- func (StructMsg) Dict() map[string]Msg
- func (msg StructMsg) Equal(other Msg) bool
- func (StructMsg) Float() float64
- func (msg StructMsg) Get(name string) Msg
- func (StructMsg) Int() int64
- func (StructMsg) List() []Msg
- func (msg StructMsg) MarshalJSON() ([]byte, error)
- func (StructMsg) Str() string
- func (msg StructMsg) String() string
- func (msg StructMsg) Struct() StructMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArrayInport ¶ added in v0.25.0
type ArrayInport struct {
// contains filtered or unexported fields
}
func NewArrayInport ¶ added in v0.25.0
func NewArrayInport( chans []<-chan OrderedMsg, addr PortAddr, interceptor Interceptor, ) *ArrayInport
func (ArrayInport) Len ¶ added in v0.25.0
func (a ArrayInport) Len() int
func (ArrayInport) Receive ¶ added in v0.25.0
Receive receives a message from a specific slot of the array inport. It returns the received message and a boolean indicating success. It returns false if the context is done or if the channel is closed.
func (ArrayInport) ReceiveAll ¶ added in v0.26.0
ReceiveAll receives messages from all available array inport slots just once. It returns false if context is done or if the provided function returns false. The function is called for each message received. The function should return false if it wants to stop receiving messages. Functions are called in order of incoming messages, not in order of slots.
func (*ArrayInport) Select ¶ added in v0.26.0
func (a *ArrayInport) Select(ctx context.Context) (SelectedMsg, bool)
Select returns oldest available message across all available array inport slots.
type ArrayOutport ¶ added in v0.25.0
type ArrayOutport struct {
// contains filtered or unexported fields
}
func NewArrayOutport ¶ added in v0.25.0
func NewArrayOutport(addr PortAddr, interceptor Interceptor, slots []chan<- OrderedMsg) *ArrayOutport
func (ArrayOutport) Len ¶ added in v0.25.0
func (a ArrayOutport) Len() int
func (ArrayOutport) SendAll ¶ added in v0.25.0
func (a ArrayOutport) SendAll(ctx context.Context, msg Msg) bool
SendAllV2 sends the same message to all slots of the array outport. It returns false if context is done. It blocks until message is sent to all slots. Slots are not guaranteed to be handled in order, message is sent to first available slot. Each slot is guaranteed to be handled only once. TODO: figure out why this is the only working version of `SendAll`
type BoolMsg ¶
type BoolMsg struct {
// contains filtered or unexported fields
}
func NewBoolMsg ¶
func (BoolMsg) MarshalJSON ¶ added in v0.20.0
type DebugInterceptor ¶ added in v0.26.0
type DebugInterceptor struct {
// contains filtered or unexported fields
}
func NewDebugInterceptor ¶ added in v0.26.0
func NewDebugInterceptor() *DebugInterceptor
func (*DebugInterceptor) Open ¶ added in v0.26.0
func (d *DebugInterceptor) Open(filepath string) (func() error, error)
func (*DebugInterceptor) Received ¶ added in v0.26.0
func (d *DebugInterceptor) Received(receiver PortSlotAddr, msg Msg) Msg
func (*DebugInterceptor) Sent ¶ added in v0.26.0
func (d *DebugInterceptor) Sent(sender PortSlotAddr, msg Msg) Msg
type DictMsg ¶ added in v0.26.0
type DictMsg struct {
// contains filtered or unexported fields
}
Dictionary
func NewDictMsg ¶ added in v0.26.0
func (DictMsg) MarshalJSON ¶ added in v0.26.0
type FloatMsg ¶
type FloatMsg struct {
// contains filtered or unexported fields
}
func NewFloatMsg ¶
func (FloatMsg) MarshalJSON ¶ added in v0.20.0
type Inport ¶ added in v0.26.0
type Inport struct {
// contains filtered or unexported fields
}
func NewInport ¶ added in v0.26.0
func NewInport( array *ArrayInport, single *SingleInport, ) Inport
func (Inport) Array ¶ added in v0.26.0
func (f Inport) Array() *ArrayInport
func (Inport) Single ¶ added in v0.26.0
func (f Inport) Single() *SingleInport
type Inports ¶ added in v0.26.0
type Inports struct {
// contains filtered or unexported fields
}
func NewInports ¶ added in v0.26.0
type IntMsg ¶
type IntMsg struct {
// contains filtered or unexported fields
}
func (IntMsg) MarshalJSON ¶ added in v0.20.0
type Interceptor ¶ added in v0.25.0
type Interceptor interface { Sent(PortSlotAddr, Msg) Msg Received(PortSlotAddr, Msg) Msg }
type ListMsg ¶
type ListMsg struct {
// contains filtered or unexported fields
}
List
func NewListMsg ¶
func (ListMsg) MarshalJSON ¶ added in v0.20.0
type OrderedMsg ¶ added in v0.26.0
type OrderedMsg struct { Msg // contains filtered or unexported fields }
OrderedMsg is a message with a chronological index. Ordered messages can be compared and sorted by their index.
func (OrderedMsg) String ¶ added in v0.26.0
func (o OrderedMsg) String() string
type Outport ¶ added in v0.26.0
type Outport struct {
// contains filtered or unexported fields
}
func NewOutport ¶ added in v0.26.0
func NewOutport( single *SingleOutport, array *ArrayOutport, ) Outport
type Outports ¶ added in v0.26.0
type Outports struct {
// contains filtered or unexported fields
}
func NewOutports ¶ added in v0.26.0
type PortSlotAddr ¶ added in v0.26.0
type ProdInterceptor ¶ added in v0.26.0
type ProdInterceptor struct{}
func (ProdInterceptor) Prepare ¶ added in v0.26.0
func (ProdInterceptor) Prepare() error
func (ProdInterceptor) Received ¶ added in v0.26.0
func (ProdInterceptor) Received(receiver PortSlotAddr, msg Msg) Msg
func (ProdInterceptor) Sent ¶ added in v0.26.0
func (ProdInterceptor) Sent(sender PortSlotAddr, msg Msg) Msg
type Program ¶
type Program struct { // for programmer start is inport and stop is outport, but for runtime it's inverted Start *SingleOutport // Start must be inport of the first function Stop *SingleInport // Stop must be outport of the (one of the) terminator function(s) FuncCalls []FuncCall }
type SelectedMsg ¶ added in v0.26.0
type SelectedMsg struct { OrderedMsg SlotIdx uint8 }
SelectedMsg is a message selected from available messages on all array inport slots.
func (SelectedMsg) String ¶ added in v0.26.0
func (s SelectedMsg) String() string
type SingleInport ¶ added in v0.25.0
type SingleInport struct {
// contains filtered or unexported fields
}
func NewSingleInport ¶ added in v0.25.0
func NewSingleInport( ch <-chan OrderedMsg, addr PortAddr, interceptor Interceptor, ) *SingleInport
type SingleOutport ¶ added in v0.25.0
type SingleOutport struct {
// contains filtered or unexported fields
}
func NewSingleOutport ¶ added in v0.25.0
func NewSingleOutport( addr PortAddr, interceptor Interceptor, ch chan<- OrderedMsg, ) *SingleOutport
type StringMsg ¶ added in v0.26.0
type StringMsg struct {
// contains filtered or unexported fields
}
func NewStringMsg ¶ added in v0.26.0
func (StringMsg) MarshalJSON ¶ added in v0.26.0
type StructMsg ¶ added in v0.26.0
type StructMsg struct {
// contains filtered or unexported fields
}
Structure
func NewStructMsg ¶ added in v0.26.0
func (StructMsg) Get ¶ added in v0.26.0
Get returns the value of a field by name. It panics if the field is not found. It uses binary search to find the field, assuming the names are sorted.