Documentation
¶
Index ¶
- Constants
- type Instance
- func (s *Instance) Done()
- func (s *Instance) Error(err error)
- func (s *Instance) IsEnd() bool
- func (s *Instance) IsFailed() bool
- func (s *Instance) Restart() et.Item
- func (s *Instance) Run()
- func (s *Instance) Save() error
- func (s *Instance) Serialize() ([]byte, error)
- func (s *Instance) Stop() et.Item
- func (s *Instance) ToJson() et.Json
- func (s *Instance) ToString() string
- type Resilience
- func (s *Resilience) Count() int
- func (s *Resilience) Get(id string) (*Instance, bool)
- func (s *Resilience) HttpGet(w http.ResponseWriter, r *http.Request)
- func (s *Resilience) HttpQuery(w http.ResponseWriter, r *http.Request)
- func (s *Resilience) HttpSetParams(w http.ResponseWriter, r *http.Request)
- func (s *Resilience) HttpState(w http.ResponseWriter, r *http.Request)
- func (s *Resilience) Restart(id string) error
- func (s *Resilience) Run(tag, description string, totalAttempts int, interval time.Duration, ...) *Instance
- func (s *Resilience) RunCustom(tag, description string, tags et.Json, team string, level string, ...) *Instance
- func (s *Resilience) Stop(id string) error
- type Status
Constants ¶
const ( EVENT_RESILIENCE_STATUS = "resilience:status" EVENT_RESILIENCE_STOP = "resilience:stop" EVENT_RESILIENCE_RESTART = "resilience:restart" EVENT_RESILIENCE_FAILED = "resilience:failed" )
const ( MSG_RESILIENCE_NOT_INITIALIZED = "resilience no esta inicializado" MSG_ID_REQUIRED = "id es requerido" MSG_ID_NOT_FOUND = "id no encontrado" MSG_INSTANCE_STOPPED = "intento detenido" MSG_INSTANCE_RESTARTED = "intento reiniciado" MSG_INSTANCE_NOT_FOUND = "intento no encontrado" MSG_RESILIENCE_STATUS = "Attempt:%d de %d Instance:%s, Tag:%s Status:%s" MSG_RESILIENCE_ERROR = "Attempt:%d de %d Error en Instance:%s Tag:%s Status:%s, Error:%s" MSG_RESILIENCE_FINISHED = "Attempt:%d de %d Finalizado Instance:%s Tag:%s Status:%s" MSG_RESILIENCE_FINISHED_ERROR = "Attempt:%d de %d Finalizado con error Instance:%s Tag:%s Status:%s, Error:%s" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶ added in v0.1.18
type Instance struct {
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastAttemptAt time.Time `json:"last_attempt_at"`
DoneAt time.Time `json:"done_at"`
ID string `json:"id"`
Tag string `json:"tag"`
Description string `json:"description"`
Status Status `json:"status"`
Attempt int `json:"attempt"`
TotalAttempts int `json:"total_attempts"`
Interval time.Duration `json:"interval"`
Tags et.Json `json:"tags"`
Team string `json:"team"`
Level string `json:"level"`
// contains filtered or unexported fields
}
type Resilience ¶ added in v1.0.21
type Resilience struct {
// contains filtered or unexported fields
}
func New ¶ added in v1.0.21
func New(store instances.Store) (*Resilience, error)
* * New * @return *Resilience, error
func (*Resilience) Count ¶ added in v1.0.21
func (s *Resilience) Count() int
* * Count * @return int
func (*Resilience) Get ¶ added in v1.0.21
func (s *Resilience) Get(id string) (*Instance, bool)
* * Get * @param id string * @return *Instance, bool
func (*Resilience) HttpGet ¶ added in v1.0.21
func (s *Resilience) HttpGet(w http.ResponseWriter, r *http.Request)
* * HttpGet * @params w http.ResponseWriter, r *http.Request *
func (*Resilience) HttpQuery ¶ added in v1.0.21
func (s *Resilience) HttpQuery(w http.ResponseWriter, r *http.Request)
* * HttpQuery * @params w http.ResponseWriter, r *http.Request *
func (*Resilience) HttpSetParams ¶ added in v1.0.21
func (s *Resilience) HttpSetParams(w http.ResponseWriter, r *http.Request)
* * HttpSetParams * @params w http.ResponseWriter, r *http.Request *
func (*Resilience) HttpState ¶ added in v1.0.21
func (s *Resilience) HttpState(w http.ResponseWriter, r *http.Request)
* * HttpState * @params w http.ResponseWriter, r *http.Request *
func (*Resilience) Restart ¶ added in v1.0.21
func (s *Resilience) Restart(id string) error
* * Restart * @param id string * @return error
func (*Resilience) Run ¶ added in v1.0.21
func (s *Resilience) Run(tag, description string, totalAttempts int, interval time.Duration, tags et.Json, team string, level string, fn interface{}, fnArgs ...interface{}) *Instance
* * Run * @param tag, description string, totalAttempts int, interval time.Duration, tags et.Json, team string, level string, fn interface{}, fnArgs ...interface{} * @return *Instance
func (*Resilience) RunCustom ¶ added in v1.0.21
func (s *Resilience) RunCustom(tag, description string, tags et.Json, team string, level string, fn interface{}, fnArgs ...interface{}) *Instance
* * RunCustom * @param tag, description string, tags et.Json, team string, level string, fn interface{}, fnArgs ...interface{} * @return *Instance
func (*Resilience) Stop ¶ added in v1.0.21
func (s *Resilience) Stop(id string) error
* * Stop * @param id string * @return error