code: func AllMasters(c context.Context, checkAccess bool) ([]*Master, error) {
  	const batchSize = int32(500)
  	masters := make([]*Master, 0, batchSize)
  	q := datastore.NewQuery(masterKind)
  
  	// note: avoid calling isAllowedInternal is checkAccess is false.
  	// checkAccess is usually false in cron jobs where there is no auth state,
  	// so isAllowedInternal call would unconditionally log an error.
  	allowInternal := !checkAccess || isAllowedInternal(c)
  	err := datastore.RunBatch(c, batchSize, q, func(e *masterEntity) error {
  		if allowInternal || !e.Internal {
  			m, err := e.decode(c)
  			if err != nil {
  				return err
  			}
  			masters = append(masters, m)
  		}
  		return nil
  	})
  	return masters, err
  }
docs: // AllMasters returns all buildbot masters.