Documentation
¶
Index ¶
- Constants
- Variables
- func AnswerPrompt(b *BusData, v string)
- func EP(e int) *int
- func FormatConsoleLogMsg(fback *BusData, verbose bool) *string
- func InitConsoleLogger(upgrader func(*BusConsumerLink) error)
- func InitSystemBus()
- func Log(level int, m *string, ei *string, ai *string, ti *string, raw bool)
- func LogCritical(s string, re *string)
- func LogDebug(s string, re *string)
- func LogErr(s string, re *string)
- func LogInfo(s string, re *string)
- func LogWarn(s string, re *string)
- func NewWebSocketLogger(conn *websocket.Conn, clientUUID string)
- func PromptBool(title string, required bool, def string) (chan string, error)
- func PromptInput(title string, required bool, def string) (chan string, error)
- func PromptInt(title string, required bool, def string) (chan string, error)
- func PromptSelect(title string, required bool, options map[string]string) (chan string, error)
- func PushBusData(bdata *BusData)
- func PushEvent(eid int, re *string)
- func PushEventWithExtra(eid int, ei *string, extra map[string]interface{})
- func PushFilteredBusData(clientUUIDFilter string, extra map[string]interface{})
- func PushMixedLogEventBusData(bdata *BusData)
- func PushState(runningIDs []string, state int, ei *string)
- func SBusConnect(fLink *BusConsumerLink)
- func SBusDisconnect(fLink *BusConsumerLink)
- func SEP(s string) *string
- type BusConsumerLink
- type BusData
- type BusDataType
- type BusInfo
- type ConsoleLogger
- type DummyLogger
- func (l *DummyLogger) ByteLogErr(b []byte)
- func (l *DummyLogger) ByteLogInfo(b []byte)
- func (l *DummyLogger) Duplicate() base.ILogger
- func (l *DummyLogger) LogCritical(s string)
- func (l *DummyLogger) LogDebug(s string)
- func (l *DummyLogger) LogErr(s string)
- func (l *DummyLogger) LogInfo(s string)
- func (l *DummyLogger) LogWarn(s string)
- func (l *DummyLogger) SetActionID(ai string)
- func (l *DummyLogger) SetActionName(an string)
- func (l *DummyLogger) SetThreadID(ti string)
- type EventPromptOpts
- type EventPromptOptsValidateOpts
- type EventPromptType
- type ExecutionsRegistry
- type Logger
- func (l *Logger) ByteLogErr(b []byte)
- func (l *Logger) ByteLogInfo(b []byte)
- func (l *Logger) Duplicate() base.ILogger
- func (l *Logger) LogCritical(s string)
- func (l *Logger) LogDebug(s string)
- func (l *Logger) LogErr(s string)
- func (l *Logger) LogInfo(s string)
- func (l *Logger) LogWarn(s string)
- func (l *Logger) ParanoicLogDebug(s string)
- func (l *Logger) SetActionID(ai string)
- func (l *Logger) SetActionName(an string)
- func (l *Logger) SetThreadID(ti string)
- type Progress
- type SystemBus
- func (s *SystemBus) Close() *sync.WaitGroup
- func (s *SystemBus) ExistsExecution(eid string) bool
- func (s *SystemBus) GetExecutionStatus(eid string) bool
- func (s *SystemBus) GetProviderInitFunc(strname string) (base.ProviderInitFunc, error)
- func (s *SystemBus) RegisterProviderInitFunc(strname string, initfunc base.ProviderInitFunc)
- func (s *SystemBus) SetExecutionStatus(eid string, status bool)
- func (s *SystemBus) Start()
- type WSocketLogger
Constants ¶
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 )
const SBusBufferSize = 100000
SBusBufferSize const
Variables ¶
var ER = &ExecutionsRegistry{ ByClientUUID: make(map[string]map[string]bool), }
Functions ¶
func AnswerPrompt ¶
func FormatConsoleLogMsg ¶
func InitConsoleLogger ¶
func InitConsoleLogger(upgrader func(*BusConsumerLink) error)
InitConsoleLogger func
func NewWebSocketLogger ¶
NewWebSocketLogger handles websocket requests from the peer.
func PromptBool ¶
PromptBool def is true or false string
func PromptSelect ¶
func PushEventWithExtra ¶
TODO: look for a better way to do this PushEvent func
func PushFilteredBusData ¶
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.
Types ¶
type BusConsumerLink ¶
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
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) 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 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 Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
func NewProgress ¶
type SystemBus ¶
SystemBus struct
var SBus *SystemBus
SBus is a globally shared system bus
func (*SystemBus) ExistsExecution ¶
ExistsExecution func
func (*SystemBus) GetExecutionStatus ¶
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 ¶
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
type WSocketLogger ¶
type WSocketLogger struct {
// contains filtered or unexported fields
}
WSocketLogger is a middleman between the websocket connection and the SBus.