pces

package module
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: MIT Imports: 19 Imported by: 4

README

Patterned Computation Evaluation Simulator

pces

The pces package (Patterned Computation Evaluation Simulator) is used to model applications that execute on a mrnes network model. At the most basic level, an application is compromised of elements (called ‘functions’) that receive messages, execute some computation based on the message and its source, and optionally send messages in response to other functions. pces model syntax defines the topological structure of these applications (called “Computational Patterns”), describes how messages flow between functions, the function’s individual states, and references methods embedded in the simulator that are called to modify those states as messages are processed.

A foundational principle for pces models is that the simulation time associated with the execution of a function come from a look-up table that holds multiple measurements of that execution time on different CPUs, and under other model dependent parameters (e.g. number of bytes in a message being processed by the function). Another foundational principle is that pces allow for a large degree of flexibility and specialization in modeling the behavior of modeled software that calls these measured functions. It does so by organizing the flow of control of a simulation at a level of abstraction and through an API that allows for different ‘class’ dependent behavior of functions. Control of function behavior with associated virtual time delays explicitly supports representation of the impact of queuing and contention for processor and communication network resources, so that evaluation of pces models can capture the impact of congestion at different levels of the system.

mrnes and pces models are built using the discrete-event simulation paradigm, and use functionality given by the vrtime, evtq, and evtm packages. The models are explicitly event-oriented (as opposed to “process” oriented models that use discrete-event formulations under the covers, not explicitly viewable by the modeler). The simulation clock uses 64 bit integers for time ’ticks’, and 64 bit integers for tie- breaking events whose number of clock ticks are precisely the same. The vrtime package allows one to define the time duration of a tick to be whatever time-scale is of interest to the modeler; for our models of computer and communications activities we typically define a tick to represent 1/10 of a nanosecond.

pces directory

The pces simulator reads various files to prepare for and execute a simulation experiment. Those files are in .json or .yaml format that are read in and converted to Golang structs at simulator start-up. We describe below the role of methods and data structures found in various files in the MrNesbits package.

Files used as part of model-building

The files below have methods that are typically called to either build pces models, or read from file descriptions of models that have been built.

  • desc-cp.go . This file holds definitions of those structs related to Computational Patterns and their initializations. It contains methods used by the simulator to read in those structs, and also contains methods that a separate external Golang program can use to build and store examples of those structs for specific classes of pces models.
  • desc-map.go . Prior to model execution, its functions have to be mapped to processors in the declared architecture model. This file holds structs and methods that support creation and access to these mappings.
  • desc-params.go . pces supports a rich syntax for describing parameter values (e.g. the bandwidth of interfaces) to a model description before a simulation run. This file contains structs and methods that are used for that purpose.
  • desc-timing.go . This file holds definition of structs that specify identities of computation functions and their execution timing as a function of the underlaying hardware platform and ‘packet length’ associated with the data being operated on. The file contains methods for creating these structs from an external Golang program, and methods used by the simulator to read those structs in from file.
Files used as part of model-execution
  • class.go . mrnesbit func belong to ‘classes’ with pre-defined structs and methods used in the simulated execution of those functions. This file contains the structs, other data structures, methods, and event handling routines for all of the pre-declared classes.
  • cpf.go . The pces internals represent its functions through a type it calls a CmpPtnFuncInst (Computation Pattern Function Instance). This file defines this type and methods involved in initializing and simulating the execution of func instances.
  • cpg.go . pces funcs are organized within so-called ‘Computation Patterns’, instances of which are represented by type CmpPtnInst, and which are fundamentally a graph whose nodes are CmpPtnFuncInsts, and whose edges describe possible communications between them. This file contains structs and methods that support construction and traversal through computation patterns.
  • pces.go . Methods in this file are called by the root simulation program to read in the simulation model descriptions, and support interactions with the mrnes package.
  • trace.go . Methods and data structures in this file support generation and storage of traces gathered at run-time.

Copyright 2024 Board of Trustees of the University of Illinois. See the license for details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Batch int = 1
View Source
var ClassMethods map[string]map[string]RespMethod = make(map[string]map[string]RespMethod)

ClassMethods maps the function class name to a map indexed by (string) operation code to get to a pair of functions to handle the entry and exit to the function

View Source
var ClassMethodsBuilt bool = CreateClassMethods()
View Source
var CmpPtnFuncInstByID map[int]*CmpPtnFuncInst = make(map[int]*CmpPtnFuncInst)
View Source
var CmpPtnInstByID map[int]*CmpPtnInst = make(map[int]*CmpPtnInst)
View Source
var CmpPtnInstByName map[string]*CmpPtnInst = make(map[string]*CmpPtnInst)

CmpPtnInstByName and CmpPtnInstByID take the the name (alt., id) of an instance of a CompPattern, and associate a pointer to its struct

View Source
var ExprmntName string
View Source
var ExprmntsFile string
View Source
var FuncClassNames map[string]bool = map[string]bool{

	"measure":     true,
	"processPckt": true,
	"srvRsp":      true,
	"srvReq":      true,
	"transfer":    true,
	"start":       true,
	"finish":      true,
	"bckgrndLd":   true}

FuncClassNames needs to have an indexing key for every class of function that might be included in a model. Map exists just for checking validity of a function class name when building a model. Any new class introduced in this file needs to have an entry placed in this dictionary.

View Source
var FuncClasses map[string]FuncClassCfg = make(map[string]FuncClassCfg)

FuncClasses is a map that takes us from the name of a FuncClass

View Source
var GlobalSeed int64 = 1234567

HndlrMap maps a string name for an event handling function to the function itself

View Source
var MsrGrpByID map[uint32]*MsrGroup = make(map[uint32]*MsrGroup)
View Source
var MsrID2Name map[int]string = make(map[int]string)
View Source
var MsrRouteByExecID map[int]*MsrRoute = make(map[int]*MsrRoute)
View Source
var MsrVerbose bool
View Source
var NumExecThreads int = 1

NumExecThreads is used to place a unique integer code on every newly created initiation message

View Source
var NumIDs int = 0

NumIDs holds value that utility function used for generating unique integer ids on demand

View Source
var Samples int = 0
View Source
var Skip int = 0
View Source
var TimeUnits string

Functions

func AccelFuncExecTime added in v0.0.12

func AccelFuncExecTime(cpfi *CmpPtnFuncInst, accelname, op string, msg *CmpPtnMsg) float64

AccelFuncExecTime returns the execution time for the operation given on the accelerator model given as input

func AddCPTrace added in v0.0.12

func AddCPTrace(tm *mrnes.TraceManager, flag bool, vrt vrtime.Time, execID int, objID int, op string, cpm *CmpPtnMsg)

AddCPTrace creates a record of the trace using its calling arguments, and stores it

func AddClassMethod added in v0.0.12

func AddClassMethod(className string, methodName string, rm RespMethod)

func AddHndlrMap added in v0.0.12

func AddHndlrMap(name string, hndlr evtm.EventHandlerFunction)

AddHndlrMap includes a new association between string and event handler

func BuildExperimentCP

func BuildExperimentCP(syn map[string]string, useYAML bool, idCounter int, tm *mrnes.TraceManager, evtMgr *evtm.EventManager) error

BuildExperimentCP is called from the module that creates and runs a simulation. Its inputs identify the names of input files, which it uses to assemble and initialize the model (and experiment) data structures. It returns a pointer to an EventManager data structure used to coordinate the execution of events in the simulation.

func CheckDirectories

func CheckDirectories(dirs []string) (bool, error)

CheckDirectories probes the file system for the existence of every directory listed in the list of files. Returns a boolean indicating whether all dirs are valid, and returns an aggregated error if any checks failed.

func CheckFiles

func CheckFiles(names []string, checkExistence bool) (bool, error)

CheckFiles probes the file system for permitted access to all the argument filenames, optionally checking also for the existence of those files for the purposes of reading them.

func CheckOutputFiles

func CheckOutputFiles(names []string) (bool, error)

CheckOutputFiles probles the file system to ensure that every argument filename can be written.

func CheckReadableFiles

func CheckReadableFiles(names []string) (bool, error)

CheckReadableFiles probles the file system to ensure that every one of the argument filenames exists and is readable

func CmpPtnFuncHost

func CmpPtnFuncHost(cpfi *CmpPtnFuncInst) string

func CmpPtnFuncInstHost

func CmpPtnFuncInstHost(cpfi *CmpPtnFuncInst) string

CmpPtnFuncInstHost returns the name of the host to which the CmpPtnFuncInst given as argument is mapped.

func CmpPtnFuncPriority added in v0.0.12

func CmpPtnFuncPriority(cpfi *CmpPtnFuncInst) int

func ComputeMsrGrpHash added in v0.0.21

func ComputeMsrGrpHash(msrName string, visits []int) uint32

func ContinueBuildExperimentCP added in v0.0.12

func ContinueBuildExperimentCP(cpd *CompPatternDict, cpid *CPInitListDict,
	fel *FuncExecList, cpmd *CompPatternMapDict, syn map[string]string,
	idCounter int, tm *mrnes.TraceManager, evtMgr *evtm.EventManager) error

func CreateClassMethods

func CreateClassMethods() bool

CreateClassMethods fills in the ClassMethods table for each of the defined function classes

func CreateMsrRoute added in v0.0.21

func CreateMsrRoute(msrName string, execID int)

func CreateNewClass added in v0.0.12

func CreateNewClass(className string)

func EmptyEnterFunc added in v0.0.12

func EmptyEnterFunc(evtMgr *evtm.EventManager, cpti *CmpPtnFuncInst, data string, cpm *CmpPtnMsg)

EmptyEnterFunc exists to fill in the ClassMethods table

func EmptyInitFunc

func EmptyInitFunc(evtMgr *evtm.EventManager, cpFunc any, cpMsg any) any

EmptyInitFunc exists to detect when there is actually an initialization event handler (by having a 'emptyInitFunc' below be re-written to point to something else

func EndRecExec

func EndRecExec(execID int, time float64) float64

EndRecExec computes the completed execution time of the execution identified, given the ending time, incorporates its statistics into the CmpPtnInst statistics summary

func EnterFunc

func EnterFunc(evtMgr *evtm.EventManager, cpFunc any, cpMsg any) any

EnterFunc is an event-handling routine, scheduled by an evtm.EventManager to execute and simulate the results of a message arrival to a CmpPtnInst function. The particular CmpPtnInst and particular message are given as arguments to the function. A type-unspecified return is provided.

func ExitFunc

func ExitFunc(evtMgr *evtm.EventManager, cpFunc any, cpMsg any) any

ExitFunc is an event handling routine that implements the scheduling of messages which result from the completed (simulated) execution of a CmpPtnFuncInst. The CmpPtnFuncInst and the message that triggered the execution are given as arguments to ExitFunc. This routine calls the CmpPtnFuncInst's function that computes the effect of doing the simulation, a routine which (by the CmpPtnFuncInst interface definition) returns a slice of CmpPtnMsgs which are then pushed further along the CompPattern chain.

func FullFuncName added in v0.0.20

func FullFuncName(cpfi *CmpPtnFuncInst, methodName string) string

func GetExperimentCPDicts

func GetExperimentCPDicts(syn map[string]string) (*CompPatternDict, *CPInitListDict,
	*FuncExecList, *CompPatternMapDict)

GetExperimentCPDicts accepts a map that holds the names of the input files used to define an experiment, creates internal representations of the information they hold, and returns those structs.

func HostFuncExecTime added in v0.0.12

func HostFuncExecTime(cpfi *CmpPtnFuncInst, op string, msg *CmpPtnMsg) float64

HostFuncExecTime returns the execution time for the operation given on the endpoint to which the cpfi is mapped

func IntToByteArray added in v0.0.21

func IntToByteArray(i int) []byte

func LostCmpPtnMsg

func LostCmpPtnMsg(evtMgr *evtm.EventManager, context any, msg any) any

LostCmpPtnMsg is scheduled from the mrnes side to report the loss of a comp pattern message

func MsrAppendID added in v0.0.21

func MsrAppendID(execID int, ID int)

func ReEnter

func ReEnter(evtMgr *evtm.EventManager, cpFunc any, rtnmsg any) any

func ReadSimArgs added in v0.0.14

func ReadSimArgs() (*cmdline.CmdParser, *evtm.EventManager)

ReadSimArgs defines the command line parameters expected, and reads them

func RegisterFuncClass

func RegisterFuncClass(fc FuncClassCfg) bool

RegisterFuncClass is called to tell the system that a particular function class exists, and gives a point to its description. The idea is to register only those function classes actually used, or at least, provide clear separation between classes. Reflect of bool allows call to RegisterFuncClass as part of a variable assignment outside of a function body

func ReportErrs

func ReportErrs(errs []error) error

ReportErrs transforms a list of errors and transforms the non-nil ones into a single error with comma-separated report of all the constituent errors, and returns it.

func ReportStatistics

func ReportStatistics()

func ReturnParamsDict added in v0.0.21

func ReturnParamsDict(exprFileName string, exprName string) map[string]string

func RunExperiment added in v0.0.14

func RunExperiment(expCntrl evtm.EventHandlerFunction, expCmplt evtm.EventHandlerFunction)

func SaveMeasureCSV added in v0.0.21

func SaveMeasureCSV(dataFile string, hdr, values []string) []string

SaveMeasureCSV constructs a csv representation of a measurement

func UpdateMsg

func UpdateMsg(msg *CmpPtnMsg, nxtCPID int, nxtLabel, msgType string)

UpdateMsg copies the pattern, label coordinates of the message's current position to be the previous one and labels the next coordinates with the values given as arguments

Types

type BckgrndLdCfg added in v0.0.20

type BckgrndLdCfg struct {
	BckgrndFunc string   `yaml:"bckgrndfunc" json:"bckgrndfunc"`
	BckgrndRate float64  `yaml:"bckgrndrate" json:"bckgrndrate"`
	BckgrndSrv  float64  `yaml:"bckgrndsrv" json:"bckgrndsrv"`
	Groups      []string `yaml:"groups" json:"groups"`
	Trace       string   `yaml:"trace" json:"trace"`
}

func ClassCreateBckgrndLdCfg added in v0.0.12

func ClassCreateBckgrndLdCfg() *BckgrndLdCfg

func (*BckgrndLdCfg) CreateCfg added in v0.0.20

func (bgld *BckgrndLdCfg) CreateCfg(cfgStr string) any

func (*BckgrndLdCfg) Deserialize added in v0.0.20

func (bgld *BckgrndLdCfg) Deserialize(fss string, useYAML bool) (any, error)

Deserialize recovers a serialized representation of a bckgrndLd structure

func (*BckgrndLdCfg) FuncClassName added in v0.0.20

func (bgld *BckgrndLdCfg) FuncClassName() string

func (*BckgrndLdCfg) InitCfg added in v0.0.20

func (bgld *BckgrndLdCfg) InitCfg(evtMgr *evtm.EventManager, cpfi *CmpPtnFuncInst, cfgStr string, useYAML bool)

func (*BckgrndLdCfg) Serialize added in v0.0.20

func (bgld *BckgrndLdCfg) Serialize(useYAML bool) (string, error)

Serialize transforms the bckgrndLd into string form for inclusion through a file

func (*BckgrndLdCfg) ValidateCfg added in v0.0.20

func (bgld *BckgrndLdCfg) ValidateCfg(cpfi *CmpPtnFuncInst) error

type BckgrndLdState added in v0.0.20

type BckgrndLdState struct {
	Calls   int
	Bespoke any
}

type CPEndpt added in v0.0.12

type CPEndpt struct {
	CPID  int
	Label string
}

type CPEntry added in v0.0.12

type CPEntry struct {
	CPID    int
	Label   string
	MsgType string
}

type CPInitList

type CPInitList struct {
	// name of the Computation Pattern whose Funcs are being initialized
	Name string `json:"name" yaml:"name"`

	// CPType of CP being initialized
	CPType string `json:"cptype" yaml:"cptype"`

	// UseYAML flags whether to interpret the seriaized initialization structure using json or yaml
	UseYAML bool `json:"useyaml" yaml:"useyaml"`

	// Cfg is indexed by Func label, mapping to a serialized representation of a struct
	Cfg map[string]string `json:"cfg" yaml:"cfg"`

	// Msgs holds a list of CompPatternMsgs used between Funcs in a CompPattern
	Msgs []CompPatternMsg `json:"msgs" yaml:"msgs"`
}

CPInitList describes configuration parameters for the Funcs of a CompPattern

func CreateCPInitList

func CreateCPInitList(name string, cptype string, useYAML bool) *CPInitList

CreateCPInitList constructs a CPInitList for an instance of a CompPattern and initializes it with a name and flag indicating whether YAML is used

func ReadCPInitList

func ReadCPInitList(filename string, useYAML bool, dict []byte) (*CPInitList, error)

ReadCPInitList returns a deserialized slice of bytes into a CPInitList. Bytes are either provided, or are read from a file whose name is given.

func (*CPInitList) AddCfg added in v0.0.5

func (cpil *CPInitList) AddCfg(cpt *CompPattern, fnc *Func, cfg string)

AddCfg puts a serialized initialization struct in the dictionary indexed by Func label

func (*CPInitList) AddMsg

func (cpil *CPInitList) AddMsg(msg *CompPatternMsg) error

AddMsg appends description of a ComPatternMsg to the CPInitList's slice of messages used by the CompPattern. An error is returned if the msg's type already exists in the Msgs list

func (*CPInitList) DeepCopy

func (cpil *CPInitList) DeepCopy() *CPInitList

DeepCopy creates a copy of CPInitList that explicitly copies various complex data structures

func (*CPInitList) WriteToFile

func (cpil *CPInitList) WriteToFile(filename string) error

WriteToFile serializes the CPInitList and writes it to a file. Output file extension identifies whether serialization is to json or to yaml

type CPInitListDict

type CPInitListDict struct {
	DictName string `json:"dictname" yaml:"dictname"`

	// indexed by name of comp pattern
	InitList map[string]CPInitList `json:"initlist" yaml:"initlist"`
}

CPInitListDict holds CPInitList structures in a dictionary that may hold prebuilt versions (in which case InitList is indexed by CompPattern type) or is holding init lists for CPs to be part of an experiment, so the CP name is known is used as the key

func CreateCPInitListDict

func CreateCPInitListDict(name string) *CPInitListDict

CreateCPInitListDict is an initialization constructor. Its output struct has methods for integrating data.

func ReadCPInitListDict

func ReadCPInitListDict(filename string, useYAML bool, dict []byte) (*CPInitListDict, error)

ReadCPInitListDict deserializes a slice of bytes and returns a CPInitListDict. Bytes are either provided, or are read from a file whose name is given.

func (*CPInitListDict) AddCPInitList

func (cpild *CPInitListDict) AddCPInitList(cpil *CPInitList) error

AddCPInitList puts a CPInitList into the dictionary

func (*CPInitListDict) RecoverCPInitList

func (cpild *CPInitListDict) RecoverCPInitList(cptype string, cpname string) (*CPInitList, bool)

RecoverCPInitList returns a copy of a CPInitList from the dictionary

func (*CPInitListDict) WriteToFile

func (cpild *CPInitListDict) WriteToFile(filename string) error

WriteToFile serializes the CPInitListDict and writes it to a file. Output file extension identifies whether serialization is to json or to yaml

type CPTrace added in v0.0.12

type CPTrace struct {
	Time     float64 // time in float64
	Ticks    int64   // ticks variable of time
	Priority int64   // priority field of time-stamp
	ExecID   int     // integer identifier identifying the chain of traces this is part of
	ObjID    int     // integer id for object being referenced
	Op       string  // "start", "stop", "enter", "exit"
	CPM      string  // serialization of CmpPtnMsg
}

CPTrace saves information about the visitation of a message to some point in the computation pattern portion of the simulation. saved for post-run analysis

func (*CPTrace) Serialize added in v0.0.12

func (cpt *CPTrace) Serialize() string

func (*CPTrace) TraceType added in v0.0.12

func (cpt *CPTrace) TraceType() mrnes.TraceRecordType

type CmpPtnFuncInst

type CmpPtnFuncInst struct {
	AuxFunc     evtm.EventHandlerFunction
	Class       string             // specifier leading to specific state, entrance, and exit functions
	Label       string             // an identifier for this func, unique within the instance of CompPattern holding it.
	Host        string             // identity of the host to which this func is mapped for execution
	SharedGroup string             // empty means state not shared, otherwise global name of group with shared state
	PtnName     string             // name of the instantiated CompPattern holding this function
	CPID        int                // id of the comp pattern this func is attached to
	ID          int                // integer identity which is unique among all objects in the pces model
	Trace       bool               // indicate whether this function should record its enter/exit in the trace
	Measure     bool               // If true start device-to-device measurement
	IsService   bool               // when a service the processing does not depend on the CP asking for a response
	PrevEdge    map[int]edgeStruct // saved selection edge
	Priority    int                // scheduling priority
	Cfg         any                // holds string-coded state for string-code configuratin variable names
	State       any                // holds string-coded state for string-code state variable names

	// OutEdges is a list of edgeStructs
	OutEdges []edgeStruct

	// input message type to method code
	Msg2MC map[string]string

	// output message type to index in OutEdges
	Msg2Idx map[string]int

	// list of user-defined groups
	Groups []string

	// RespMethods are indexed by method code.
	// A Respond method holds a pointer to a function to call when processing
	// an input with the given response method, and a function to schedule
	// when the method has completed.
	RespMethods map[string]*RespMethod

	// MsgResp maps a thread's execID to a list of computation pattern messages
	MsgResp map[int][]*CmpPtnMsg
}

The CmpPtnFuncInst struct represents an instantiated instance of a function

func (*CmpPtnFuncInst) AddEndMethod

func (cpfi *CmpPtnFuncInst) AddEndMethod(methodCode string, end evtm.EventHandlerFunction) bool

AddEndMethod includes a customized End method to a previously defined respMethod

func (*CmpPtnFuncInst) AddResponse

func (cpfi *CmpPtnFuncInst) AddResponse(execID int, resp []*CmpPtnMsg)

AddResponse stores the selected out message response from executing the function, to be released later. Saving through cpfi.Resp[execID] to account for concurrent overlapping executions

func (*CmpPtnFuncInst) AddStartMethod

func (cpfi *CmpPtnFuncInst) AddStartMethod(methodCode string, start StartMethod) bool

AddStartMethod associates a string response 'name' with a pair of methods used to represent the start and end of the function's execution. The default method for the end method is ExitFunc Return of bool allows call to RegisterFuncClass as part of a variable assignment outside of a function body

func (*CmpPtnFuncInst) GlobalName

func (cpfi *CmpPtnFuncInst) GlobalName() string

type CmpPtnGraph

type CmpPtnGraph struct {

	// every instance a function has a string 'label', used here to index to
	// data structure that describes it and the connections it has with other funcs
	Nodes map[string]*CmpPtnGraphNode
}

A CmpPtnGraph is the run-time description of a CompPattern

type CmpPtnGraphEdge

type CmpPtnGraphEdge struct {
	SrcLabel string
	MsgType  string
	DstLabel string
}

CmpPtnGraphEdge declares the possibility that a function with label srcLabel might send a message of type msgType to the function (in the same CPG) with label dstLabel

func CreateCmpPtnGraphEdge

func CreateCmpPtnGraphEdge(srcLabel, msgType, dstLabel string) *CmpPtnGraphEdge

func (*CmpPtnGraphEdge) EdgeStr

func (cpge *CmpPtnGraphEdge) EdgeStr() string

type CmpPtnGraphNode

type CmpPtnGraphNode struct {
	Label    string
	InEdges  []*CmpPtnGraphEdge
	OutEdges []*CmpPtnGraphEdge
}

A CmpPtnGraphNode names a function with its label, and describes the edges for which it is a destination (inEdges) and edges for which it is a source (outEdges)

type CmpPtnInst

type CmpPtnInst struct {
	Name         string // this instance's particular name
	CpType       string
	ID           int                          // unique id
	Funcs        map[string]*CmpPtnFuncInst   // use func label to get to func in that pattern with that label
	FuncsByGroup map[string][]*CmpPtnFuncInst // index is group name, list of functions in the CmpPtn belonging to that group
	Services     map[string]funcDesc          // map an offered service (e.g., "auth", "encrypt", "hash") to a function label
	Msgs         map[string]CompPatternMsg    // MsgType indexes msgs
	Rngs         *rngstream.RngStream
	Graph        *CmpPtnGraph                      // graph describing structure of funcs and edges
	Active       map[int]execRecord                // executions that are active now
	ActiveCnt    map[int]int                       // number of instances of executions with common execID (>1 by branching)
	LostExec     map[int]evtm.EventHandlerFunction // call this handler when a packet for a given execID is lost
	Finished     map[string]execSummary            // summary of completed executions
}

CmpPtnInst describes a particular instance of a CompPattern, built from information read in from CompPatternDesc struct and used at runtime

func (*CmpPtnInst) AddFuncToGroup added in v0.0.20

func (cpi *CmpPtnInst) AddFuncToGroup(cpfi *CmpPtnFuncInst, groupName string)

func (*CmpPtnInst) ExecReport

func (cpi *CmpPtnInst) ExecReport() []float64

ExecReport reports delay times of completed cmpPtnInst executions

type CmpPtnMsg

type CmpPtnMsg struct {
	ExecID    int    // initialize when with an initating comp pattern message.  Carried by every resulting message.
	FlowID    int    // identity of flow when message involves flows
	ClassID   int    // identity of transportation class when message hits network
	MeasureID int    // when carrying a measure, the identity of that measure
	PrevCPID  int    // ID of the comp pattern through which the message most recently passed
	PrevLabel string // label of the func through which the message most recently passed

	XCPID    int    // cross-CP id
	XLabel   string // cross-CP label
	XMsgType string // cross-CP message type
	CPID     int    // identity of the destination comp pattern
	Label    string // label of the destination function

	MsgType string // describes function of message
	MsgLen  int    // number of bytes

	MsrSrtID int // if of measurement function ID that started measurememnt

	StartMsr float64 // time when measurement started

	RtnCPID    int    // used on service calls
	RtnLabel   string // used on service calls
	RtnMsgType string

	PcktLen    int     // parameter impacting execution time
	Rate       float64 // when non-zero, a rate limiting attribute that might used, e.g., in modeling IO
	FlowState  string  // "srt", "end", "chg"
	NetLatency float64
	NetBndwdth float64
	NetPrLoss  float64
	Payload    any // free for "something else" to carry along and be used in decision logic
}

A CmpPtnMsg struct describes a message going from one CompPattern function to another. It carries ancillary information about the message that is included for referencing.

func AdvanceMsg added in v0.0.20

func AdvanceMsg(cpfi *CmpPtnFuncInst, msg *CmpPtnMsg, msgTypeOut string) *CmpPtnMsg

func (*CmpPtnMsg) CarriesPckt added in v0.0.6

func (cpm *CmpPtnMsg) CarriesPckt() bool

CarriesPckt indicates whether the message conveys information about a packet or a flow

func (*CmpPtnMsg) Populate added in v0.0.12

func (cpm *CmpPtnMsg) Populate(execID, flowID, classID int, rate float64, msgLen int, flowState string)

func (*CmpPtnMsg) Serialize added in v0.0.12

func (cpm *CmpPtnMsg) Serialize() string

type CmpPtnMsgTrace added in v0.0.12

type CmpPtnMsgTrace struct {
	ExecID int // initialize when with an initating comp pattern message.  Carried by every resulting message.

	NxtLabel string // string label of the function the message next visits

	MsgType   string // describes function of message
	MsgLen    int    // number of bytes
	PcktLen   int    // parameter impacting execution time
	FlowState string // "srt", "end", "chg"
}

type CompPattern

type CompPattern struct {
	// a model may use a number of instances of CompPatterns that have the same CPType
	CPType string `json:"cptype" yaml:"cptype"`

	// per-instance name of the pattern template
	Name string `json:"name" yaml:"name"`

	// instances of functions indexed by unique-to-pattern label
	Funcs []Func `json:"funcs" yaml:"funcs"`

	Services map[string]funcDesc `json:"services" yaml:"services"`

	// description of edges in Pattern graph
	Edges []CmpPtnGraphEdge `json:"edges" yaml:"edges"`

	// description of external edges in Pattern graph
	ExtEdges []XCPEdge `json:"extedges" yaml:"extedges"`
}

CompPattern is a directed graph that describes the data flow among functions that implement an end-to-end computation

func CreateCompPattern

func CreateCompPattern(cmptnType string) *CompPattern

CreateCompPattern is an initialization constructor. Its output struct has methods for integrating data.

func (*CompPattern) AddEdge

func (cpt *CompPattern) AddEdge(srcFuncLabel, dstFuncLabel string, msgType string,
	msgs *[]CompPatternMsg)

AddEdge creates an edge that describes message flow from one Func to another in the same comp pattern and adds it to the CompPattern's list of edges. Called from code that is building a model, applies some sanity checking

func (*CompPattern) AddExtEdge

func (cpt *CompPattern) AddExtEdge(srcCP, dstCP, srcLabel, dstLabel string, msgType string,
	srcMsgs *[]CompPatternMsg, dstMsgs *[]CompPatternMsg)

AddExtEdge creates an edge that describes message flow from one Func to another in a different computational pattern and adds it to the CompPattern's list of external edges. Perform some sanity checks before commiting the edge

func (*CompPattern) AddFunc

func (cpt *CompPattern) AddFunc(fs *Func)

AddFunc includes a function specification to a CompPattern

func (*CompPattern) AddService added in v0.0.12

func (cpt *CompPattern) AddService(srvName, srvFunc string)

AddService includes a function specification to a CompPattern

func (*CompPattern) DeepCopy

func (cpt *CompPattern) DeepCopy() *CompPattern

DeepCopy creates a copy of CompPattern that explicitly copies various complex data structures

func (*CompPattern) SetName

func (cpt *CompPattern) SetName(name string)

SetName copies the given name to be the CmpPtn's attribute and saves the name -> CmpPtn mapping in cmptnByName

type CompPatternDict

type CompPatternDict struct {
	DictName string                 `json:"dictname" yaml:"dictname"`
	Patterns map[string]CompPattern `json:"patterns" yaml:"patterns"`
}

CompPatternDict holds pattern descriptions, is serializable

func CreateCompPatternDict

func CreateCompPatternDict(name string) *CompPatternDict

CreateCompPatternDict is an initialization constructor. Its output struct has methods for integrating data.

func ReadCompPatternDict

func ReadCompPatternDict(filename string, useYAML bool, dict []byte) (*CompPatternDict, error)

ReadCompPatternDict returns the transformation of a slice of bytes into a CompPatternDict, reading these from file if necessary.

func (*CompPatternDict) AddCompPattern

func (cpd *CompPatternDict) AddCompPattern(ptn *CompPattern) error

AddCompPattern amends a CompPattern dictionary with another CompPattern. The prb flag indicates this is saved to a 'pre-built' dictionary from which selected CompPatterns are recovered when building a model. CP names are not created until build time, so the key used to read/write a CompPattern from the Patterns dictionary is the CompPattern cptype when accessing a prb dictionary, and the name otherwise so the CP type is used as a key when true, otherwise the CP name is known and used. If requested, and error is returned if the comp pattern being added is a duplicate.

func (*CompPatternDict) RecoverCompPattern

func (cpd *CompPatternDict) RecoverCompPattern(cptype string, cpname string) (*CompPattern, bool)

RecoverCompPattern returns a copy of a CompPattern from the dictionary, indexing by type, and applying a name

func (*CompPatternDict) WriteToFile

func (cpd *CompPatternDict) WriteToFile(filename string) error

WriteToFile serializes the comp pattern, and saves to the named file. Output file extension determines whether serialization is to json or yaml

type CompPatternMap

type CompPatternMap struct {
	// PatternName identifies the name of the pattern instantiation being mapped
	PatternName string `json:"patternname" yaml:"patternname"`

	// mapping of func labels to hosts. Key is Label attribute of Func
	FuncMap map[string]string `json:"funcmap" yaml:"funcmap"`
}

A CompPatternMap describes how funcs in an instantiated CompPattern are mapped to hosts

func CreateCompPatternMap

func CreateCompPatternMap(ptnName string) *CompPatternMap

CreateCompPatternMap is a constructor.

func ReadCompPatternMap

func ReadCompPatternMap(filename string, useYAML bool, dict []byte) (*CompPatternMap, error)

ReadCompPatternMap deserializes a byte slice holding a representation of an CompPatternMap struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.

func (*CompPatternMap) AddMapping

func (cpm *CompPatternMap) AddMapping(funcLabel string, hostname string, priority float64, overwrite bool) error

AddMapping inserts into the CompPatternMap a binding of Func label to a host. Optionally, an error might be returned if a binding of that Func has already been made, and is different.

func (*CompPatternMap) WriteToFile

func (cpm *CompPatternMap) WriteToFile(filename string) error

WriteToFile stores the CompPatternMap struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.

type CompPatternMapDict

type CompPatternMapDict struct {
	DictName string                    `json:"dictname" yaml:"dictname"`
	Map      map[string]CompPatternMap `json:"map" yaml:"map"`
}

A CompPatternMapDict holds copies of CompPatternMap structs in a map that is indexed by the PatternName of resident CompPatternMaps

var CmpPtnMapDict *CompPatternMapDict

func CreateCompPatternMapDict

func CreateCompPatternMapDict(name string) *CompPatternMapDict

CreateCompPatternMapDict is a constructor. Saves the dictionary name and initializes the map of CompPatternMaps to-be-stored.

func ReadCompPatternMapDict

func ReadCompPatternMapDict(filename string, useYAML bool, dict []byte) (*CompPatternMapDict, error)

ReadCompPatternMapDict deserializes a byte slice holding a representation of an CompPatternMapDict struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.

func (*CompPatternMapDict) AddCompPatternMap

func (cpmd *CompPatternMapDict) AddCompPatternMap(cpm *CompPatternMap, overwrite bool) error

AddCompPatternMap includes in the dictionary a CompPatternMap that is provided as input. Optionally an error may be returned if an entry for the associated CompPattern exists already.

func (*CompPatternMapDict) RecoverCompPatternMap

func (cpmd *CompPatternMapDict) RecoverCompPatternMap(pattern string) (*CompPatternMap, bool)

RecoverCompPatternMap returns a CompPatternMap associated with the CompPattern named in the input parameters. It returns also a flag denoting whether the identified CompPattern has an entry in the dictionary.

func (*CompPatternMapDict) WriteToFile

func (cpmd *CompPatternMapDict) WriteToFile(filename string) error

WriteToFile stores the CompPatternMapDict struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.

type CompPatternMsg

type CompPatternMsg struct {
	// edges in the CompPattern graph are labeled with MsgType, which means that a message across the edge must match in this attribute
	MsgType string `json:"msgtype" yaml:"msgtype"`

	// a message may be a packet or a flow
	IsPckt bool `json:"ispckt" yaml:"ispckt"`
}

CompPatternMsg defines the structure of identification of messages that pass between Funcs in a CompPattern. Structures of this sort are transformed by a simulation run into a form that include experiment-defined payloads, and so representation of payload is absent here,

func CreateCompPatternMsg

func CreateCompPatternMsg(msgType string, isPckt bool) *CompPatternMsg

CreateCompPatternMsg is a constructer.

type EndPtFuncs added in v0.0.5

type EndPtFuncs struct {
	Srt CPEndpt
	End CPEndpt
}

EndPtFuncs carries information on a CmpPtnMsg about where the execution thread started, and where it ultimately is headed

type ExtCmpPtnGraphEdge

type ExtCmpPtnGraphEdge struct {
	SrcCP string
	DstCP string
	CPGE  CmpPtnGraphEdge
}

type FinishCfg added in v0.0.12

type FinishCfg struct {
	Msg2MC   map[string]string `yaml:"msg2mc" json:"msg2mc"`
	Data     string            `yaml:"data"  json:"data"`
	Continue int               `yaml:"continue" json:"continue"`
	Groups   []string          `yaml:"groups" json:"groups"`
	Trace    string            `yaml:"trace" json:"trace"`
}

func ClassCreateFinishCfg added in v0.0.5

func ClassCreateFinishCfg() *FinishCfg

func (*FinishCfg) CfgStr added in v0.0.12

func (fnsh *FinishCfg) CfgStr() string

func (*FinishCfg) CreateCfg added in v0.0.12

func (fnsh *FinishCfg) CreateCfg(cfgStr string) any

func (*FinishCfg) Deserialize added in v0.0.12

func (fnsh *FinishCfg) Deserialize(fss string, useYAML bool) (any, error)

Deserialize recovers a serialized representation of a finish structure

func (*FinishCfg) FuncClassName added in v0.0.12

func (fnsh *FinishCfg) FuncClassName() string

func (*FinishCfg) InitCfg added in v0.0.12

func (fnsh *FinishCfg) InitCfg(evtMgr *evtm.EventManager, cpfi *CmpPtnFuncInst, cfgStr string, useYAML bool)

func (*FinishCfg) Serialize added in v0.0.12

func (fnsh *FinishCfg) Serialize(useYAML bool) (string, error)

Serialize transforms the finish into string form for inclusion through a file

func (*FinishCfg) ValidateCfg added in v0.0.12

func (fnsh *FinishCfg) ValidateCfg(cpfi *CmpPtnFuncInst) error

type FinishState added in v0.0.20

type FinishState struct {
	Calls   int
	Bespoke any
}

type Func

type Func struct {
	// identifies function, e.g., encryptRSA, used to look up execution time
	Class string `json:"class" yaml:"class"`

	// particular name given to function instance within a CompPattern
	Label string `json:"label" yaml:"label"`
}

A Func represents a function used within a CompPattern. Its 'Label' attribute is an identifier for an instance of the Func that is unique among all Funcs that make up a CompPattern which uses it, and the Class attribute is an identifier used when Func describes are stored in a dictionary before being copied and assembled as part of CompPattern construction. Class typically describes the computation the Func represents.

func CreateFunc

func CreateFunc(class, funcLabel string) *Func

CreateFunc is a constructor for a Func. All parameters are given:

  • Class, a string identifying what instances of this Func do. Like a variable type.
  • FuncLabel, a unique identifier (within an instance of a CompPattern) of an instance of this Func

type FuncClassCfg added in v0.0.5

type FuncClassCfg interface {
	FuncClassName() string
	CreateCfg(string) any
	InitCfg(*evtm.EventManager, *CmpPtnFuncInst, string, bool)
	ValidateCfg(*CmpPtnFuncInst) error
}

FuncClassCfg represents the methods used to simulate the effect of executing a function, different types of input generate different types of responses, so we use a map whose key selects the start, end pair of methods

type FuncExecDesc

type FuncExecDesc struct {
	Identifier string  `json:"identifier" yaml:"identifier"`
	Param      string  `json:"param" yaml:"param"`
	CPUModel   string  `json:"cpumodel" yaml:"cpumodel"`
	PcktLen    int     `json:"pcktlen" yaml:"pcktlen"`
	ExecTime   float64 `json:"exectime" yaml:"exectime"`
}

A FuncExecDesc struct holds a description of a function timing. ExecTime is the time (in seconds), attributes it depends on are

 Identifier - a unique name for this func call
 Param - additional information, e.g., key length for crypto
	CPUModel - the CPU,
	PcktLen  - number of bytes in data packet being operated on

type FuncExecList

type FuncExecList struct {
	// ListName is an identifier for this collection of timings
	ListName string `json:"listname" yaml:"listname"`

	// Times key is an identifier for the function.
	// Value is list of function times for that type of function
	Times map[string][]FuncExecDesc `json:"times" yaml:"times"`
}

A FuncExecList holds a map (Times) whose key is the class of a Func, and whose value is a list of FuncExecDescs associated with all Funcs of that class

func CreateFuncExecList

func CreateFuncExecList(listname string) *FuncExecList

CreateFuncExecList is an initialization constructor. Its output struct has methods for integrating data.

func ReadFuncExecList

func ReadFuncExecList(filename string, useYAML bool, dict []byte) (*FuncExecList, error)

ReadFuncExecList deserializes a byte slice holding a representation of an FuncExecList struct. If the input argument of dict (those bytes) is empty, the file whose name is given is read to acquire them. A deserialized representation is returned, or an error if one is generated from a file read or the deserialization.

func (*FuncExecList) AddTiming

func (fel *FuncExecList) AddTiming(identifier, param, cpumodel string,
	pcktLen int, execTime float64)

AddTiming takes the parameters of a FuncExecDesc, creates one, and adds it to the FuncExecList

func (*FuncExecList) WriteToFile

func (fel *FuncExecList) WriteToFile(filename string) error

WriteToFile stores the FuncExecList struct to the file whose name is given. Serialization to json or to yaml is selected based on the extension of this name.

type GlobalFuncID added in v0.0.5

type GlobalFuncID struct {
	CmpPtnName string
	Label      string
}

GlobalFuncID is a global identifier for a function, naming the CmpPtn that holds it and its label within that CmpPtn

type InEdge

type InEdge struct {
	SrcLabel string `json:"srclabel" yaml:"srclabel"`
	MsgType  string `json:"msgtype" yaml:"msgtype"`
}

An InEdge describes the source Func of an incoming edge, the type of message it carries, and the method code flagging what code should execute as a result

type MeasureCfg added in v0.0.12

type MeasureCfg struct {
	MsrName string            `yaml:"msrname" json:"msrname"`
	MsrOp   string            `yaml:"msrop" json:"msrop"`
	Msg2MC  map[string]string `yaml:"msg2mc" json:"msg2mc"`
	Groups  []string          `yaml:"groups" json:"groups"`
	Trace   string            `yaml:"trace" json:"trace"`
}

func ClassCreateMeasureCfg added in v0.0.12

func ClassCreateMeasureCfg() *MeasureCfg

func (*MeasureCfg) CfgStr added in v0.0.12

func (measure *MeasureCfg) CfgStr() string

func (*MeasureCfg) CreateCfg added in v0.0.12

func (measure *MeasureCfg) CreateCfg(cfgStr string) any

func (*MeasureCfg) Deserialize added in v0.0.12

func (measure *MeasureCfg) Deserialize(fss string, useYAML bool) (any, error)

Deserialize recovers a serialized representation of a measure structure

func (*MeasureCfg) FuncClassName added in v0.0.12

func (measure *MeasureCfg) FuncClassName() string

func (*MeasureCfg) InitCfg added in v0.0.12

func (measure *MeasureCfg) InitCfg(evtMgr *evtm.EventManager, cpfi *CmpPtnFuncInst, cfgStr string, useYAML bool)

func (*MeasureCfg) Populate added in v0.0.12

func (measure *MeasureCfg) Populate(name string, pcktlen int, msglen int, start bool, op string, trace bool)

func (*MeasureCfg) Serialize added in v0.0.12

func (measure *MeasureCfg) Serialize(useYAML bool) (string, error)

Serialize transforms the measure into string form for inclusion through a file

func (*MeasureCfg) ValidateCfg added in v0.0.12

func (measure *MeasureCfg) ValidateCfg(cpfi *CmpPtnFuncInst) error

type MeasureState added in v0.0.20

type MeasureState struct {
	Calls    int
	Classify func([]int) string
	Bespoke  any
}

type Measurement added in v0.0.21

type Measurement struct {
	StartMsr float64 // simulation time when measurement started
	Value    float64 // measurement
	MsrName  string  // measurement name
}

Measurement holds a floating point measurement, and the time when the measurement was started

type MsrData added in v0.0.12

type MsrData struct {
	ExprmntName string
	Params      map[string]string
	GroupDesc   string
	GroupType   string
	MsrAgg      bool
	Sum         float64
	SqrSum      float64
	N           int
	Measures    []string
}

MsrData holds the information from an MsrGroup, plus more, in a data structure suitable for serialization

type MsrGroup added in v0.0.21

type MsrGroup struct {
	GroupDesc string        // text description of the group
	GroupType string        // one of the constants Latency, Bndwdth, PrLoss
	MsrAgg    bool          // aggregate additions or not
	ID        uint32        // index for identity
	Sum       float64       // sum of all entities
	SqrSum    float64       // sum of square of each entity
	N         int           // number of samples included
	Measures  []Measurement // list of measurements observed
}

MsrGroup holds observations that are in a common class, defined by the user.

func CreateMsrGroup added in v0.0.21

func CreateMsrGroup(desc string, groupType string, msrAgg bool) *MsrGroup

CreateMsrGroup establishes a struct that holds a description of a group of measurements, and the measurements themselves

func GetMsrGrp added in v0.0.21

func GetMsrGrp(msrName string, execID int, msrType string, msrAgg bool, classify func([]int) string) *MsrGroup

func (*MsrGroup) AddCSVData added in v0.0.21

func (msrg *MsrGroup) AddCSVData(csvFileName, exprmntName string, data []string) []string

AddCSVData puts in one or more data rows to the csv file output

func (*MsrGroup) AddMeasure added in v0.0.21

func (msrg *MsrGroup) AddMeasure(startMsr, measure float64, msrName string)

AddMeasure creates a new Measurement and adds it to the MsrGroup

func (*MsrGroup) CreateMsrData added in v0.0.21

func (msrg *MsrGroup) CreateMsrData(exprmntName string) *MsrData

CreateMsrData takes the MsrGroup data and puts it into a form suitable for serialization

func (*MsrGroup) MsrRange added in v0.0.21

func (msrg *MsrGroup) MsrRange() (int, []float64)

MsrRange returns the min, 25% percentile, median, 75% percentile, and maximum value of data in the group

func (*MsrGroup) MsrStats added in v0.0.21

func (msrg *MsrGroup) MsrStats(batchmeans bool) (int, float64, float64)

MsrStats computes the mean and variance over the data in the MsrGroup. The mean may be computed by batch-means, batch size given, and the number of initial samples to skip to avoid initialization bias

func (*MsrGroup) PrepCSVRow added in v0.0.21

func (msrg *MsrGroup) PrepCSVRow(csvFileName string, expFileName string,
	exprmntName string, hdr []string, data []string, rType string) []string

type MsrRoute added in v0.0.21

type MsrRoute struct {
	MsrName string
	Visited []int
}

type NetSimPortal

type NetSimPortal interface {
	HostCPU(string) string
	EnterNetwork(*evtm.EventManager, string, string, int, int, float64, any,
		any, evtm.EventHandlerFunction, any, evtm.EventHandlerFunction) any
}

NetSimPortal provides an interface to network simulator in the mrnes package. mrnes does not import pces (to avoid circular imports). However, code in pces can call a function in mrnes that returns a pointer to a structure that satisfies the NetSimPortal interface.

type OutEdge

type OutEdge struct {
	MsgType  string `json:"msgtype" yaml:"msgtype"`
	DstLabel string `json:"dstlabel" yaml:"dstlabel"`
}

An OutEdge describes the destination Func of an outbound edge, and the type of message it carries.

type ProcessPcktCfg added in v0.0.20

type ProcessPcktCfg struct {
	// map method code to an operation for the timing lookup
	TimingCode map[string]string `yaml:"timingcode" json:"timingcode"`
	Msg2MC     map[string]string `yaml:"msg2mc" json:"msg2mc"`
	Msg2Msg    map[string]string `yaml:"msg2msg" json:"msg2msg"`

	// if the packet is processed through an accelerator, its name in the destination endpoint
	AccelName string   `yaml:"accelname" json:"accelname"`
	Groups    []string `yaml:"groups" json:"groups"`
	Trace     string   `yaml:"trace" json:"trace"`
}

func ClassCreateProcessPcktCfg added in v0.0.5

func ClassCreateProcessPcktCfg() *ProcessPcktCfg

ClassCreateProcessPcktCfg is a constructor called just to create an instance, fields unimportant

func (*ProcessPcktCfg) CfgStr added in v0.0.20

func (pp *ProcessPcktCfg) CfgStr() string

func (*ProcessPcktCfg) CreateCfg added in v0.0.20

func (pp *ProcessPcktCfg) CreateCfg(cfgStr string) any

func (*ProcessPcktCfg) Deserialize added in v0.0.20

func (pp *ProcessPcktCfg) Deserialize(fss string, useYAML bool) (any, error)

Deserialize recovers a serialized representation of a processPckt structure

func (*ProcessPcktCfg) FuncClassName added in v0.0.20

func (pp *ProcessPcktCfg) FuncClassName() string

func (*ProcessPcktCfg) InitCfg added in v0.0.20

func (pp *ProcessPcktCfg) InitCfg(evtMgr *evtm.EventManager, cpfi *CmpPtnFuncInst, cfgStr string, useYAML bool)

func (*ProcessPcktCfg) Serialize added in v0.0.20

func (pp *ProcessPcktCfg) Serialize(useYAML bool) (string, error)

Serialize transforms the processPckt into string form for inclusion through a file

func (*ProcessPcktCfg) ValidateCfg added in v0.0.20

func (pp *ProcessPcktCfg) ValidateCfg(cpfi *CmpPtnFuncInst) error

type ProcessPcktState added in v0.0.20

type ProcessPcktState struct {
	MsgTypeIn string
	Bespoke   any
	Calls     int
}

type RespMethod

type RespMethod struct {
	Start StartMethod
	End   evtm.EventHandlerFunction
}

RespMethod associates two RespFunc that implement a function's response, one when it starts, the other when it ends

type SharedCfgGroup added in v0.0.5

type SharedCfgGroup struct {
	Name      string         // give a name to this shared cfg group
	Class     string         // all members have to be in the same class
	Instances []GlobalFuncID // slice identifying the representations that share cfg
	CfgStr    string         // the configuration they share, used at initialization
}

SharedCfgGroup gathers descriptions of functions that share the same cfg information, even across CmpPtn boundaries

func CreateSharedCfgGroup added in v0.0.5

func CreateSharedCfgGroup(name string, class string) *SharedCfgGroup

CreateSharedCfgGroup is a constructor

func (*SharedCfgGroup) AddCfg added in v0.0.5

func (ssg *SharedCfgGroup) AddCfg(cfgStr string)

AddCfg gives a shared cfg group a serialized common cfg

func (*SharedCfgGroup) AddInstance added in v0.0.5

func (ssg *SharedCfgGroup) AddInstance(cmpPtnName, label string)

AddInstance appends a global function description to a shared cfg group, but makes sure that it does not exist already in that group

type SharedCfgGroupList added in v0.0.5

type SharedCfgGroupList struct {
	// UseYAML flags whether to interpret the seriaized cfg using json or yaml
	UseYAML bool             `json:"useyaml" yaml:"useyaml"`
	Groups  []SharedCfgGroup `json:"groups" yaml:"groups"`
}

SharedCfgGroupList holds all the shared cfg groups defined, for inclusion in a shared cfg description file

func CreateSharedCfgGroupList added in v0.0.5

func CreateSharedCfgGroupList(yaml bool) *SharedCfgGroupList

CreateSharedCfgGroupList is a constructor

func ReadSharedCfgGroupList added in v0.0.5

func ReadSharedCfgGroupList(filename string, useYAML bool, dict []byte) (*SharedCfgGroupList, error)

ReadSharedCfgGroupList returns a deserialized slice of bytes into a SharedCfgGroupList. Bytes are either provided, or are read from a file whose name is given.

func (*SharedCfgGroupList) AddSharedCfgGroup added in v0.0.5

func (scgl *SharedCfgGroupList) AddSharedCfgGroup(ssg *SharedCfgGroup)

AddSharedCfgGroup includes an offered cfg group the the list, but checks that there is not already one there with the same name and class

func (*SharedCfgGroupList) WriteToFile added in v0.0.5

func (scgl *SharedCfgGroupList) WriteToFile(filename string) error

WriteToFile serializes the SharedCfgGroupList and writes it to a file. Output file extension identifies whether serialization is to json or to yaml

type SrvReqCfg added in v0.0.20

type SrvReqCfg struct {
	// map the service request to the message type on departure
	Bypass   string            `yaml:"bypass" json:"bypass"`
	SrvCP    string            `yaml:"srvcp" json:"srvcp"`
	SrvOp    string            `yaml:"srvop" json:"srvop"`
	RspOp    string            `yaml:"rspop" json:"rspop"`
	SrvLabel string            `yaml:"srvlabel" json:"srvlabel"`
	Msg2MC   map[string]string `yaml:"msg2mc" json:"msg2mc"`
	Msg2Msg  map[string]string `yaml:"op2msg" json:"op2msg"`
	Groups   []string          `yaml:"groups" json:"groups"`
	Trace    string            `yaml:"trace" json:"trace"`
}

func ClassCreateSrvReqCfg added in v0.0.12

func ClassCreateSrvReqCfg() *SrvReqCfg

func (*SrvReqCfg) CfgStr added in v0.0.20

func (srvReq *SrvReqCfg) CfgStr() string

func (*SrvReqCfg) CreateCfg added in v0.0.20

func (srvReq *SrvReqCfg) CreateCfg(cfgStr string) any

func (*SrvReqCfg) Deserialize added in v0.0.20

func (srvReq *SrvReqCfg) Deserialize(fss string, useYAML bool) (any, error)

Deserialize recovers a serialized representation of a srvReq structure

func (*SrvReqCfg) FuncClassName added in v0.0.20

func (srvReq *SrvReqCfg) FuncClassName() string

func (*SrvReqCfg) InitCfg added in v0.0.20

func (srvReq *SrvReqCfg) InitCfg(evtMgr *evtm.EventManager, cpfi *CmpPtnFuncInst, cfgStr string, useYAML bool)

func (*SrvReqCfg) Populate added in v0.0.20

func (srvReq *SrvReqCfg) Populate(bypass bool, trace bool)

func (*SrvReqCfg) Serialize added in v0.0.20

func (srvReq *SrvReqCfg) Serialize(useYAML bool) (string, error)

Serialize transforms the srvReq into string form for inclusion through a file

func (*SrvReqCfg) ValidateCfg added in v0.0.20

func (srvReq *SrvReqCfg) ValidateCfg(cpfi *CmpPtnFuncInst) error

type SrvReqState added in v0.0.20

type SrvReqState struct {
	RspEdgeIdx int    // index of edge pointing to service response function
	MsgTypeIn  string // type of message on receipt
	Calls      int
	Bespoke    any
}

type SrvRspCfg added in v0.0.20

type SrvRspCfg struct {
	// chosen op, for timing
	TimingCode   map[string]string `yaml:"timingcode" json:"timingcode"`
	Msg2MC       map[string]string `yaml:"msg2mc" json:"msg2mc"`
	DirectPrefix []string          `yaml:"directprefix" json:"directprefix"`
	Groups       []string          `yaml:"groups" json:"groups"`
	Trace        string            `yaml:"trace" json:"trace"`
}

func ClassCreateSrvRspCfg added in v0.0.12

func ClassCreateSrvRspCfg() *SrvRspCfg

func (*SrvRspCfg) CfgStr added in v0.0.20

func (srvRsp *SrvRspCfg) CfgStr() string

func (*SrvRspCfg) CreateCfg added in v0.0.20

func (srvRsp *SrvRspCfg) CreateCfg(cfgStr string) any

func (*SrvRspCfg) Deserialize added in v0.0.20

func (srvRsp *SrvRspCfg) Deserialize(fss string, useYAML bool) (any, error)

Deserialize recovers a serialized representation of a srvRsp structure

func (*SrvRspCfg) FuncClassName added in v0.0.20

func (srvRsp *SrvRspCfg) FuncClassName() string

func (*SrvRspCfg) InitCfg added in v0.0.20

func (srvRsp *SrvRspCfg) InitCfg(evtMgr *evtm.EventManager, cpfi *CmpPtnFuncInst, cfgStr string, useYAML bool)

func (*SrvRspCfg) Populate added in v0.0.20

func (srvRsp *SrvRspCfg) Populate(tc map[string]string, trace bool)

func (*SrvRspCfg) Serialize added in v0.0.20

func (srvRsp *SrvRspCfg) Serialize(useYAML bool) (string, error)

Serialize transforms the srvRsp into string form for inclusion through a file

func (*SrvRspCfg) ValidateCfg added in v0.0.20

func (srvRsp *SrvRspCfg) ValidateCfg(cpfi *CmpPtnFuncInst) error

type SrvRspState added in v0.0.20

type SrvRspState struct {
	Calls   int
	Bespoke any
}

type StartCfg added in v0.0.12

type StartCfg struct {
	PcktLen   string            `yaml:"pcktlen" json:"pcktlen"`
	MsgLen    string            `yaml:"msglen" json:"msglen"`
	MsgType   string            `yaml:"msgtype" json:"msgtype"`
	Data      string            `yaml:"data" json:"data"`
	StartTime string            `yaml:"starttime" json:"starttime"`
	Msg2MC    map[string]string `yaml:"msg2mc" json:"msg2mc"`
	Groups    []string          `yaml:"groups" json:"groups"`
	Trace     string            `yaml:"trace" json:"trace"`
}

func ClassCreateStartCfg added in v0.0.12

func ClassCreateStartCfg() *StartCfg

func (*StartCfg) CfgStr added in v0.0.12

func (srt *StartCfg) CfgStr() string

func (*StartCfg) CreateCfg added in v0.0.12

func (srt *StartCfg) CreateCfg(cfgStr string) any

func (*StartCfg) Deserialize added in v0.0.12

func (srt *StartCfg) Deserialize(fss string, useYAML bool) (any, error)

Deserialize recovers a serialized representation of a start structure

func (*StartCfg) FuncClassName added in v0.0.12

func (srt *StartCfg) FuncClassName() string

func (*StartCfg) InitCfg added in v0.0.12

func (srt *StartCfg) InitCfg(evtMgr *evtm.EventManager, cpfi *CmpPtnFuncInst, cfgStr string, useYAML bool)

func (*StartCfg) Serialize added in v0.0.12

func (srt *StartCfg) Serialize(useYAML bool) (string, error)

Serialize transforms the start into string form for inclusion through a file

func (*StartCfg) ValidateCfg added in v0.0.12

func (srt *StartCfg) ValidateCfg(cpfi *CmpPtnFuncInst) error

type StartMethod

type StartMethod func(*evtm.EventManager, *CmpPtnFuncInst, string, *CmpPtnMsg)

StartMethod gives the signature of functions called to implement a function's entry point

type StartState added in v0.0.20

type StartState struct {
	PcktLen   int
	MsgLen    int
	MsgType   string
	StartTime float64
	Calls     int
	Bespoke   any
}

type TransferCfg added in v0.0.20

type TransferCfg struct {
	Carried  string            `yaml:"carried" json:"carried"`   // message carries xCPID, xLabel
	XCP      string            `yaml:"xcp" json:"xcp"`           // CmpPtn name of destination
	XLabel   string            `yaml:"xlabel" json:"xlabel"`     // function label at destination
	XMsgType string            `yaml:"xmsgtype" json:"xmsgtype"` // function label at destination
	Msg2MC   map[string]string `yaml:"msg2mc" json:"msg2mc"`
	Groups   []string          `yaml:"groups" json:"groups"`
	Trace    string            `yaml:"trace" json:"trace"`
}

func ClassCreateTransferCfg added in v0.0.12

func ClassCreateTransferCfg() *TransferCfg

func (*TransferCfg) CfgStr added in v0.0.20

func (trnsfr *TransferCfg) CfgStr() string

func (*TransferCfg) CreateCfg added in v0.0.20

func (trnsfr *TransferCfg) CreateCfg(cfgStr string) any

func (*TransferCfg) Deserialize added in v0.0.20

func (trnsfr *TransferCfg) Deserialize(fss string, useYAML bool) (any, error)

Deserialize recovers a serialized representation of a transfer structure

func (*TransferCfg) FuncClassName added in v0.0.20

func (trnsfr *TransferCfg) FuncClassName() string

func (*TransferCfg) InitCfg added in v0.0.20

func (trnsfr *TransferCfg) InitCfg(evtMgr *evtm.EventManager, cpfi *CmpPtnFuncInst, cfgStr string, useYAML bool)

func (*TransferCfg) Populate added in v0.0.20

func (trnsfr *TransferCfg) Populate(carried bool, xcp string, xlabel string, trace bool)

func (*TransferCfg) Serialize added in v0.0.20

func (trnsfr *TransferCfg) Serialize(useYAML bool) (string, error)

Serialize transforms the transfer into string form for inclusion through a file

func (*TransferCfg) ValidateCfg added in v0.0.20

func (trnsfr *TransferCfg) ValidateCfg(cpfi *CmpPtnFuncInst) error

type TransferState added in v0.0.20

type TransferState struct {
	Carried bool
	Calls   int
	Bespoke any
}

type XCPEdge

type XCPEdge struct {
	SrcCP    string
	DstCP    string
	SrcLabel string
	DstLabel string
	MsgType  string
}

XCPEdge describes an edge between different CmpPtns.

These are always rooted in a function of the chgCP class,

where they are organized in a map whose index is the ultimate target CP for a message. The attribute is an XCPEdge, which specifies (a) the identity of the next CmpPtn, (b) the identity of the function to receive the message, (c) the type of the X-CP message, and (d) the methodCode for the function method to be executed. Note that this structure limits one XCPEdge per chgCP instance per target CP.

Jump to

Keyboard shortcuts

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