Documentation ¶
Index ¶
- Variables
- func CreateBuiltinActions(db *sql.DB) error
- func CreateBuiltinEnvironments(db *sql.DB) error
- func DeleteWorker(db *sql.DB, id string) error
- func DeleteWorkerModel(db gorp.SqlExecutor, ID int64) error
- func DeleteWorkerModelCapability(db database.Executer, workerID int64, capaName string) error
- func EstimateWorkerModelNeeds(db *sql.DB, uid int64, workerModelStatus ModelStatusFunc, ...) ([]sdk.ModelStatus, error)
- func FindBuildingWorker(db database.Querier, actionBuildID string) (string, error)
- func GenerateToken() (string, error)
- func GetModelCapabilities(db database.Querier, modelID int64) ([]sdk.Requirement, error)
- func Heartbeat()
- func InsertToken(db *sql.DB, groupID int64, token string, e sdk.Expiration) error
- func InsertWorker(db database.Executer, w *sdk.Worker, groupID int64) error
- func InsertWorkerModel(db gorp.SqlExecutor, model *sdk.Model) error
- func LoadDeadWorkers(db *sql.DB, timeout float64) ([]sdk.Worker, error)
- func LoadSharedWorkerModels(db gorp.SqlExecutor) ([]sdk.Model, error)
- func LoadWorker(db database.Querier, id string) (*sdk.Worker, error)
- func LoadWorkerModelByID(db gorp.SqlExecutor, ID int64) (*sdk.Model, error)
- func LoadWorkerModelByName(db gorp.SqlExecutor, name string) (*sdk.Model, error)
- func LoadWorkerModelCapabilities(db database.Querier, workerID int64) ([]sdk.Requirement, error)
- func LoadWorkerModelStatusForAdminUser(db *sql.DB, userID int64) ([]sdk.ModelStatus, error)
- func LoadWorkerModelStatusForGroup(db *sql.DB, groupID int64) ([]sdk.ModelStatus, error)
- func LoadWorkerModels(db gorp.SqlExecutor) ([]sdk.Model, error)
- func LoadWorkerModelsByGroup(db gorp.SqlExecutor, groupID int64) ([]sdk.Model, error)
- func LoadWorkerModelsByUser(db gorp.SqlExecutor, userID int64) ([]sdk.Model, error)
- func LoadWorkerModelsUsableOnGroup(db gorp.SqlExecutor, groupID, sharedinfraGroupID int64) ([]sdk.Model, error)
- func LoadWorkers(db *sql.DB) ([]sdk.Worker, error)
- func LoadWorkersByModel(db database.Querier, modelID int64) ([]sdk.Worker, error)
- func ModelCapabilititiesCacheLoader(delay time.Duration)
- func RefreshWorker(db *sql.DB, workerID string) error
- func RegisterWorker(db *sql.DB, name string, key string, modelID int64, h *sdk.Hatchery, ...) (*sdk.Worker, error)
- func SetStatus(db database.Executer, workerID string, status sdk.Status) error
- func SetToBuilding(db database.Executer, workerID string, actionBuildID int64) error
- func UpdateWorkerModel(db gorp.SqlExecutor, model sdk.Model) error
- func UpdateWorkerModelCapability(db database.Executer, capa sdk.Requirement, modelID int64) error
- func UpdateWorkerStatus(db database.Executer, workerID string, status sdk.Status) error
- type ActionBuildInfo
- type ActionCount
- type ActionCountFunc
- type ModelStatusFunc
- type RegistrationForm
- type Token
Constants ¶
This section is empty.
Variables ¶
var ErrNoWorker = fmt.Errorf("cds: no worker found")
ErrNoWorker means the given worker ID is not found
var WorkerHeartbeatTimeout = 30.0
WorkerHeartbeatTimeout defines the number of seconds allowed for workers to refresh their beat
Functions ¶
func CreateBuiltinActions ¶
CreateBuiltinActions add builtin actions in database if needed
func CreateBuiltinEnvironments ¶
CreateBuiltinEnvironments creates default environment if needed
func DeleteWorker ¶
DeleteWorker remove worker from database
func DeleteWorkerModel ¶
func DeleteWorkerModel(db gorp.SqlExecutor, ID int64) error
DeleteWorkerModel removes from database worker model informations and all its capabilities
func DeleteWorkerModelCapability ¶
DeleteWorkerModelCapability removes a capability from existing worker model
func EstimateWorkerModelNeeds ¶
func EstimateWorkerModelNeeds(db *sql.DB, uid int64, workerModelStatus ModelStatusFunc, actionCount ActionCountFunc) ([]sdk.ModelStatus, error)
EstimateWorkerModelNeeds returns for each worker model the needs of instances
func FindBuildingWorker ¶
FindBuildingWorker retrieves in database the worker building given actionBuildID
func GenerateToken ¶
GenerateToken generate a random 64bytes hexadecimal string
func GetModelCapabilities ¶
GetModelCapabilities load model capabilities from cache
func Heartbeat ¶
func Heartbeat()
Heartbeat runs in a goroutine and check last beat from all workers on a 10s basis
func InsertToken ¶
InsertToken inserts a new token in database
func InsertWorker ¶
InsertWorker inserts worker representation into database
func InsertWorkerModel ¶
func InsertWorkerModel(db gorp.SqlExecutor, model *sdk.Model) error
InsertWorkerModel insert a new worker model in database
func LoadDeadWorkers ¶
LoadDeadWorkers load worker with refresh last beat > timeout
func LoadSharedWorkerModels ¶
func LoadSharedWorkerModels(db gorp.SqlExecutor) ([]sdk.Model, error)
LoadSharedWorkerModels returns worker models with group shared.infra
func LoadWorker ¶
LoadWorker retrieves worker in database
func LoadWorkerModelByID ¶
LoadWorkerModelByID retrieves a specific worker model in database
func LoadWorkerModelByName ¶
LoadWorkerModelByName retrieves a specific worker model in database
func LoadWorkerModelCapabilities ¶
LoadWorkerModelCapabilities retrieves capabilities of given worker model
func LoadWorkerModelStatusForAdminUser ¶
LoadWorkerModelStatusForAdminUser lods worker model status for group
func LoadWorkerModelStatusForGroup ¶
LoadWorkerModelStatusForGroup lods worker model status for group
func LoadWorkerModels ¶
func LoadWorkerModels(db gorp.SqlExecutor) ([]sdk.Model, error)
LoadWorkerModels retrieves models from database
func LoadWorkerModelsByGroup ¶
LoadWorkerModelsByGroup returns worker models for a group
func LoadWorkerModelsByUser ¶
LoadWorkerModelsByUser returns worker models list according to user's groups
func LoadWorkerModelsUsableOnGroup ¶
func LoadWorkerModelsUsableOnGroup(db gorp.SqlExecutor, groupID, sharedinfraGroupID int64) ([]sdk.Model, error)
LoadWorkerModelsUsableOnGroup returns worker models for a group
func LoadWorkers ¶
LoadWorkers load all workers in db
func LoadWorkersByModel ¶
LoadWorkersByModel load workers by model
func ModelCapabilititiesCacheLoader ¶
ModelCapabilititiesCacheLoader set all model Capabilities in the cache
func RefreshWorker ¶
RefreshWorker Update worker last_beat
func RegisterWorker ¶
func RegisterWorker(db *sql.DB, name string, key string, modelID int64, h *sdk.Hatchery, binaryCapabilities []string) (*sdk.Worker, error)
RegisterWorker Register new worker
func SetToBuilding ¶
SetToBuilding sets action_build_id and status to building on given worker
func UpdateWorkerModel ¶
func UpdateWorkerModel(db gorp.SqlExecutor, model sdk.Model) error
UpdateWorkerModel update a worker model
func UpdateWorkerModelCapability ¶
UpdateWorkerModelCapability update a worker model capability
Types ¶
type ActionBuildInfo ¶
type ActionBuildInfo struct { ActionBuild sdk.ActionBuild Action sdk.Action Secrets []sdk.Variable }
ActionBuildInfo is returned to worker in answer to takeActionBuildHandler
type ActionCount ¶
ActionCount represents a count of action
func LoadAllActionCount ¶
func LoadAllActionCount(db *sql.DB, userID int64) ([]ActionCount, error)
LoadAllActionCount counts all waiting actions
func LoadGroupActionCount ¶
func LoadGroupActionCount(db *sql.DB, groupID int64) ([]ActionCount, error)
LoadGroupActionCount counts waiting action for group
type ActionCountFunc ¶
type ActionCountFunc func(*sql.DB, int64) ([]ActionCount, error)
ActionCountFunc ...
type ModelStatusFunc ¶
ModelStatusFunc ...
type RegistrationForm ¶
type RegistrationForm struct { Name string UserKey string Model int64 Hatchery int64 BinaryCapabilities []string }
RegistrationForm represents the arguments needed to register a worker