Documentation
¶
Index ¶
- Constants
- func Continue(instanceId string, tags et.Json, ctx et.Json, createdBy string) (et.Json, error)
- func DeleteFlow(tag string) error
- func DeleteInstance(instanceId string) error
- func HealthCheck() bool
- func Load() error
- func OnDeleteFlow(f DeleteFlowFn)
- func OnDeleteInstance(f DeleteInstanceFn)
- func OnLoadFlow(f LoadFlowFn)
- func OnLoadInstance(f LoadInstanceFn)
- func OnSaveFlow(f SaveFlowFn)
- func OnSaveInstance(f SaveInstanceFn)
- func Reset(instanceId, createdBy string) error
- func Rollback(instanceId string) (et.Json, error)
- func Run(instanceId, tag string, startId int, tags et.Json, ctx et.Json, ...) (et.Json, error)
- func Stop(instanceId string) error
- type DeleteFlowFn
- type DeleteInstanceFn
- type Flow
- func (s *Flow) Consistency(consistency TpConsistency) *Flow
- func (s *Flow) Debug() *Flow
- func (s *Flow) IfElse(expression string, yesGoTo int, noGoTo int) *Flow
- func (s *Flow) Resilence(totalAttempts int, timeAttempts time.Duration, team string, level string) *Flow
- func (s *Flow) Retention(retentionTime time.Duration) *Flow
- func (s *Flow) Rollback(fn FnContext) *Flow
- func (s *Flow) Save() error
- func (s *Flow) Step(name, description string, definition string, stop bool) *Flow
- func (s *Flow) StepByFile(name, description string, filePath string, stop bool) *Flow
- func (s *Flow) StepFn(name, description string, fn FnContext, stop bool) *Flow
- func (s *Flow) ToJson() et.Json
- type FlowStatus
- type FnContext
- type Instance
- func (s *Instance) Done() error
- func (s *Instance) Goto(step int) error
- func (s *Instance) Save() error
- func (s *Instance) SetCtx(ctx et.Json) et.Json
- func (s *Instance) SetPinnedData(key string, value interface{})
- func (s *Instance) SetResult(result et.Json, err error) (et.Json, error)
- func (s *Instance) SetStatus(status FlowStatus) error
- func (s *Instance) SetStep(val int)
- func (s *Instance) SetTags(tags et.Json)
- func (s *Instance) Stop() error
- func (s *Instance) ToJson() et.Json
- type LoadFlowFn
- type LoadInstanceFn
- type Result
- type SaveFlowFn
- type SaveInstanceFn
- type Step
- type TpConsistency
- type TpStep
- type WorkFlows
Constants ¶
const ( EVENT_ERROR = "workflow:error" EVENT_FLOW_SET = "workflow:flow:set" EVENT_FLOW_DELETE = "workflow:flow:delete" EVENT_FLOW_STATUS = "workflow:flow:status" EVENT_WORKFLOW_SET = "workflow:set" EVENT_WORKFLOW_DELETE = "workflow:delete" EVENT_WORKFLOW_STATUS = "workflow:status" )
const ( MSG_FLOW_CREATED = "Flujo definido Tag:%s version:%s name:%s" MSG_FLOW_NOT_FOUND = "Flujo no encontrado" MSG_FLOW_NOT_INSTANCE = "Flujo no instanciado" MSG_START_WORKFLOW = "Iniciando el workflow" MSG_INSTANCE_ID_REQUIRED = "Instance id es requerido" MSG_INSTANCE_NOT_FOUND = "Instancia no encontrada" MSG_INSTANCE_EXISTS = "Instancia existe" MSG_INSTANCE_FAILED = "Instancia fallido:%s Tag:%s status:%s, step:%d error:%s" MSG_INSTANCE_STATUS = "Instancia:%s Tag:%s status:%s, step:%d" MSG_INSTANCE_DEBUG = "Instancia:%s debug:%s" MSG_INSTANCE_GOTO = "Instancia %s Tag:%s ir al step:%d %s" MSG_INSTANCE_LOAD = "Instancia load:%s tag:%s currentStep:%d" MSG_INSTANCE_ALREADY_DONE = "Instancia ya finalizada" MSG_INSTANCE_ALREADY_RUNNING = "Instancia ya en ejecucion" MSG_INSTANCE_PENDING = "Instancia pendiente" MSG_INSTANCE_WORKFLOWS_IS_NIL = "workFlows es nil" MSG_ID_REQUIRED = "id es requerido" MSG_INSTANCE_EXPRESSION_TRUE = "Resultado de la expresion es true" MSG_INSTANCE_EXPRESSION_FALSE = "Resultado de la expresion es false" MSG_INSTANCE_ROLLBACK = "Esta intentando hacer rollback de un step que no existe" MSG_INSTANCE_ROLLBACK_STEP = "Haciendo rollback del step:%d" MSG_INSTANCE_STEP_CREATED = "Definido step:%d name:%s Tag:%s" MSG_INSTANCE_ROLLBACK_CREATED = "Definido rollback step:%d name:%s Tag:%s" MSG_INSTANCE_ROLLBACK_FAILED = "Rollback Instance:%s Tag:%s status:%s, step:%d error:%s" MSG_INSTANCE_CONSISTENCY = "Consistencia definida Tag:%s consistency:%s" MSG_INSTANCE_RESILIENCE = "Definida resilencia Tag:%s totalAttempts:%d timeAttempts:%s retentionTime:%s" MSG_INSTANCE_IFELSE = "Definido ifElse step:%d name:%s expresion:%s ? %d : %d Tag:%s" MSG_INSTANCE_RETENTION = "Definida retencion Tag:%s retentionTime:%s" MSG_INSTANCE_GOTO_USER_DECISION = "Por desicion del usuario" MSG_WORKFLOW_DELETE = "Workflow eliminado Tag:%s" MSG_WORKFLOW_DONE_INSTANCE = "Instancia terminada:%s" MSG_WORKFLOW_LIMIT_REQUESTS = "Límite de peticiones alcanzado, el proceso se pondra en espera para ejecusión, instanceId:%s" MSG_INSTANCE_RUN = "Run instance:%s, flow:%s" MSG_INSTANCE_INSTANCE_INC = "WorkFlows.instanceInc totalInstances:%d limitRequests:%d" MSG_INSTANCE_INSTANCE_DEC = "WorkFlows.instanceDec totalInstances:%d limitRequests:%d" MSG_INSTANCE_EVALUATE = "error al evaluar expresion:%s, error:%s" MSG_ARG_REQUIRED = "argumento requerido:%s" MSG_INSTANCE_DEFINITION_EMPTY = "definition is empty" )
Variables ¶
This section is empty.
Functions ¶
func Continue ¶
* * Continue * @param instanceId string, tags et.Json, ctx et.Json, createdBy string * @return et.Json, error *
func DeleteFlow ¶
* * DeleteFlow * @param tag string * @return error *
func DeleteInstance ¶
* * DeleteInstance * @param instanceId string * @return error *
func OnDeleteFlow ¶
func OnDeleteFlow(f DeleteFlowFn)
* * OnDeleteFlow * @param f DeleteFlowFn * @return void *
func OnDeleteInstance ¶
func OnDeleteInstance(f DeleteInstanceFn)
* * OnDeleteInstance * @param f DeleteInstanceFn * @return void *
func OnLoadFlow ¶
func OnLoadFlow(f LoadFlowFn)
* * OnLoadFlow * @param f LoadFlowFn * @return void *
func OnLoadInstance ¶
func OnLoadInstance(f LoadInstanceFn)
* * OnLoadInstance * @param f LoadInstanceFn * @return void *
func OnSaveFlow ¶
func OnSaveFlow(f SaveFlowFn)
* * OnSaveFlow * @param f SaveFlowFn * @return void *
func OnSaveInstance ¶
func OnSaveInstance(f SaveInstanceFn)
* * OnSaveInstance * @param f SaveInstanceFn * @return void *
Types ¶
type DeleteFlowFn ¶
type DeleteInstanceFn ¶
type Flow ¶
type Flow struct {
Tag string `json:"tag"`
Version string `json:"version"`
Name string `json:"name"`
Description string `json:"description"`
TotalAttempts int `json:"total_attempts"`
TimeAttempts time.Duration `json:"time_attempts"`
RetentionTime time.Duration `json:"retention_time"`
Steps []*Step `json:"steps"`
TpConsistency TpConsistency `json:"tp_consistency"`
Team string `json:"team"`
Level string `json:"level"`
CreatedBy string `json:"created_by"`
// contains filtered or unexported fields
}
func New ¶
func New(tag, version, name, description string, definition string, stop bool, createdBy string) *Flow
* * New * @param tag, version, name, description string, definition string, createdBy string * @return *Flow *
func NewByFile ¶
func NewByFile(tag, version, name, description string, filePath string, stop bool, createdBy string) *Flow
* * NewByFile * @param tag, version, name, description string, filePath string, stop bool, createdBy string * @return *Flow *
func NewFn ¶
* * NewFn * @param tag, version, name, description string, fn FnContext, createdBy string * @return *Flow *
func (*Flow) Consistency ¶
func (s *Flow) Consistency(consistency TpConsistency) *Flow
* * Consistency * @param consistency TpConsistency * @return *Flow *
func (*Flow) IfElse ¶
* * IfElse * @param expression string, yesGoTo int, noGoTo int * @return *Flow, error *
func (*Flow) Resilence ¶
func (s *Flow) Resilence(totalAttempts int, timeAttempts time.Duration, team string, level string) *Flow
* * Resilence * @param totalAttempts int, timeAttempts time.Duration * @return *Flow *
func (*Flow) Step ¶
* * Step * @param name, description string, definition string, stop bool * @return *Flow *
func (*Flow) StepByFile ¶
* * StepByFile * @param name, description string, filePath string, stop bool * @return *Flow *
type FlowStatus ¶
type FlowStatus string
const ( FlowStatusPending FlowStatus = "pending" FlowStatusRunning FlowStatus = "running" FlowStatusDone FlowStatus = "done" FlowStatusFailed FlowStatus = "failed" )
type Instance ¶
type Instance struct {
*Flow
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Tag string `json:"tag"`
Id string `json:"id"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
Status FlowStatus `json:"status"`
DoneAt time.Time `json:"done_at"`
Current int `json:"current"`
Ctx et.Json `json:"ctx"`
Ctxs map[int]et.Json `json:"ctxs"`
PinnedData et.Json `json:"pinned_data"`
Results map[int]*Result `json:"results"`
Tags et.Json `json:"tags"`
Rollbacks map[int]*Result `json:"rollbacks"`
WorkerHost string `json:"worker_host"`
// contains filtered or unexported fields
}
func GetInstance ¶
* * GetInstance * @param instanceId string * @return (*Instance, error) *
func (*Instance) SetPinnedData ¶
* * SetPinedData * @param key string, value interface{} *
func (*Instance) SetResult ¶
* * SetResult * @param result et.Json, err error * @return et.Json, error *
func (*Instance) SetStatus ¶
func (s *Instance) SetStatus(status FlowStatus) error
* * SetStatus * @param status FlowStatus * @return error *
type LoadFlowFn ¶
type LoadInstanceFn ¶
type Result ¶
type Result struct {
Step int `json:"step"`
Ctx et.Json `json:"ctx"`
Attempt int `json:"attempt"`
Result et.Json `json:"result"`
Error string `json:"error"`
}
type SaveFlowFn ¶
type SaveInstanceFn ¶
type Step ¶
type Step struct {
Name string `json:"name"`
Description string `json:"description"`
Type TpStep `json:"type"`
Stop bool `json:"stop"`
Expression string `json:"expression"`
YesGoTo int `json:"yes_go_to"`
NoGoTo int `json:"no_go_to"`
Definition string `json:"definition"`
// contains filtered or unexported fields
}
type TpConsistency ¶
type TpConsistency string
const ( TpConsistencyStrong TpConsistency = "strong" TpConsistencyEventual TpConsistency = "eventual" )