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

Method PoolInstanceCount

database/sql/instances.go:553–565  ·  view source on GitHub ↗
(_ context.Context, poolID string)

Source from the content-addressed store, hash-verified

551}
552
553func (s *sqlDatabase) PoolInstanceCount(_ context.Context, poolID string) (int64, error) {
554 pool, err := s.getPoolByID(s.conn, poolID)
555 if err != nil {
556 return 0, fmt.Errorf("error fetching pool: %w", err)
557 }
558
559 var cnt int64
560 q := s.conn.Model(&Instance{}).Where("pool_id = ?", pool.ID).Count(&cnt)
561 if q.Error != nil {
562 return 0, fmt.Errorf("error fetching instance count: %w", q.Error)
563 }
564 return cnt, nil
565}

Callers

nothing calls this directly

Calls 1

getPoolByIDMethod · 0.95

Tested by

no test coverage detected