Documentation
¶
Index ¶
- Constants
- func Continue(instanceId, tag string, ctx et.Json) (et.Json, error)
- func DeleteFlow(tag string) (bool, error)
- func FlowToJson(flow *Flow) et.Json
- func HealthCheck() bool
- func Load() error
- func Rollback(instanceId, tag string) (et.Json, error)
- func Run(instanceId, tag string, startId int, tags et.Json, ctx et.Json) (et.Json, error)
- func Start(instanceId, tag string, startId int, tags et.Json, ctx et.Json) (et.Json, error)
- type Flow
- func (s *Flow) Consistency(consistency TpConsistency) *Flow
- func (s *Flow) Continue(ctx et.Json) (et.Json, error)
- func (s *Flow) Debug() *Flow
- func (s *Flow) Done() error
- func (s *Flow) Goto(step int) error
- 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) Run(startId int, ctx et.Json) (et.Json, error)
- func (s *Flow) Step(name, description string, fn FnContext, stop bool) *Flow
- func (s *Flow) Stop() error
- func (s *Flow) ToJson() et.Json
- type FlowStatus
- type FnContext
- type Result
- type Step
- type TpConsistency
- type WorkFlows
- func (s *WorkFlows) Continue(instanceId, tag string, ctx et.Json) (et.Json, error)
- func (s *WorkFlows) DeleteFlow(tag string) bool
- func (s *WorkFlows) Done(instanceId string) bool
- func (s *WorkFlows) HealthCheck() bool
- func (s *WorkFlows) NewFlow(tag, version, name, description string, fn FnContext, stop bool, ...) *Flow
- func (s *WorkFlows) Rollback(instanceId, tag string) (et.Json, error)
- func (s *WorkFlows) Run(instanceId, tag string, startId int, tags, ctx et.Json) (et.Json, error)
- func (s *WorkFlows) Start(instanceId, tag string, startId int, tags, ctx et.Json) (et.Json, error)
Constants ¶
const ( EVENT_WORKFLOW_SET = "workflow:set" EVENT_WORKFLOW_DELETE = "workflow:delete" EVENT_WORKFLOW_STATUS = "workflow:status" )
const ( FlowStatusPending FlowStatus = "pending" FlowStatusRunning FlowStatus = "running" FlowStatusDone FlowStatus = "done" FlowStatusFailed FlowStatus = "failed" TpConsistencyStrong TpConsistency = "strong" TpConsistencyEventual TpConsistency = "eventual" )
const ( MSG_FLOW_CREATED = "Flujo creado 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_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, message:%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 = "Step creado:%d name:%s Tag:%s" MSG_INSTANCE_ROLLBACK_CREATED = "Rollback creado:%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 = "Resilencia definida Tag:%s totalAttempts:%d timeAttempts:%s retentionTime:%s" MSG_INSTANCE_IFELSE = "IfElse definido step:%d name:%s expresion:%s ? %d : %d Tag:%s" MSG_INSTANCE_RETENTION = "Retencion definida 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 finalizada:%s" )
Variables ¶
This section is empty.
Functions ¶
func Continue ¶ added in v1.1.127
* * Continue * @param instanceId, tag string, ctx et.Json * @return et.Json, error *
func DeleteFlow ¶
* * DeleteFlow * @param tag string * @return (bool, error) *
func FlowToJson ¶ added in v1.1.127
* * FlowToJson * @param flow *Flow * @return et.Json *
Types ¶
type Flow ¶
type Flow struct {
Tag string `json:"tag"`
Version string `json:"version"`
Name string `json:"name"`
Description string `json:"description"`
Current int `json:"current"`
TotalAttempts int `json:"total_attempts"`
TimeAttempts time.Duration `json:"time_attempts"`
RetentionTime time.Duration `json:"retention_time"`
Ctx et.Json `json:"ctx"`
Steps []*Step `json:"steps"`
Ctxs map[int]et.Json `json:"ctxs"`
Results map[int]Result `json:"results"`
Rollbacks map[int]Result `json:"rollbacks"`
LastRollback int `json:"last_rollback"`
TpConsistency TpConsistency `json:"tp_consistency"`
Id string `json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DoneAt time.Time `json:"done_at"`
Status FlowStatus `json:"status"`
CreatedBy string `json:"created_by"`
WorkerHost string `json:"worker_host"`
Tags et.Json `json:"tags"`
// contains filtered or unexported fields
}
func New ¶
* * New * @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) Continue ¶ added in v1.1.127
* * Continue * @param ctx et.Json * @return et.Json, error *
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) Retention ¶ added in v1.1.127
* * Retention * @param retentionTime time.Duration * @return *Flow *
func (*Flow) Run ¶
* * Run * @param startId int, tags et.Json, ctx et.Json * @return et.Json, error *
type FlowStatus ¶
type FlowStatus string
type Step ¶
type Step struct {
Name string `json:"name"`
Description string `json:"description"`
Stop bool `json:"stop"`
Expression string `json:"expression"`
YesGoTo int `json:"yes_go_to"`
NoGoTo int `json:"no_go_to"`
// contains filtered or unexported fields
}
type TpConsistency ¶
type TpConsistency string
type WorkFlows ¶
type WorkFlows struct {
Flows map[string]*Flow `json:"flows"`
Instance map[string]*Flow `json:"instance"`
}
func (*WorkFlows) Continue ¶ added in v1.1.127
* * Continue * @param instanceId, tag string, ctx et.Json * @return et.Json, error *
func (*WorkFlows) DeleteFlow ¶
* * DeleteFlow * @param tag string * @return bool *
func (*WorkFlows) HealthCheck ¶
* * HealthCheck * @return bool *
func (*WorkFlows) NewFlow ¶
func (s *WorkFlows) NewFlow(tag, version, name, description string, fn FnContext, stop bool, createdBy string) *Flow
* * NewFlow * @param tag, version, name, description string, fn FnContext, stop bool, createdBy string * @return *Flow *