hatchery

package
v0.0.0-...-a57a29f Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2016 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HatcheryHeartbeatTimeout = 30.0

HatcheryHeartbeatTimeout defines the number of seconds allowed for hatcheries to refresh their beat

Functions

func DeleteHatchery

func DeleteHatchery(db *sql.DB, id int64, workerModelID int64) error

DeleteHatchery removes from database given hatchery and linked model

func Exists

func Exists(db *sql.DB, id int64) error

Exists returns an error is hatchery with given id does not exists

func Heartbeat

func Heartbeat()

Heartbeat runs in a goroutine and check last beat from all hatcheries on a 10s basis

func InsertHatchery

func InsertHatchery(db *sql.DB, h *Hatchery) error

InsertHatchery registers in database new hatchery

func RefreshHatchery

func RefreshHatchery(db *sql.DB, hatchID string) error

RefreshHatchery Update hatchery last_beat

Types

type Hatchery

type Hatchery struct {
	ID       int64     `json:"id"`
	Name     string    `json:"name"`
	Status   string    `json:"status"`
	OwnerID  int64     `json:"owner_id"`
	LastBeat time.Time `json:"-"`
	Model    sdk.Model `json:"model"`
}

Hatchery registration model

func LoadDeadHatcheries

func LoadDeadHatcheries(db *sql.DB, timeout float64) ([]Hatchery, error)

LoadDeadHatcheries load hatchery with refresh last beat > timeout

func LoadHatcheries

func LoadHatcheries(db *sql.DB) ([]Hatchery, error)

LoadHatcheries retrieves in database all registered hatcheries

Jump to

Keyboard shortcuts

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