Documentation
¶
Overview ¶
Package wfmodel contains definitions of workflow model
Index ¶
- Constants
- func BatchHistoryEventAllFields() []string
- func GetCreateTableCql(t reflect.Type, keyspace string, tableName string) string
- func GetObjectModelFieldFormats(t reflect.Type) []string
- func GetSpacedHeader(n any) string
- func NewVarsFromDepCtx(e DependencyNodeEvent) eval.VarValuesMap
- func NodeBatchStatusToString(s NodeBatchStatusType) string
- func NodeHistoryEventAllFields() []string
- func ReadInt16FromRow(fieldName string, r map[string]any) (int16, error)
- func ReadInt64FromRow(fieldName string, r map[string]any) (int64, error)
- func ReadStringFromRow(fieldName string, r map[string]any) (string, error)
- func ReadTimeFromRow(fieldName string, r map[string]any) (time.Time, error)
- func RunHistoryEventAllFields() []string
- func RunPropertiesAllFields() []string
- type BatchHistoryEvent
- type DependencyNodeEvent
- type DependencyNodeEvents
- type Message
- type NodeBatchStatusType
- type NodeHistoryEvent
- type NodeLifespan
- type NodeLifespanMap
- type NodeRunBatchStatusMap
- type NodeStatusMap
- type NodeStatusType
- type RunBatchStatusMap
- type RunCounter
- type RunHistoryEvent
- type RunLifespan
- type RunLifespanMap
- type RunNodeLifespanMap
- type RunProperties
- type RunStartTsMap
- type RunStatusMap
- type RunStatusType
Constants ¶
const DependencyNodeEventTableName string = "e"
const LogTsFormatQuoted = `"2006-01-02T15:04:05.000-0700"`
const PrintTableDelimiter = "/"
const TableNameBatchHistory = "wf_batch_history"
const TableNameNodeHistory = "wf_node_history"
const TableNameRunAffectedNodes = "wf_run_affected_nodes"
const TableNameRunCounter = "wf_run_counter"
const TableNameRunHistory = "wf_run_history"
const WfmodelNamespace string = "wfmodel"
Variables ¶
This section is empty.
Functions ¶
func BatchHistoryEventAllFields ¶ added in v1.1.0
func BatchHistoryEventAllFields() []string
func GetCreateTableCql ¶
func GetObjectModelFieldFormats ¶
GetObjectModelFieldFormats - helper to get formats for each field of an object model
func GetSpacedHeader ¶
GetSpacedHeader - prints formatted struct field names, uses reflection, shoud not be used in prod
func NewVarsFromDepCtx ¶
func NewVarsFromDepCtx(e DependencyNodeEvent) eval.VarValuesMap
func NodeBatchStatusToString ¶ added in v1.2.0
func NodeBatchStatusToString(s NodeBatchStatusType) string
func NodeHistoryEventAllFields ¶ added in v1.1.0
func NodeHistoryEventAllFields() []string
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]any, fields []string) (*BatchHistoryEvent, error)
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 ¶
func (e *DependencyNodeEvent) ToVars() eval.VarValuesMap
type DependencyNodeEvents ¶
type DependencyNodeEvents []DependencyNodeEvent
func (DependencyNodeEvents) ToString ¶
func (events DependencyNodeEvents) ToString() string
type Message ¶
type Message struct {
Ts int64 `json:"ts"` // Assigned by sender on creation, used only for daemon statistics, see logging age
Id string `json:"id"` // Assigned by sender on creation, used by workers when communicating to CapiMQ/ActiveMQ and its capimq counterpart in CapimqInternalMessage - internally by CapiMQ
ScriptURL string `json:"script_url"`
ScriptParamsURL string `json:"script_params_url"`
DataKeyspace string `json:"ks"`
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"`
}
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 only (no 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 (*Message) FullBatchId ¶ added in v1.2.0
func (*Message) FullNodeId ¶ added in v1.2.0
type NodeBatchStatusType ¶
type NodeBatchStatusType int8
const ( NodeBatchNone NodeBatchStatusType = 0 NodeBatchStart NodeBatchStatusType = 1 NodeBatchSuccess NodeBatchStatusType = 2 NodeBatchFail NodeBatchStatusType = 3 // Biz logicerror or data table (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]any) (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]any, fields []string) (*NodeHistoryEvent, error)
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]any, fields []string) (*RunHistoryEvent, error)
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"`
ScriptUrl string `header:"script_url" format:"%20v" column:"script_url" type:"text" json:"script_url"`
ScriptParamsUrl string `header:"script_params_url" format:"%20v" column:"script_params_url" type:"text" json:"script_params_url"`
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]any, fields []string) (*RunProperties, error)
type RunStartTsMap ¶
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]any) (RunStatusType, error)
func (RunStatusType) ToString ¶
func (status RunStatusType) ToString() string