Documentation ¶
Index ¶
- Constants
- Variables
- type Action
- type ActionContextRunStatus
- type ActionOutput
- type Actor
- type AttrTreeValue
- type ContextType
- type EventCode
- type EventDispatcher
- type EventListener
- type IActionContext
- type IActor
- type IDebugger
- type IDirector
- type IEvent
- type ILogger
- type IProvider
- type IStore
- type NextAction
- type ProviderAuthError
- type ProviderInitFunc
- type RuntimeState
- type StorageRecord
- type StorageRecordStack
Constants ¶
const CriticalLevel = 50
CriticalLevel const
const DebugLevel = 10
DebugLevel const
const ErrorLevel = 40
ErrorLevel const
const InfoLevel = 20
InfoLevel const
const NotsetLevel = 0
NotsetLevel const
const ParanoicDebugLevel = 5
DebugLevel const
const SilentLevel = 100
const WarningLevel = 30
WarningLevel const
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action struct { // Filled internally. Parents []*Action JoinThreadsPoint bool DebugPoint bool KnowParentIDs map[string]bool SafeID *string // GENERICS // Provider string `json:"provider" validate:"required"` ActionID string `json:"action_id" validate:"required"` ActionName string `json:"action" validate:"required"` FirstAction bool `json:"first_action"` NextAction NextAction `json:"next_action"` // Delegated parse. Input json.RawMessage `json:"input" validate:"required"` Parameters json.RawMessage `json:"parameters" validate:"required"` // Actor out vars names. Output *string `json:"output"` SaveRawResults bool `json:"save_raw_results"` DebugNetwork bool `json:"debug_network"` // Not documented MaxRetries *int `json:"max_retries"` RetryCount int }
Action struct (should be interface? :shrug:)
type ActionContextRunStatus ¶
type ActionContextRunStatus int
const ( RunStatusReady ActionContextRunStatus = iota RunStatusArranging RunStatusRunning RunStatusDone )
type ActionOutput ¶
type ActionOutput struct { Action *Action Records []*StorageRecord }
ActionOutput struct
func NewActionOutput ¶
func NewActionOutput(action *Action, storageRecordValue interface{}, storageRecordValueID *string) *ActionOutput
NewActionOutput func.
type AttrTreeValue ¶
AttrTreeValue struct
type ContextType ¶
type ContextType int
const ( ContextTypeRegular ContextType = iota // one parent, one child ContextTypeThread // one parent, many children ContextTypeJoin // many parents, one child )
type EventDispatcher ¶
type EventDispatcher struct {
// contains filtered or unexported fields
}
func NewEventDispatcher ¶
func NewEventDispatcher() *EventDispatcher
func (*EventDispatcher) DestroyEventListener ¶
func (ev *EventDispatcher) DestroyEventListener(e *EventListener)
func (*EventDispatcher) Dispatch ¶
func (ev *EventDispatcher) Dispatch(e IEvent)
func (*EventDispatcher) NewEventListener ¶
func (ev *EventDispatcher) NewEventListener() *EventListener
type EventListener ¶
type EventListener struct {
// contains filtered or unexported fields
}
func NewEventListener ¶
func NewEventListener() *EventListener
func (*EventListener) EventChan ¶
func (e *EventListener) EventChan() chan IEvent
func (*EventListener) ReadUntil ¶
func (e *EventListener) ReadUntil(ec EventCode) bool
Read all events until EventCode are found, return true if EventCode gets found. Return false if events chan gets empty without any ocurrence of EventCode
func (*EventListener) WaitUntil ¶
func (e *EventListener) WaitUntil(ecs []EventCode) EventCode
Waits for ocurrence of any of given EventCode, returns the first EventCode found
func (*EventListener) WaitUntilChan ¶
func (e *EventListener) WaitUntilChan(ecs []EventCode) chan struct{}
WaitUntilChan same as WaitUntilChan but it returns a chan that will be filled on event reach
type IActionContext ¶
type IActionContext interface { Type() ContextType Parent(IActionContext) Parents() []IActionContext Child(IActionContext) Children() []IActionContext IsThreadPoint() bool IsJoinPoint() bool GetAction() *Action SetStore(IStore) GetStore() IStore // SetProvider(IProvider) // GetProvider() IProvider Done() <-chan struct{} WithCancelCause() WithEventListener(*EventListener) EventListener() *EventListener Cancel(error) WithRunFunc(func() (*ActionOutput, error)) RunAction() (*ActionOutput, error) SetRunStatus(ActionContextRunStatus) GetRunStatus() ActionContextRunStatus // GetSluvaFD() io.ReadWriteCloser GetMustarFD() io.ReadWriteCloser // // the func that runs on DebugInit call WithDebugInitFunc(func()) // returns the fd in wich the action can // read/write to interact with user, // commonly the sluva FD of vpty DebugInit() }
ActionContext interface
type IActor ¶
type IActor interface {
RunAction(action *Action) (*ActionOutput, error)
}
IActor interface
type ILogger ¶
type ILogger interface { LogCritical(s string) LogErr(s string) ByteLogErr(b []byte) LogWarn(s string) LogInfo(s string) ByteLogInfo(b []byte) LogDebug(s string) Duplicate() ILogger SetActionID(ai string) SetActionName(ai string) SetThreadID(ti string) }
ILogger interface
type IProvider ¶
type IProvider interface { HandleAction(ctx IActionContext) (*ActionOutput, error) OnActionErrorHook(aout *ActionOutput) ([]*Action, error) DumpPrivateVars(freshStore IStore) }
IProvider interface
type IStore ¶
type IStore interface { StoreProvider(name string, provider IProvider) GetProvider(providerName string) (IProvider, error) Duplicate() IStore ExistsProvider(providerName string) bool GetLogger() ILogger SetLogger(logger ILogger) GetPrivateVar(varname string) interface{} SetPrivateVar(varname string, value interface{}) Merge(IStore) GetActionOutputByActionID(actionID *string) (*ActionOutput, error) Insert(record *StorageRecord, providerPrefix string) error Push(record *StorageRecord, providerPrefix string) error Interpolate(sourcetext *string) error GetPlain() (map[string]string, error) GetRawJSONValues() (map[string]json.RawMessage, error) DumpValuesToShellFile() (*os.File, error) DumpValuesToJSONFile() (*os.File, error) GetByRefName(refname string) (*StorageRecord, error) DeepInterpolation(v interface{}) error ExistsRefName(refname string) bool }
IStore interface
type NextAction ¶
type NextAction struct { // Filled internally NextOk []*Action // Used internally. Is this a conditional next? ConditionalNext bool // NextOkTrue []*Action NextOkFalse []*Action // NextKo []*Action // filled internally // detect loops through ok and ko NextOkLoop bool NextKoLoop bool // Parsed in precompiling. Ok json.RawMessage `json:"ok"` Ko json.RawMessage `json:"ko"` }
NextAction struct
type ProviderAuthError ¶
type ProviderAuthError struct {
Err error
}
func (*ProviderAuthError) Error ¶
func (r *ProviderAuthError) Error() string
type ProviderInitFunc ¶
ProviderInitFunc type
type RuntimeState ¶
type RuntimeState int
const ( // running RuntimeStatePlay RuntimeState = iota // paused RuntimeStateStill // ending but not ended RuntimeStateEnding // finished ensured RuntimeStateEnd )
type StorageRecord ¶
type StorageRecord struct { ValueID string `json:"valueID"` RefName string `json:"refName"` Aout *ActionOutput `json:"-"` Action *Action `json:"-"` RawSource interface{} `json:"-"` Value interface{} `json:"value"` PlainValue map[string]*AttrTreeValue `json:"-"` JSONValue []byte `json:"-"` IsString bool `json:"-"` Fail bool `json:"fail"` Error error `json:"-"` // allow access to Value using just .RefName like {{ refname }} // if false, .ValueID is used on literal interpolation {{ refname }} // To access values of non Literal vars, use {{ refname.attr.subattr }}. // If .ValueID is empty and Literal is false, on {{ refname }} access // an err should generated Literal bool `json:"-"` ErrorStr string `json:"error"` }
StorageRecord struct
func (*StorageRecord) BuildInternals ¶
func (sr *StorageRecord) BuildInternals() error
type StorageRecordStack ¶
type StorageRecordStack struct {
Items []interface{}
}