cast

package
v0.5.1-beta-hotfix1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventDirectorStarting const 0
	EventDirectorStarting int = iota
	// EventDirectorStarted const 1
	EventDirectorStarted
	// EventDirectorPause const 2
	EventDirectorPause
	// EventDirectorOut const 3
	EventDirectorOut
	// EventManagerPrepareBPStart const 4
	EventManagerPrepareBPStart
	// EventManagerPrepareBPEnd const 5
	EventManagerPrepareBPEnd
	// EventManagerPrepareBPEndWithErr const 6
	EventManagerPrepareBPEndWithErr
	// EventRuntimeStarting const 7
	EventRuntimeStarting
	// EventRuntimeResuming const 8
	EventRuntimeResuming
	// EventRuntimeStarted const 9
	EventRuntimeStarted
	// EventRuntimePausing const 10
	EventRuntimePausing
	// EventManagerPause const 11
	EventRuntimePaused
	// EventRuntimeStopping const 12
	EventRuntimeStopping
	// EventRuntimeOut const 13
	EventRuntimeOut
	// EventRegisteredManager const 14
	EventRegisteredManager
	// EventWaitingStatus const 15
	EventWaitingForState
	// EventActionUnCaughtKO const 16
	EventActionUnCaughtKO
	// EventActionUnCaughtOK const 17
	EventActionUnCaughtOK
	// EventActionInit const 18
	EventActionInit
	// EventActionKO Handled KO const 19
	EventActionKO
	// EventActionOK const 20
	EventActionOK
	// ThreadCreated const 21
	EventNewThread
	// ThreadDestroyed const 22
	EventThreadDestroyed
	//
	EventProgressStart
	EventProgressTick
	EventProgressEnd
	EventInteractiveMenuStart
	EventPrompt
	EventPromptDone
)
View Source
const SBusBufferSize = 100000

SBusBufferSize const

Variables

View Source
var ER = &ExecutionsRegistry{
	ByClientUUID: make(map[string]map[string]bool),
}

Functions

func AnswerPrompt

func AnswerPrompt(b *BusData, v string)

func EP

func EP(e int) *int

func FormatConsoleLogMsg

func FormatConsoleLogMsg(fback *BusData, verbose bool) *string

func InitConsoleLogger

func InitConsoleLogger(upgrader func(*BusConsumerLink) error)

InitConsoleLogger func

func InitSystemBus

func InitSystemBus()

InitSystemBus func

func Log

func Log(level int, m *string, ei *string, ai *string, ti *string, raw bool)

Log func

func LogCritical

func LogCritical(s string, re *string)

LogCritical func

func LogDebug

func LogDebug(s string, re *string)

LogDebug func

func LogErr

func LogErr(s string, re *string)

LogErr func

func LogInfo

func LogInfo(s string, re *string)

LogInfo func

func LogWarn

func LogWarn(s string, re *string)

LogWarn func

func NewWebSocketLogger

func NewWebSocketLogger(conn *websocket.Conn, clientUUID string)

NewWebSocketLogger handles websocket requests from the peer.

func PromptBool

func PromptBool(title string, required bool, def string) (chan string, error)

PromptBool def is true or false string

func PromptInput

func PromptInput(title string, required bool, def string) (chan string, error)

func PromptInt

func PromptInt(title string, required bool, def string) (chan string, error)

func PromptSelect

func PromptSelect(title string, required bool, options map[string]string) (chan string, error)

func PushBusData

func PushBusData(bdata *BusData)

PushBusData func

func PushEvent

func PushEvent(eid int, re *string)

PushEvent func

func PushEventWithExtra

func PushEventWithExtra(eid int, ei *string, extra map[string]interface{})

TODO: look for a better way to do this PushEvent func

func PushFilteredBusData

func PushFilteredBusData(clientUUIDFilter string, extra map[string]interface{})

PushFilteredBusData func

func PushMixedLogEventBusData

func PushMixedLogEventBusData(bdata *BusData)

PushMixedLogEventBusData send a two copies of bdata to bus buffer overriding bdata.TypeID and setting it to cast.BusDataTypeEvent and cast.BusDataTypeLog. This is usefull on init/end of action or something to fine-log init events of an action before the output of that action.

func PushState

func PushState(runningIDs []string, state int, ei *string)

WIP: esto debería ser un sistema de eventos: crear un struct tipo Event aquí en cast y en lugar de usar Push, usar algo así como dispatchEvent(e *Event) PushState func

func SBusConnect

func SBusConnect(fLink *BusConsumerLink)

SBusConnect func

func SBusDisconnect

func SBusDisconnect(fLink *BusConsumerLink)

SBusDisconnect func

func SEP

func SEP(s string) *string

Types

type BusConsumerLink struct {
	Name       string
	ClientUUID string
	LogChan    chan *BusData
	CommonChan chan *BusData
	// tells a busreader that should stop read. This
	// is usefull to switch readers using the same
	// link
	Off chan struct{}
	// EOF msg received, so this link should not used
	// to read any more logs
	Degraded        bool
	AllowEventData  bool
	AllowStatusData bool
}

BusConsumerLink struct. Used to connect consumer with BusData dispatcher

type BusData

type BusData struct {
	Timestamp int64 `json:"timestamp"`
	//
	// Type of data
	TypeID BusDataType `json:"type_id"`
	// id of the action sending the data
	ActionID *string `json:"action_id,omitempty"`
	// name of the action sending the data
	ActionName *string `json:"action_name,omitempty"`
	// id of the thread sending the data
	ThreadID *string `json:"thread_id,omitempty"`
	// Msg data in bytes
	M        *string `json:"message,omitempty"`
	LogLevel *int    `json:"log_level,omitempty"`
	EOF      bool    `json:"EOF,omitempty"`
	// Event id
	EventID *int `json:"event_id,omitempty"`
	// State id
	LastKnownEventID *int `json:"last_known_event_id,omitempty"`
	// Extra data
	// Be carefully on putting pointers here or
	// race condition may occur
	Extra map[string]interface{} `json:"extra,omitempty"`
	// Manager *executive.Manager
	ExecutionUUID *string `json:"execution_uuid"`
	// Filtered feedback, sent only to client with this UUID
	ClientUUIDFilter *string `json:"-"`
	// Raw data
	Raw bool             `json:"raw,omitempty"`
	EPO *EventPromptOpts `json:"epo,omitempty"`
}

BusData struct

type BusDataType

type BusDataType int

BusDataType int

const (
	// BusDataTypeLog const 0
	BusDataTypeLog BusDataType = iota
	// BusDataTypeEvent const 1
	BusDataTypeEvent
	// BusDataTypeStatus const 2
	BusDataTypeStatus
	// BusDataTypeEOF const 4
	BusDataTypeEOF
)

type BusInfo

type BusInfo struct {
	Load float64
	// contains filtered or unexported fields
}

BusInfo struct

var BInfo *BusInfo

func (*BusInfo) GetLoad

func (b *BusInfo) GetLoad() float64

func (*BusInfo) SetLoad

func (b *BusInfo) SetLoad(l float64)

type ConsoleLogger

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

ConsoleLogger struct

type DummyLogger

type DummyLogger struct {
	ExecutionUUID *string
	ActionID      *string
	ActionName    *string
	ThreadID      *string
}

func (*DummyLogger) ByteLogErr

func (l *DummyLogger) ByteLogErr(b []byte)

func (*DummyLogger) ByteLogInfo

func (l *DummyLogger) ByteLogInfo(b []byte)

func (*DummyLogger) Duplicate

func (l *DummyLogger) Duplicate() base.ILogger

Duplicate func

func (*DummyLogger) LogCritical

func (l *DummyLogger) LogCritical(s string)

func (*DummyLogger) LogDebug

func (l *DummyLogger) LogDebug(s string)

func (*DummyLogger) LogErr

func (l *DummyLogger) LogErr(s string)

func (*DummyLogger) LogInfo

func (l *DummyLogger) LogInfo(s string)

func (*DummyLogger) LogWarn

func (l *DummyLogger) LogWarn(s string)

func (*DummyLogger) SetActionID

func (l *DummyLogger) SetActionID(ai string)

func (*DummyLogger) SetActionName

func (l *DummyLogger) SetActionName(an string)

func (*DummyLogger) SetThreadID

func (l *DummyLogger) SetThreadID(ti string)

type EventPromptOpts

type EventPromptOpts struct {
	UUID         string            `json:"uuid"`
	Type         EventPromptType   `json:"type"`
	PromptTitle  string            `json:"prompt_title"`
	DefaultValue string            `json:"default_value"`
	Options      map[string]string `json:"options"` // for select

	//
	Validate *EventPromptOptsValidateOpts `json:"validate"`
	// contains filtered or unexported fields
}

type EventPromptOptsValidateOpts

type EventPromptOptsValidateOpts struct {
	ValueType  string // int, string ...
	AllowEmpty bool
}

type EventPromptType

type EventPromptType int

EventPromptType int

const (
	EventPromptTypeInput EventPromptType = iota
	EventPromptTypeSelect
	EventPromptTypeBool
)

type ExecutionsRegistry

type ExecutionsRegistry struct {
	ByClientUUID map[string]map[string]bool
	// contains filtered or unexported fields
}

func (*ExecutionsRegistry) GetByClient

func (e *ExecutionsRegistry) GetByClient(clientUUID string) (map[string]bool, error)

type Logger

type Logger struct {
	ExecutionUUID *string
	ActionID      *string
	ActionName    *string
	ThreadID      *string
}

Logger struct

func (*Logger) ByteLogErr

func (l *Logger) ByteLogErr(b []byte)

ByteLogErr func

func (*Logger) ByteLogInfo

func (l *Logger) ByteLogInfo(b []byte)

ByteLogInfo func

func (*Logger) Duplicate

func (l *Logger) Duplicate() base.ILogger

Duplicate func

func (*Logger) LogCritical

func (l *Logger) LogCritical(s string)

LogCritical func

func (*Logger) LogDebug

func (l *Logger) LogDebug(s string)

LogDebug func

func (*Logger) LogErr

func (l *Logger) LogErr(s string)

LogErr func

func (*Logger) LogInfo

func (l *Logger) LogInfo(s string)

LogInfo func

func (*Logger) LogWarn

func (l *Logger) LogWarn(s string)

LogWarn func

func (*Logger) ParanoicLogDebug

func (l *Logger) ParanoicLogDebug(s string)

ParanoicLogDebug func

func (*Logger) SetActionID

func (l *Logger) SetActionID(ai string)

SetActionID func

func (*Logger) SetActionName

func (l *Logger) SetActionName(an string)

SetActionName func

func (*Logger) SetThreadID

func (l *Logger) SetThreadID(ti string)

SetThreadID func

type Progress

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

func NewProgress

func NewProgress(size int64, info, actionid, actionname, threadid, euuid string) *Progress

func (*Progress) Add

func (g *Progress) Add(n int)

func (*Progress) Add64

func (g *Progress) Add64(n int64)

func (*Progress) Write

func (g *Progress) Write(p []byte) (int, error)

type SystemBus

type SystemBus struct {
	Executions map[string]bool
	// contains filtered or unexported fields
}

SystemBus struct

var SBus *SystemBus

SBus is a globally shared system bus

func (*SystemBus) Close

func (s *SystemBus) Close() *sync.WaitGroup

Close func

func (*SystemBus) ExistsExecution

func (s *SystemBus) ExistsExecution(eid string) bool

ExistsExecution func

func (*SystemBus) GetExecutionStatus

func (s *SystemBus) GetExecutionStatus(eid string) bool

GetExecutionStatus func

func (*SystemBus) GetProviderInitFunc

func (s *SystemBus) GetProviderInitFunc(strname string) (base.ProviderInitFunc, error)

WIP: esto lo mismo podríamos moverlo a runtime GetProviderInitFunc func

func (*SystemBus) RegisterProviderInitFunc

func (s *SystemBus) RegisterProviderInitFunc(strname string, initfunc base.ProviderInitFunc)

WIP: esto lo mismo podríamos moverlo a runtime RegisterProviderInitFunc func

func (*SystemBus) SetExecutionStatus

func (s *SystemBus) SetExecutionStatus(eid string, status bool)

SetExecutionStatus func. Early status of execution (true/false). true indicates that the execution is running. False indicates that the execution is stopping or stopped: logs will be dicarded

func (*SystemBus) Start

func (s *SystemBus) Start()

Start func

type WSocketLogger

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

WSocketLogger is a middleman between the websocket connection and the SBus.

Jump to

Keyboard shortcuts

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