component

package
v0.0.0-...-f2d3015 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTwixt

func BuildTwixt(ctx model.SimContext, events []model.EventSource, main TwixtFunc)

BuildTwixt runs a function in an imperative side thread, returning to the simulation on each Yield().

func DataBufferBytes

func DataBufferBytes(ctx model.SimContext, capacity int) (model.DataSourceBytes, model.DataSinkBytes)

func DataPumpBytes

func DataPumpBytes(ctx model.SimContext, source model.DataSourceBytes, sink model.DataSinkBytes)

func DataPumpDirect

func DataPumpDirect(ctx model.SimContext, source model.DataSourceBytes, sink func([]byte))

func MakeMeteredSink

func MakeMeteredSink(ctx model.SimContext, sink model.DataSinkBytes, bytesAllowed int, perInterval time.Duration) model.DataSinkBytes

func TeeDataSinks

func TeeDataSinks(ctx model.SimContext, sinks ...model.DataSinkBytes) model.DataSinkBytes

Types

type CSVByteRecorder

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

func MakeCSVRecorder

func MakeCSVRecorder(sim model.SimContext, path string) *CSVByteRecorder

func MakeNullCSVRecorder

func MakeNullCSVRecorder() *CSVByteRecorder

func (*CSVByteRecorder) IsRecording

func (r *CSVByteRecorder) IsRecording() bool

func (*CSVByteRecorder) Record

func (r *CSVByteRecorder) Record(channel string, dataBytes []byte)

type EventDispatcher

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

func MakeEventDispatcher

func MakeEventDispatcher(ctx model.SimContext, name string) *EventDispatcher

func (*EventDispatcher) Dispatch

func (ed *EventDispatcher) Dispatch()

func (*EventDispatcher) DispatchLater

func (ed *EventDispatcher) DispatchLater()

func (*EventDispatcher) Subscribe

func (ed *EventDispatcher) Subscribe(callback func()) (cancel func())

type NullEventSource

type NullEventSource struct{}

func (NullEventSource) Subscribe

func (ns NullEventSource) Subscribe(callback func()) (cancel func())

type Record

type Record struct {
	Timestamp model.VirtualTime
	Channel   string
	Bytes     []byte
}

func DecodeRecording

func DecodeRecording(path string) (records []Record, re error)

type SimController

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

func MakeSimControllerRandomized

func MakeSimControllerRandomized(startTime model.VirtualTime) *SimController

func MakeSimControllerSeeded

func MakeSimControllerSeeded(seed int64, startTime model.VirtualTime) *SimController

func (*SimController) Advance

func (sc *SimController) Advance(advanceTo model.VirtualTime) (nextTimer model.VirtualTime)

func (*SimController) Later

func (sc *SimController) Later(name string, callback func()) (cancel func())

func (*SimController) Now

func (sc *SimController) Now() model.VirtualTime

func (*SimController) Rand

func (sc *SimController) Rand() *rand.Rand

func (*SimController) SetTimer

func (sc *SimController) SetTimer(expireAt model.VirtualTime, name string, callback func()) (cancel func())

type TwixtFunc

type TwixtFunc func(*TwixtIO)

type TwixtIO

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

func (*TwixtIO) Yield

func (ti *TwixtIO) Yield()

func (*TwixtIO) YieldUntil

func (ti *TwixtIO) YieldUntil(time model.VirtualTime)

func (*TwixtIO) YieldWait

func (ti *TwixtIO) YieldWait(events ...model.EventSource)

Jump to

Keyboard shortcuts

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