checkins

package
v0.90.57 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Samples

func Samples() error

func SamplesChkHits

func SamplesChkHits() error

func SetDB

func SetDB(database database.Database)

Types

type Checkin

type Checkin struct {
	Id          int64               `gorm:"primary_key;column:id" json:"id"`
	ServiceId   int64               `gorm:"index;column:service" json:"service_id"`
	Name        string              `gorm:"column:name" json:"name"`
	Interval    int64               `gorm:"column:check_interval" json:"interval"`
	GracePeriod int64               `gorm:"column:grace_period"  json:"grace"`
	ApiKey      string              `gorm:"column:api_key"  json:"api_key"`
	CreatedAt   time.Time           `gorm:"column:created_at" json:"created_at"`
	UpdatedAt   time.Time           `gorm:"column:updated_at" json:"updated_at"`
	Running     chan bool           `gorm:"-" json:"-"`
	Failing     bool                `gorm:"-" json:"failing"`
	LastHitTime time.Time           `gorm:"-" json:"last_hit"`
	AllHits     []*CheckinHit       `gorm:"-" json:"hits"`
	AllFailures []*failures.Failure `gorm:"-" json:"failures"`
}

Checkin struct will allow an application to send a recurring HTTP GET to confirm a service is online

func All

func All() []*Checkin

func Find

func Find(id int64) (*Checkin, error)

func FindByAPI

func FindByAPI(key string) (*Checkin, error)

func (*Checkin) AfterFind added in v0.90.53

func (c *Checkin) AfterFind()

func (*Checkin) Close

func (c *Checkin) Close()

Close will stop the checkin routine

func (*Checkin) Create

func (c *Checkin) Create() error

func (*Checkin) CreateFailure

func (c *Checkin) CreateFailure(f *failures.Failure) error

func (*Checkin) Delete

func (c *Checkin) Delete() error

func (*Checkin) Expected

func (c *Checkin) Expected() time.Duration

func (*Checkin) Failures

func (c *Checkin) Failures() failures.Failurer

func (*Checkin) FailuresColumnID

func (c *Checkin) FailuresColumnID() (string, int64)

func (*Checkin) FailuresSince

func (c *Checkin) FailuresSince(t time.Time) failures.Failurer

func (*Checkin) Grace

func (c *Checkin) Grace() time.Duration

Grace will return the duration of the Checkin Grace Period (after service hasn't responded, wait a bit for a response)

func (*Checkin) Hits

func (c *Checkin) Hits() []*CheckinHit

func (*Checkin) IsRunning

func (c *Checkin) IsRunning() bool

IsRunning returns true if the checkin go routine is running

func (*Checkin) LastHit

func (c *Checkin) LastHit() *CheckinHit
func (c *Checkin) Link() string

func (*Checkin) Period

func (c *Checkin) Period() time.Duration

func (*Checkin) RecheckCheckinFailure

func (c *Checkin) RecheckCheckinFailure(guard chan struct{})

RecheckCheckinFailure will check if a Service Checkin has been reported yet

func (*Checkin) Start

func (c *Checkin) Start()

Start will create a channel for the checkin checking go routine

func (*Checkin) String

func (c *Checkin) String() string

String will return a Checkin API string

func (*Checkin) Update

func (c *Checkin) Update() error

type CheckinHit

type CheckinHit struct {
	Id        int64     `gorm:"primary_key;column:id" json:"id"`
	Checkin   int64     `gorm:"index;column:checkin" json:"-"`
	From      string    `gorm:"column:from_location" json:"from"`
	CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`
}

CheckinHit is a successful response from a Checkin

func (*CheckinHit) Create

func (c *CheckinHit) Create() error

func (*CheckinHit) Delete

func (c *CheckinHit) Delete() error

func (*CheckinHit) Update

func (c *CheckinHit) Update() error

Jump to

Keyboard shortcuts

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