Documentation
¶
Index ¶
- Constants
- Variables
- type CheckList
- type Flow
- func (s *Flow) Consistency(consistency TpConsistency) *Flow
- func (s *Flow) Debug() *Flow
- func (s *Flow) DefineCheckList(tag string, description string) *Flow
- func (s *Flow) IfElse(expression string, yesGoTo int, noGoTo int) *Flow
- func (s *Flow) RemoveCheckList(tag string) *Flow
- func (s *Flow) Resilence(totalAttempts int, timeAttempts time.Duration, team string, level string) *Flow
- func (s *Flow) Rollback(fn FnContext) *Flow
- func (s *Flow) Step(name, description string, fn FnContext, stop bool) *Flow
- func (s *Flow) ToJson() et.Json
- type FnContext
- type Instance
- func (s *Instance) Done() error
- func (s *Instance) GetParam(key string) interface{}
- func (s *Instance) GetTag(key string) interface{}
- func (s *Instance) GetTraceByStep(step int) []et.Json
- func (s *Instance) GetTraces(idx int) (et.Json, error)
- func (s *Instance) Goto(step int) error
- func (s *Instance) PutParam(value et.Json) (et.Json, error)
- func (s *Instance) PutTag(tags et.Json) error
- func (s *Instance) Save() error
- func (s *Instance) Serialize() ([]byte, error)
- func (s *Instance) SetCheckList(tag string, ok bool, data et.Json) error
- func (s *Instance) SetCtx(ctx et.Json) error
- func (s *Instance) SetParam(key string, value interface{}) (et.Json, error)
- func (s *Instance) SetStatus(status Status) error
- func (s *Instance) SetTag(key string, value interface{}) error
- func (s *Instance) Stop() error
- func (s *Instance) ToJson() et.Json
- func (s *Instance) ToString() string
- type Result
- type Status
- type Step
- type TpConsistency
- type WorkFlow
- func (s *WorkFlow) Count() int
- func (s *WorkFlow) DeleteFlow(tag string) (bool, error)
- func (s *WorkFlow) Get(id string) (*Instance, bool)
- func (s *WorkFlow) GetInstance(instanceId string) (*Instance, error)
- func (s *WorkFlow) HttpGet(w http.ResponseWriter, r *http.Request)
- func (s *WorkFlow) HttpQuery(w http.ResponseWriter, r *http.Request)
- func (s *WorkFlow) HttpSetParams(w http.ResponseWriter, r *http.Request)
- func (s *WorkFlow) HttpState(w http.ResponseWriter, r *http.Request)
- func (s *WorkFlow) New(tag, version, name, description string, fn FnContext, stop bool, ...) *Flow
- func (s *WorkFlow) Reset(instanceId, updatedBy string) error
- func (s *WorkFlow) Rollback(instanceId, updatedBy string) (et.Json, error)
- func (s *WorkFlow) Run(instanceId, tag string, step int, ctx, tags et.Json, createdBy string) (et.Json, error)
- func (s *WorkFlow) Status(instanceId, status, updatedBy string) (Status, error)
- func (s *WorkFlow) Stop(instanceId, updatedBy string) error
Constants ¶
const ( EVENT_WORKFLOW_SET = "workflow:set" EVENT_WORKFLOW_DELETE = "workflow:delete" EVENT_WORKFLOW_STATUS = "workflow:status" EVENT_WORKFLOW_AWAITING = "workflow:awaiting" EVENT_WORKFLOW_RESULTS = "workflow:results" )
Variables ¶
var ( 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 Id:%s" MSG_INSTANCE_ALREADY_RUNNING = "Instancia ya en ejecucion Id:%s" MSG_INSTANCE_PENDING = "Instancia pendiente Id:%s" MSG_INSTANCE_CANCEL = "Instancia cancelada Id:%s" MSG_INSTANCE_LOSS = "Instancia perdida Id:%s" MSG_WORKFLOWS_NOT_LOAD = "workFlows not loaded" 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" MSG_INSTANCE_IFELSE = "Definido ifElse step:%d name:%s expresion:%s ? %d : %d tag:%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_EVALUATE = "error al evaluar expresion:%s, error:%s" )
var (
ErrorInstanceNotFound = fmt.Errorf(MSG_INSTANCE_NOT_FOUND)
)
Functions ¶
This section is empty.
Types ¶
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"`
Steps []*Step `json:"steps"`
TpConsistency TpConsistency `json:"tp_consistency"`
CheckList []*CheckList `json:"check_list"`
Team string `json:"team"`
Level string `json:"level"`
CreatedBy string `json:"created_by"`
// contains filtered or unexported fields
}
func (*Flow) Consistency ¶
func (s *Flow) Consistency(consistency TpConsistency) *Flow
* * Consistency * @param consistency TpConsistency * @return *Flow *
func (*Flow) DefineCheckList ¶ added in v1.0.21
* * DefineCheckList * @param tag string, description string, ok bool, data et.Json * @return *Flow *
func (*Flow) IfElse ¶
* * IfElse * @param expression string, yesGoTo int, noGoTo int * @return *Flow, error *
func (*Flow) RemoveCheckList ¶ added in v1.0.21
* * RemoveCheckList * @param tag string * @return *Flow *
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 *
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"`
Current int `json:"current"`
Ctx et.Json `json:"ctx"`
Ctxs map[int]et.Json `json:"ctxs"`
Results map[int]*Result `json:"results"`
Rollbacks map[int]*Result `json:"rollbacks"`
Params et.Json `json:"params"`
Traces []et.Json `json:"traces"`
Status Status `json:"status"`
DoneAt time.Time `json:"done_at"`
Tags et.Json `json:"tags"`
WorkerHost string `json:"worker_host"`
Resilence map[string]*resilience.Instance `json:"resilence"`
// contains filtered or unexported fields
}
func (*Instance) GetParam ¶ added in v1.0.21
* * GetParam * @param key string * @return interface{} *
func (*Instance) GetTraceByStep ¶ added in v1.0.21
* * GetTraceByStep * @params step int * @return []et.Json *
func (*Instance) GetTraces ¶ added in v1.0.21
* * GetTraces * @param idx int * @return (et.Json, error) *
func (*Instance) PutParam ¶ added in v1.0.21
* * PutParam * @param value et.Json * @return et.Json, error *
func (*Instance) SetCheckList ¶ added in v1.0.21
* * SetCheckList * @param tag string, ok bool, data et.Json * @return error *
func (*Instance) SetStatus ¶ added in v1.0.21
* * SetStatus * @param status Status * @return error *
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 Step ¶
type TpConsistency ¶
type TpConsistency string
const ( TpConsistencyStrong TpConsistency = "strong" TpConsistencyEventual TpConsistency = "eventual" )
type WorkFlow ¶ added in v1.0.21
type WorkFlow struct {
Flows map[string]*Flow `json:"flows"`
Instances map[string]*Instance `json:"instances"`
Results map[string]et.Json `json:"results"`
// contains filtered or unexported fields
}
func (*WorkFlow) DeleteFlow ¶ added in v1.0.21
* * DeleteFlow * @param tag string * @return (bool, error) *
func (*WorkFlow) GetInstance ¶ added in v1.0.21
* * GetInstance * @param instanceId string * @return (*Instance, error) *
func (*WorkFlow) HttpGet ¶ added in v1.0.21
func (s *WorkFlow) HttpGet(w http.ResponseWriter, r *http.Request)
* * HttpGet * @params w http.ResponseWriter, r *http.Request *
func (*WorkFlow) HttpQuery ¶ added in v1.0.21
func (s *WorkFlow) HttpQuery(w http.ResponseWriter, r *http.Request)
* * HttpQuery * @params w http.ResponseWriter, r *http.Request *
func (*WorkFlow) HttpSetParams ¶ added in v1.0.21
func (s *WorkFlow) HttpSetParams(w http.ResponseWriter, r *http.Request)
* * HttpSetParams * @params w http.ResponseWriter, r *http.Request *
func (*WorkFlow) HttpState ¶ added in v1.0.21
func (s *WorkFlow) HttpState(w http.ResponseWriter, r *http.Request)
* * HttpState * @params w http.ResponseWriter, r *http.Request *
func (*WorkFlow) New ¶ added in v1.0.21
func (s *WorkFlow) New(tag, version, name, description string, fn FnContext, stop bool, createdBy string) *Flow
* * New * @param tag, version, name, description string, fn FnContext, createdBy string * @return *Flow *
func (*WorkFlow) Reset ¶ added in v1.0.21
* * Reset * @param instanceId, updatedBy string * @return error *
func (*WorkFlow) Rollback ¶ added in v1.0.21
* * Rollback * @param instanceId, updatedBy string * @return et.Json, error *
func (*WorkFlow) Run ¶ added in v1.0.21
func (s *WorkFlow) Run(instanceId, tag string, step int, ctx, tags et.Json, createdBy string) (et.Json, error)
* * Run * @param instanceId, tag string, step int, ctx, tags et.Json, createdBy string * @return et.Json, error *