Documentation
¶
Index ¶
- Variables
- func BookForRegister(store cache.Store, id int64, serviceID int64) error
- func ComputeRegistrationNeeds(db gorp.SqlExecutor, allBinaryReqs sdk.RequirementList, ...) error
- func CopyModelTypeData(old, data *sdk.Model) error
- func Create(ctx context.Context, db gorpmapper.SqlExecutorWithTx, data sdk.Model, ...) (*sdk.Model, error)
- func DeleteByID(db gorp.SqlExecutor, id int64) error
- func DeleteCapabilitiesByModelID(db gorp.SqlExecutor, workerModelID int64) error
- func DeletePatternByID(db gorp.SqlExecutor, patternID int64) error
- func DeleteSecretForModelID(db gorp.SqlExecutor, workerModelID int64, field string) error
- func Export(wm sdk.Model, f exportentities.Format, w io.Writer, ...) (int, error)
- func Initialize(c context.Context, DBFunc func() *gorp.DbMap, store cache.Store) error
- func Insert(ctx context.Context, db gorpmapper.SqlExecutorWithTx, model *sdk.Model) error
- func InsertCapabilityForModelID(db gorp.SqlExecutor, workerModelID int64, r *sdk.Requirement) error
- func InsertPattern(db gorp.SqlExecutor, modelPattern *sdk.ModelPattern) error
- func InsertSecret(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s *sdk.WorkerModelSecret) error
- func KeyBookWorkerModel(id int64) string
- func LoadAll(ctx context.Context, db gorp.SqlExecutor, filter *LoadFilter, ...) ([]sdk.Model, error)
- func LoadAllActiveAndNotDeprecatedForGroupIDs(ctx context.Context, db gorp.SqlExecutor, groupIDs []int64, ...) ([]sdk.Model, error)
- func LoadAllByGroupIDs(ctx context.Context, db gorp.SqlExecutor, groupIDs []int64, filter *LoadFilter, ...) ([]sdk.Model, error)
- func LoadAllByNameAndGroupIDs(ctx context.Context, db gorp.SqlExecutor, name string, groupIDs []int64, ...) ([]sdk.Model, error)
- func LoadAllUsableByGroupIDs(ctx context.Context, db gorp.SqlExecutor, groupIDs []int64, ...) ([]sdk.Model, error)
- func LoadByID(ctx context.Context, db gorp.SqlExecutor, id int64, opts ...LoadOptionFunc) (*sdk.Model, error)
- func LoadByNameAndGroupID(ctx context.Context, db gorp.SqlExecutor, name string, groupID int64, ...) (*sdk.Model, error)
- func LoadCapabilitiesByModelID(ctx context.Context, db gorp.SqlExecutor, workerModelID int64) (sdk.RequirementList, error)
- func LoadPatternByNameAndType(ctx context.Context, db gorp.SqlExecutor, patternType, patternName string) (*sdk.ModelPattern, error)
- func LoadPatterns(ctx context.Context, db gorp.SqlExecutor) ([]sdk.ModelPattern, error)
- func LoadSecretByModelIDAndName(ctx context.Context, db gorp.SqlExecutor, workerModelID int64, name string) (*sdk.WorkerModelSecret, error)
- func LoadSecretsByModelID(ctx context.Context, db gorp.SqlExecutor, workerModelID int64) (sdk.WorkerModelSecrets, error)
- func Status(db *gorp.DbMap) sdk.MonitoringStatusLine
- func UnbookForRegister(ctx context.Context, store cache.Store, id int64)
- func Update(ctx context.Context, db gorpmapper.SqlExecutorWithTx, old *sdk.Model, ...) (*sdk.Model, error)
- func UpdateCapabilities(ctx context.Context, db gorp.SqlExecutor, modelID int64, ...) error
- func UpdateDB(ctx context.Context, db gorpmapper.SqlExecutorWithTx, model *sdk.Model) error
- func UpdateOSAndArch(db gorp.SqlExecutor, modelID int64, OS, arch string) error
- func UpdatePattern(db gorp.SqlExecutor, modelPattern *sdk.ModelPattern) error
- func UpdateRegistration(ctx context.Context, db gorp.SqlExecutor, store cache.Store, modelID int64) error
- func UpdateSecret(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s *sdk.WorkerModelSecret) error
- func UpdateSpawnErrorWorkerModel(db gorp.SqlExecutor, modelID int64, spawnError sdk.SpawnErrorForm) error
- type LoadFilter
- type LoadOptionFunc
- type StateFilter
Constants ¶
This section is empty.
Variables ¶
var LoadOptions = struct { Default LoadOptionFunc WithGroup LoadOptionFunc WithCapabilities LoadOptionFunc }{ Default: loadDefault, WithGroup: loadGroup, WithCapabilities: loadCapabilities, }
LoadOptions provides all options to load worker models.
Functions ¶
func BookForRegister ¶
BookForRegister books a worker model for register, used by hatcheries
func ComputeRegistrationNeeds ¶
func ComputeRegistrationNeeds(db gorp.SqlExecutor, allBinaryReqs sdk.RequirementList, reqs sdk.RequirementList) error
ComputeRegistrationNeeds checks if worker models need to be register if requirements contains "binary" type: all workers model need to be registered again by setting flag need_registration to true in DB.
func CopyModelTypeData ¶
CopyModelTypeData try to set missing type info for given model data.
func Create ¶
func Create(ctx context.Context, db gorpmapper.SqlExecutorWithTx, data sdk.Model, ident sdk.Identifiable) (*sdk.Model, error)
Create returns a new worker model for given data.
func DeleteByID ¶
func DeleteByID(db gorp.SqlExecutor, id int64) error
DeleteByID a worker model from database and all its capabilities.
func DeleteCapabilitiesByModelID ¶
func DeleteCapabilitiesByModelID(db gorp.SqlExecutor, workerModelID int64) error
DeleteCapabilitiesByModelID removes all capabilities from database for given worker model id.
func DeletePatternByID ¶
func DeletePatternByID(db gorp.SqlExecutor, patternID int64) error
DeletePatternByID removes from database the worker model pattern.
func DeleteSecretForModelID ¶
func DeleteSecretForModelID(db gorp.SqlExecutor, workerModelID int64, field string) error
DeleteSecretForModelID remove registry secret from database for given model.
func Export ¶
func Export(wm sdk.Model, f exportentities.Format, w io.Writer, opts ...exportentities.WorkerModelOption) (int, error)
Export convert sdk.Model to an exportentities.WorkerModel, format and write into a io.Writer
func Initialize ¶
Initialize worker model package.
func Insert ¶
func Insert(ctx context.Context, db gorpmapper.SqlExecutorWithTx, model *sdk.Model) error
Insert a new worker model in database.
func InsertCapabilityForModelID ¶
func InsertCapabilityForModelID(db gorp.SqlExecutor, workerModelID int64, r *sdk.Requirement) error
InsertCapabilityForModelID inserts given capability in database.
func InsertPattern ¶
func InsertPattern(db gorp.SqlExecutor, modelPattern *sdk.ModelPattern) error
InsertPattern in database.
func InsertSecret ¶
func InsertSecret(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s *sdk.WorkerModelSecret) error
InsertSecret in database.
func KeyBookWorkerModel ¶
KeyBookWorkerModel returns cache key for given model id.
func LoadAll ¶
func LoadAll(ctx context.Context, db gorp.SqlExecutor, filter *LoadFilter, opts ...LoadOptionFunc) ([]sdk.Model, error)
LoadAll retrieves worker models from database.
func LoadAllActiveAndNotDeprecatedForGroupIDs ¶
func LoadAllActiveAndNotDeprecatedForGroupIDs(ctx context.Context, db gorp.SqlExecutor, groupIDs []int64, opts ...LoadOptionFunc) ([]sdk.Model, error)
LoadAllActiveAndNotDeprecatedForGroupIDs retrieves models for given group ids.
func LoadAllByGroupIDs ¶
func LoadAllByGroupIDs(ctx context.Context, db gorp.SqlExecutor, groupIDs []int64, filter *LoadFilter, opts ...LoadOptionFunc) ([]sdk.Model, error)
LoadAllByGroupIDs returns worker models list for given group ids.
func LoadAllByNameAndGroupIDs ¶
func LoadAllByNameAndGroupIDs(ctx context.Context, db gorp.SqlExecutor, name string, groupIDs []int64, opts ...LoadOptionFunc) ([]sdk.Model, error)
LoadAllByNameAndGroupIDs retrieves all worker model with given name for group ids in database.
func LoadAllUsableByGroupIDs ¶
func LoadAllUsableByGroupIDs(ctx context.Context, db gorp.SqlExecutor, groupIDs []int64, opts ...LoadOptionFunc) ([]sdk.Model, error)
LoadAllUsableByGroupIDs returns usable worker models for given group ids.
func LoadByID ¶
func LoadByID(ctx context.Context, db gorp.SqlExecutor, id int64, opts ...LoadOptionFunc) (*sdk.Model, error)
LoadByID retrieves a specific worker model in database.
func LoadByNameAndGroupID ¶
func LoadByNameAndGroupID(ctx context.Context, db gorp.SqlExecutor, name string, groupID int64, opts ...LoadOptionFunc) (*sdk.Model, error)
LoadByNameAndGroupID retrieves a specific worker model in database by name and group id.
func LoadCapabilitiesByModelID ¶
func LoadCapabilitiesByModelID(ctx context.Context, db gorp.SqlExecutor, workerModelID int64) (sdk.RequirementList, error)
LoadCapabilitiesByModelID retrieves capabilities of given worker model.
func LoadPatternByNameAndType ¶
func LoadPatternByNameAndType(ctx context.Context, db gorp.SqlExecutor, patternType, patternName string) (*sdk.ModelPattern, error)
LoadPatternByNameAndType retrieves model patterns from database given its name and type.
func LoadPatterns ¶
func LoadPatterns(ctx context.Context, db gorp.SqlExecutor) ([]sdk.ModelPattern, error)
LoadPatterns retrieves model patterns from database.
func LoadSecretByModelIDAndName ¶
func LoadSecretByModelIDAndName(ctx context.Context, db gorp.SqlExecutor, workerModelID int64, name string) (*sdk.WorkerModelSecret, error)
LoadSecretByModelIDAndName retrieves a worker model secret for given model id and secret name.
func LoadSecretsByModelID ¶
func LoadSecretsByModelID(ctx context.Context, db gorp.SqlExecutor, workerModelID int64) (sdk.WorkerModelSecrets, error)
LoadSecretsByModelID retrieves all worker model secrets for given model id.
func Status ¶
func Status(db *gorp.DbMap) sdk.MonitoringStatusLine
Status returns info about worker Model Status
func UnbookForRegister ¶
UnbookForRegister release the book
func Update ¶
func Update(ctx context.Context, db gorpmapper.SqlExecutorWithTx, old *sdk.Model, data sdk.Model) (*sdk.Model, error)
Update from given data.
func UpdateCapabilities ¶
func UpdateCapabilities(ctx context.Context, db gorp.SqlExecutor, modelID int64, registrationForm sdk.WorkerRegistrationForm) error
UpdateCapabilities .
func UpdateDB ¶
func UpdateDB(ctx context.Context, db gorpmapper.SqlExecutorWithTx, model *sdk.Model) error
UpdateDB a worker model if the worker model have SpawnErr -> clear them.
func UpdateOSAndArch ¶
func UpdateOSAndArch(db gorp.SqlExecutor, modelID int64, OS, arch string) error
UpdateOSAndArch updates os and arch for a worker model.
func UpdatePattern ¶
func UpdatePattern(db gorp.SqlExecutor, modelPattern *sdk.ModelPattern) error
UpdatePattern in database.
func UpdateRegistration ¶
func UpdateRegistration(ctx context.Context, db gorp.SqlExecutor, store cache.Store, modelID int64) error
UpdateRegistration updates need_registration to false and last_registration time, reset err registration.
func UpdateSecret ¶
func UpdateSecret(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s *sdk.WorkerModelSecret) error
UpdateSecret in database.
func UpdateSpawnErrorWorkerModel ¶
func UpdateSpawnErrorWorkerModel(db gorp.SqlExecutor, modelID int64, spawnError sdk.SpawnErrorForm) error
UpdateSpawnErrorWorkerModel updates worker model error registration
Types ¶
type LoadFilter ¶
type LoadFilter struct { Binary string State StateFilter }
LoadFilter struct for worker model query.
func (LoadFilter) Args ¶
func (l LoadFilter) Args() gorpmapper.ArgsMap
Args returns sql args for current filter.
func (LoadFilter) SQL ¶
func (l LoadFilter) SQL() string
SQL returns the raw sql for current filter.
type LoadOptionFunc ¶
LoadOptionFunc for worker model.
type StateFilter ¶
type StateFilter string
StateFilter for worker model.
const ( StateError StateFilter = "error" StateDisabled StateFilter = "disabled" StateRegister StateFilter = "register" StateDeprecated StateFilter = "deprecated" StateActive StateFilter = "active" StateOfficial StateFilter = "official" )
List of const for state filter.
func (StateFilter) IsValid ¶
func (s StateFilter) IsValid() error
IsValid returns an error if the state value is not valid.