MCPcopy Create free account
hub / github.com/cloudbase/garm / ListScaleSetInstances

Method ListScaleSetInstances

database/sql/scaleset_instances.go:68–80  ·  view source on GitHub ↗
(_ context.Context, scalesetID uint, outdatedOnly bool)

Source from the content-addressed store, hash-verified

66}
67
68func (s *sqlDatabase) ListScaleSetInstances(_ context.Context, scalesetID uint, outdatedOnly bool) ([]params.Instance, error) {
69 ret, err := s.listInstancesBatched(func(query *gorm.DB) *gorm.DB {
70 q := query.Where("scale_set_fk_id = ?", scalesetID)
71 if outdatedOnly {
72 q = q.Where("instances.generation < (SELECT scale_sets.generation FROM scale_sets WHERE scale_sets.id = instances.scale_set_fk_id)")
73 }
74 return q
75 })
76 if err != nil {
77 return nil, fmt.Errorf("failed to list scaleset instances: %w", err)
78 }
79 return ret, nil
80}

Callers

nothing calls this directly

Calls 1

listInstancesBatchedMethod · 0.95

Tested by

no test coverage detected