resilience

package
v1.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EVENT_RESILIENCE_STATUS  = "resilience:status"
	EVENT_RESILIENCE_STOP    = "resilience:stop"
	EVENT_RESILIENCE_RESTART = "resilience:restart"
	EVENT_RESILIENCE_FAILED  = "resilience:failed"
)
View Source
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
}

func (*Instance) Done added in v1.0.21

func (s *Instance) Done()

* * Done * @return error *

func (*Instance) Error added in v1.0.21

func (s *Instance) Error(err error)

* * Error * @param err error * @return error *

func (*Instance) IsEnd added in v0.1.18

func (s *Instance) IsEnd() bool

* * IsEnd * @return bool *

func (*Instance) IsFailed added in v0.1.18

func (s *Instance) IsFailed() bool

* * IsFailed * @return bool *

func (*Instance) Restart added in v1.0.21

func (s *Instance) Restart() et.Item

* * Restart * @return et.Item *

func (*Instance) Run added in v1.0.21

func (s *Instance) Run()

* * Run * @return error *

func (*Instance) Save added in v1.0.21

func (s *Instance) Save() error

* * Save * @return error *

func (*Instance) Serialize added in v1.0.21

func (s *Instance) Serialize() ([]byte, error)

* * Serialize * @return ([]byte, error) *

func (*Instance) Stop added in v1.0.21

func (s *Instance) Stop() et.Item

* * Stop * @return et.Item *

func (*Instance) ToJson added in v0.1.18

func (s *Instance) ToJson() et.Json

* * ToJson * @return et.Json *

func (*Instance) ToString added in v1.0.21

func (s *Instance) ToString() string

* * String * @return string *

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

type Status added in v0.1.18

type Status string
const (
	StatusPending Status = "pending"
	StatusRunning Status = "running"
	StatusDone    Status = "done"
	StatusStop    Status = "stop"
	StatusFailed  Status = "failed"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL