wfmodel

package
v1.1.12 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageTypeDataBatch             = 1
	MessageTypeShutown               = 101 // pass processor_id
	MessageTypeSetLoggingLevel       = 102 // pass processor_id and logging level
	MessageTypeCancelProcessInstance = 103 // Pass process id and process instance
)

Message types, payload depends on it

View Source
const DependencyNodeEventTableName string = "e"
View Source
const LogTsFormatQuoted = `"2006-01-02T15:04:05.000-0700"`
View Source
const PrintTableDelimiter = "/"
View Source
const TableNameBatchHistory = "wf_batch_history"
View Source
const TableNameNodeHistory = "wf_node_history"
View Source
const TableNameRunAffectedNodes = "wf_run_affected_nodes"
View Source
const TableNameRunCounter = "wf_run_counter"
View Source
const TableNameRunHistory = "wf_run_history"
View Source
const WfmodelNamespace string = "wfmodel"

Variables

This section is empty.

Functions

func BatchHistoryEventAllFields added in v1.1.0

func BatchHistoryEventAllFields() []string

func GetCreateTableCql

func GetCreateTableCql(t reflect.Type, keyspace string, tableName string) string

func GetObjectModelFieldFormats

func GetObjectModelFieldFormats(t reflect.Type) []string

GetObjectModelFieldFormats - helper to get formats for each field of an object model

func GetSpacedHeader

func GetSpacedHeader(n interface{}) string

GetSpacedHeader - prints formatted struct field names, uses reflection, shoud not be used in prod

func NewVarsFromDepCtx

func NewVarsFromDepCtx(runId int16, e DependencyNodeEvent) eval.VarValuesMap

func NodeHistoryEventAllFields added in v1.1.0

func NodeHistoryEventAllFields() []string

func ReadInt16FromRow

func ReadInt16FromRow(fieldName string, r map[string]interface{}) (int16, error)

func ReadInt64FromRow

func ReadInt64FromRow(fieldName string, r map[string]interface{}) (int64, error)

func ReadStringFromRow

func ReadStringFromRow(fieldName string, r map[string]interface{}) (string, error)

func ReadTimeFromRow

func ReadTimeFromRow(fieldName string, r map[string]interface{}) (time.Time, error)

func RunHistoryEventAllFields added in v1.1.0

func RunHistoryEventAllFields() []string

func RunPropertiesAllFields added in v1.1.0

func RunPropertiesAllFields() []string

Types

type BatchHistoryEvent added in v1.1.0

type BatchHistoryEvent struct {
	Ts           time.Time           `header:"ts" format:"%-33v" column:"ts" type:"timestamp" json:"ts"`
	RunId        int16               `header:"run_id" format:"%6d" column:"run_id" type:"int" key:"true" json:"run_id"`
	ScriptNode   string              `header:"script_node" format:"%20v" column:"script_node" type:"text" key:"true" json:"script_node"`
	BatchIdx     int16               `header:"bnum" format:"%5v" column:"batch_idx" type:"int" key:"true" json:"batch_idx"`
	BatchesTotal int16               `header:"tbtchs" format:"%6v" column:"batches_total" type:"int" json:"batches_total"`
	Status       NodeBatchStatusType `header:"sts" format:"%3v" column:"status" type:"tinyint" key:"true" json:"status"`
	FirstToken   int64               `header:"ftoken" format:"%21v" column:"first_token" type:"bigint" json:"first_token"`
	LastToken    int64               `header:"ltoken" format:"%21v" column:"last_token" type:"bigint" json:"last_token"`
	Instance     string              `header:"instance" format:"%21v" column:"instance" type:"text" json:"instance"`
	Thread       int64               `header:"thread" format:"%4v" column:"thread" type:"bigint" json:"thread"`
	Comment      string              `header:"comment" format:"%v" column:"comment" type:"text" json:"comment"`
}

Object model with tags that allow to create cql CREATE TABLE queries and to print object

func NewBatchHistoryEventFromMap added in v1.1.0

func NewBatchHistoryEventFromMap(r map[string]interface{}, fields []string) (*BatchHistoryEvent, error)

func (BatchHistoryEvent) ToSpacedString added in v1.1.0

func (n BatchHistoryEvent) ToSpacedString() string

ToSpacedString - prints formatted field values, uses reflection, shoud not be used in prod

type DependencyNodeEvent

type DependencyNodeEvent struct {
	RunId          int16
	RunIsCurrent   bool
	RunStartTs     time.Time
	RunFinalStatus RunStatusType
	RunCompletedTs time.Time
	RunStoppedTs   time.Time
	NodeIsStarted  bool
	NodeStartTs    time.Time
	NodeStatus     NodeBatchStatusType
	NodeStatusTs   time.Time
	SortKey        string
}

func (*DependencyNodeEvent) ToString

func (e *DependencyNodeEvent) ToString() string

func (*DependencyNodeEvent) ToVars

type DependencyNodeEvents

type DependencyNodeEvents []DependencyNodeEvent

func (DependencyNodeEvents) ToString

func (events DependencyNodeEvents) ToString() string

type Message

type Message struct {
	Ts          int64       `json:"ts"`
	MessageType int         `json:"message_type"`
	Payload     interface{} `json:"payload"` // This depends on MessageType
}

Message - carries data and signals to processors/nodes 1. No version support. Premature optimization is the root of all evil. 2. Used for data transfer and for control signals. 3. For faster de/serialization, consider custom parser not involving reflection 4. Timestamps are int (not uint) because Unix epoch is int

func (*Message) Deserialize

func (msg *Message) Deserialize(jsonBytes []byte) error

func (Message) Serialize

func (msg Message) Serialize() ([]byte, error)

func (Message) ToString

func (msg Message) ToString() string

type MessagePayloadComment

type MessagePayloadComment struct {
	Comment string `json:"comment"`
}

MessagePayloadComment - generic paylod Comment - unstructured, can be anything, like information about the sender of the signal

type MessagePayloadDataBatch

type MessagePayloadDataBatch struct {
	ScriptURI       string `json:"script_uri"`
	ScriptParamsURI string `json:"script_params_uri"`
	DataKeyspace    string `json:"data_keyspace"` // Instance/process id
	RunId           int16  `json:"run_id"`
	TargetNodeName  string `json:"target_node"`
	FirstToken      int64  `json:"first_token"`
	LastToken       int64  `json:"last_token"`
	BatchIdx        int16  `json:"batch_idx"`
	BatchesTotal    int16  `json:"batches_total"`
}

func (*MessagePayloadDataBatch) Deserialize

func (dc *MessagePayloadDataBatch) Deserialize(jsonBytes []byte) error

func (*MessagePayloadDataBatch) FullBatchId

func (dc *MessagePayloadDataBatch) FullBatchId() string

func (MessagePayloadDataBatch) Serialize

func (dc MessagePayloadDataBatch) Serialize() ([]byte, error)

func (*MessagePayloadDataBatch) ToString

func (dc *MessagePayloadDataBatch) ToString() string

type NodeBatchStatusType

type NodeBatchStatusType int8
const (
	NodeBatchNone            NodeBatchStatusType = 0
	NodeBatchStart           NodeBatchStatusType = 1
	NodeBatchSuccess         NodeBatchStatusType = 2
	NodeBatchFail            NodeBatchStatusType = 3 // Biz logicerror or data tble (not WF) error
	NodeBatchRunStopReceived NodeBatchStatusType = 104
)

In priority order

const (
	NodehNone           NodeBatchStatusType = 0
	NodeStart           NodeBatchStatusType = 1
	NodeSuccess         NodeBatchStatusType = 2
	NodeFail            NodeBatchStatusType = 3
	NodeRunStopReceived NodeBatchStatusType = 104
)

func ReadNodeBatchStatusFromRow

func ReadNodeBatchStatusFromRow(fieldName string, r map[string]interface{}) (NodeBatchStatusType, error)

func (NodeBatchStatusType) ToString

func (status NodeBatchStatusType) ToString() string

type NodeHistoryEvent added in v1.1.0

type NodeHistoryEvent struct {
	Ts         time.Time           `header:"ts" format:"%-33v" column:"ts" type:"timestamp" json:"ts"`
	RunId      int16               `header:"run_id" format:"%6d" column:"run_id" type:"int" key:"true" json:"run_id"`
	ScriptNode string              `header:"script_node" format:"%20v" column:"script_node" type:"text" key:"true" json:"script_node"`
	Status     NodeBatchStatusType `header:"sts" format:"%3v" column:"status" type:"tinyint" key:"true" json:"status"`
	Comment    string              `header:"comment" format:"%v" column:"comment" type:"text" json:"comment"`
}

Object model with tags that allow to create cql CREATE TABLE queries and to print object

func NewNodeHistoryEventFromMap added in v1.1.0

func NewNodeHistoryEventFromMap(r map[string]interface{}, fields []string) (*NodeHistoryEvent, error)

func (NodeHistoryEvent) ToSpacedString added in v1.1.0

func (n NodeHistoryEvent) ToSpacedString() string

ToSpacedString - prints formatted field values, uses reflection, shoud not be used in prod

type NodeLifespan

type NodeLifespan struct {
	StartTs      time.Time
	LastStatus   NodeBatchStatusType
	LastStatusTs time.Time
}

func (NodeLifespan) ToString

func (ls NodeLifespan) ToString() string

type NodeLifespanMap

type NodeLifespanMap map[string]*NodeLifespan

func (NodeLifespanMap) ToString

func (m NodeLifespanMap) ToString() string

type NodeRunBatchStatusMap

type NodeRunBatchStatusMap map[string]RunBatchStatusMap

func (NodeRunBatchStatusMap) ToString

func (m NodeRunBatchStatusMap) ToString() string

type NodeStatusMap

type NodeStatusMap map[string]NodeBatchStatusType

func (NodeStatusMap) ToString

func (m NodeStatusMap) ToString() string

type NodeStatusType

type NodeStatusType int8

type RunBatchStatusMap

type RunBatchStatusMap map[int16]NodeBatchStatusType

func (RunBatchStatusMap) ToString

func (m RunBatchStatusMap) ToString() string

type RunCounter

type RunCounter struct {
	Keyspace int `header:"ks" format:"%20s" column:"ks" type:"text" key:"true"`
	LastRun  int `header:"lr" format:"%3d" column:"last_run" type:"int"`
}

Object model with tags that allow to create cql CREATE TABLE queries and to print object

type RunHistoryEvent added in v1.1.0

type RunHistoryEvent struct {
	Ts      time.Time     `header:"ts" format:"%-33v" column:"ts" type:"timestamp" json:"ts"`
	RunId   int16         `header:"run_id" format:"%6d" column:"run_id" type:"int" key:"true" json:"run_id"`
	Status  RunStatusType `header:"sts" format:"%3v" column:"status" type:"tinyint" key:"true" json:"status"`
	Comment string        `header:"comment" format:"%v" column:"comment" type:"text" json:"comment"`
}

Object model with tags that allow to create cql CREATE TABLE queries and to print object

func NewRunHistoryEventFromMap added in v1.1.0

func NewRunHistoryEventFromMap(r map[string]interface{}, fields []string) (*RunHistoryEvent, error)

func (RunHistoryEvent) ToSpacedString added in v1.1.0

func (n RunHistoryEvent) ToSpacedString() string

ToSpacedString - prints formatted field values, uses reflection, shoud not be used in prod

type RunLifespan

type RunLifespan struct {
	RunId            int16         `json:"run_id"`
	StartTs          time.Time     `json:"start_ts"`
	StartComment     string        `json:"start_comment"`
	FinalStatus      RunStatusType `json:"final_status"`
	CompletedTs      time.Time     `json:"completed_ts"`
	CompletedComment string        `json:"completed_comment"`
	StoppedTs        time.Time     `json:"stopped_ts"`
	StoppedComment   string        `json:"stopped_comment"`
}

func (RunLifespan) ToString

func (ls RunLifespan) ToString() string

type RunLifespanMap

type RunLifespanMap map[int16]*RunLifespan

func (RunLifespanMap) ToString

func (m RunLifespanMap) ToString() string

type RunNodeLifespanMap

type RunNodeLifespanMap map[int16]NodeLifespanMap

func (RunNodeLifespanMap) ToString

func (m RunNodeLifespanMap) ToString() string

type RunProperties added in v1.1.0

type RunProperties struct {
	RunId           int16  `header:"run_id" format:"%6d" column:"run_id" type:"int" key:"true" json:"run_id"`
	StartNodes      string `header:"start_nodes" format:"%20v" column:"start_nodes" type:"text" json:"start_nodes"`
	AffectedNodes   string `header:"affected_nodes" format:"%20v" column:"affected_nodes" type:"text" json:"affected_nodes"`
	ScriptUri       string `header:"script_uri" format:"%20v" column:"script_uri" type:"text" json:"script_uri"`
	ScriptParamsUri string `header:"script_params_uri" format:"%20v" column:"script_params_uri" type:"text" json:"script_params_uri"`
	RunDescription  string `header:"run_desc" format:"%20v" column:"run_description" type:"text" json:"run_description"`
}

Object model with tags that allow to create cql CREATE TABLE queries and to print object

func NewRunPropertiesFromMap added in v1.1.0

func NewRunPropertiesFromMap(r map[string]interface{}, fields []string) (*RunProperties, error)

func (RunProperties) ToSpacedString added in v1.1.0

func (n RunProperties) ToSpacedString() string

ToSpacedString - prints formatted field values, uses reflection, shoud not be used in prod

type RunStartTsMap

type RunStartTsMap map[int16]time.Time

func (RunStartTsMap) ToString

func (m RunStartTsMap) ToString() string

type RunStatusMap

type RunStatusMap map[int16]RunStatusType

func (RunStatusMap) ToString

func (m RunStatusMap) ToString() string

type RunStatusType

type RunStatusType int8
const (
	RunNone     RunStatusType = 0
	RunStart    RunStatusType = 1
	RunComplete RunStatusType = 2
	RunStop     RunStatusType = 3
)

func ReadRunStatusFromRow

func ReadRunStatusFromRow(fieldName string, r map[string]interface{}) (RunStatusType, error)

func (RunStatusType) ToString

func (status RunStatusType) ToString() string

Jump to

Keyboard shortcuts

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