// GetTotalGists returns the TotalGists field if it's non-nil, zero value otherwise.
179500
func (g *GistStats) GetTotalGists() int {
	if g == nil || g.TotalGists == nil {
		return 0
	}
	return *g.TotalGists
}
359468
func (s *Storage) GetTotalCount() int64 {
	count := atomic.LoadInt64(&s.stat.TotalCount)

	return count
}
1103141
func (sa *StorageAuthority) GetRegistration(_ context.Context, id int64) (core.Registration, error) {
	if id == 100 {
		// Tag meaning "Missing"
		return core.Registration{}, errors.New("missing")
	}
	if id == 101 {
		// Tag meaning "Malformed"
		return core.Registration{}, nil
	}
	if id == 102 {
		// Tag meaning "Not Found"
		return core.Registration{}, berrors.NotFoundError("Dave's not here man")
	}

	keyJSON := []byte(test1KeyPublicJSON)
	var parsedKey jose.JSONWebKey
	err := parsedKey.UnmarshalJSON(keyJSON)
	if err != nil {
		return core.Registration{}, err
	}

	contacts := []string{"mailto:person@mail.com"}
	goodReg := core.Registration{
		ID:        id,
		Key:       &parsedKey,
		Agreement: agreementURL,
		Contact:   &contacts,
		Status:    core.StatusValid,
	}

	// Return a populated registration with contacts for ID == 1 or ID == 5
	if id == 1 || id == 5 {
		return goodReg, nil
	}

	var test2KeyPublic jose.JSONWebKey
	_ = test2KeyPublic.UnmarshalJSON([]byte(test2KeyPublicJSON))
	if id == 2 {
		goodReg.Key = &test2KeyPublic
		return goodReg, nil
	}

	var test3KeyPublic jose.JSONWebKey
	_ = test3KeyPublic.UnmarshalJSON([]byte(test3KeyPublicJSON))
	// deactivated registration
	if id == 3 {
		goodReg.Key = &test3KeyPublic
		goodReg.Status = core.StatusDeactivated
		return goodReg, nil
	}

	var test4KeyPublic jose.JSONWebKey
	_ = test4KeyPublic.UnmarshalJSON([]byte(test4KeyPublicJSON))
	if id == 4 {
		goodReg.Key = &test4KeyPublic
		return goodReg, nil
	}

	// ID 6 == an account without the agreement set
	if id == 6 {
		goodReg.Agreement = ""
		return goodReg, nil
	}

	goodReg.InitialIP = net.ParseIP("5.6.7.8")
	goodReg.CreatedAt = time.Date(2003, 9, 27, 0, 0, 0, 0, time.UTC)
	return goodReg, nil
}
1287506
func GetOrRegisterCounter(name string, r Registry) Counter {
	if nil == r {
		r = DefaultRegistry
	}
	return r.GetOrRegister(name, NewCounter).(Counter)
}
1166896
func (c *CommitsComparison) GetTotalCommits() int {
	if c == nil || c.TotalCommits == nil {
		return 0
	}
	return *c.TotalCommits
}
827864
func (w *WeeklyStats) GetAdditions() int {
	if w == nil || w.Additions == nil {
		return 0
	}
	return *w.Additions
}
1178251
func (s *Storage) GetTotalCount() int64 {
	var count int64
	s.getBoltDB(storage.TotalCountKey, &count)

	return count
}
1226315
func (c *CombinedStatus) GetTotalCount() int {
	if c == nil || c.TotalCount == nil {
		return 0
	}
	return *c.TotalCount
}
383339
func GetRegistry(c context.Context) Registry {
	ret, _ := c.Value(&regKey).(Registry)
	return ret
}
10565
func (actor Actor) GetDomainsByNameAndOrganization(domainNames []string, orgGUID string) ([]Domain, Warnings, error) {
	if len(domainNames) == 0 {
		return nil, nil, nil
	}

	var domains []Domain
	var allWarnings Warnings

	// TODO: If the following causes URI length problems, break domainNames into
	// batched (based on character length?) and loop over them.

	sharedDomains, warnings, err := actor.CloudControllerClient.GetSharedDomains(ccv2.Filter{
		Type:     constant.NameFilter,
		Operator: constant.InOperator,
		Values:   domainNames,
	})
	allWarnings = append(allWarnings, warnings...)
	if err != nil {
		return nil, allWarnings, err
	}

	for _, domain := range sharedDomains {
		domains = append(domains, Domain(domain))
		actor.saveDomain(domain)
	}

	privateDomains, warnings, err := actor.CloudControllerClient.GetOrganizationPrivateDomains(
		orgGUID,
		ccv2.Filter{
			Type:     constant.NameFilter,
			Operator: constant.InOperator,
			Values:   domainNames,
		})
	allWarnings = append(allWarnings, warnings...)
	if err != nil {
		return nil, allWarnings, err
	}

	for _, domain := range privateDomains {
		domains = append(domains, Domain(domain))
		actor.saveDomain(domain)
	}

	return domains, allWarnings, err
}
1185568
func (g *groupRegistry) mustRegisterCounter(desc *desc) ID {
	desc.mt = counterMetricType
	g.mustRegister(desc)

	desc.id = newID(len(g.group.counters), g.desc.id)
	g.group.counters = append(g.group.counters, Counter{desc: desc})

	return desc.id
}
412383
func (r *Registry) MustRegisterCounter(name string, opts ...descOption) ID {
	desc := newDesc(name, opts...)
	return r.mustGetGroupRegistry(desc.gid).mustRegisterCounter(desc)
}
363468
func (o *OrgStats) GetTotalTeams() int {
	if o == nil || o.TotalTeams == nil {
		return 0
	}
	return *o.TotalTeams
}
861948
func (s *Storage) GetTotalCount() int64 {
	var count int64
	s.getBuntDB(storage.TotalCountKey, &count)

	return count
}
1111351
func GlobalRegistry() *Registry {
	registryOnce.Do(func() {
		registry = new(Registry)
		registry.infos = make(map[string]map[string]SearchParamInfo)
		registry.parsers = make(map[string]ParameterParser)
	})
	return registry
}
296759
func (f *Facade) GetRegistryImages(ctx datastore.Context) ([]registry.Image, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetRegistryImages"))
	rImages, err := f.registryStore.GetImages(ctx)
	if err != nil {
		return nil, err
	}
	return rImages, nil
}
1358209
func (h *HookStats) GetTotalHooks() int {
	if h == nil || h.TotalHooks == nil {
		return 0
	}
	return *h.TotalHooks
}