// PerfStandby checks if the vault is a performance standby
178463
func (c *Core) PerfStandby() bool {
	c.stateLock.RLock()
	perfStandby := c.perfStandby
	c.stateLock.RUnlock()
	return perfStandby
}
988187
func (s *StateStore) VaultAccessorsByAlloc(ws memdb.WatchSet, allocID string) ([]*structs.VaultAccessor, error) {
	txn := s.db.Txn(false)

	// Get an iterator over the accessors
	iter, err := txn.Get("vault_accessors", "alloc_id", allocID)
	if err != nil {
		return nil, err
	}

	ws.Add(iter.WatchCh())

	var out []*structs.VaultAccessor
	for {
		raw := iter.Next()
		if raw == nil {
			break
		}
		out = append(out, raw.(*structs.VaultAccessor))
	}
	return out, nil
}
14868
func (wsh *WebsocketHub) AreDBsSyncing() bool {
	syncing, ok := wsh.dbsSyncing.Load().(bool)
	return ok && syncing
}
931997
func (s *UpgradeElasticsearchDomainInput) SetPerformCheckOnly(v bool) *UpgradeElasticsearchDomainInput {
	s.PerformCheckOnly = &v
	return s
}
549118
func (i *Instances) InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error) {
	instanceID, err := instanceIDFromProviderID(providerID)
	if err != nil {
		return false, err
	}

	server, err := servers.Get(i.compute, instanceID).Extract()
	if err != nil {
		return false, err
	}

	// SHUTOFF is the only state where we can detach volumes immediately
	if server.Status == instanceShutoff {
		return true, nil
	}
	return false, nil
}
911698
func (dfs *DistributedFilesystem) getSnapshotVolumeAndInfo(snapshotID string) (volume.Volume, *volume.SnapshotInfo, error) {
	vol, err := dfs.disk.GetTenant(snapshotID)
	if err != nil {
		glog.Errorf("Could not get tenant of snapshot %s: %s", snapshotID, err)
		return nil, nil, err
	}
	info, err := vol.SnapshotInfo(snapshotID)
	if err != nil {
		glog.Errorf("Could not get info for snapshot %s: %s", snapshotID, err)
		return nil, nil, err
	}
	return vol, info, nil
}
796193
func (c *ConfigLocal) OfflineAvailabilityForID(
	tlfID tlf.ID) keybase1.OfflineAvailability {
	if c.GetTlfSyncState(tlfID).Mode != keybase1.FolderSyncMode_DISABLED {
		return keybase1.OfflineAvailability_BEST_EFFORT
	}
	return keybase1.OfflineAvailability_NONE
}
894628
func (env *environ) StorageProvider(t storage.ProviderType) (storage.Provider, error) {
	if t == storageProviderType {
		return &storageProvider{env}, nil
	}
	return nil, errors.NotFoundf("storage provider %q", t)
}
888449
func RetrieveSysSettingsConfFile(db *sql.DB) (PGSettings, error) {
	return retrieveSysSettings(internal.RetrieveSysSettingsConfFile, db)
}
234487
func (c *ConfigLocal) PrefetchStatus(ctx context.Context, tlfID tlf.ID,
	ptr data.BlockPointer) PrefetchStatus {
	dbc := c.DiskBlockCache()
	if dbc == nil {
		// We must be in testing mode, so check the block retrieval queue.
		bops, ok := c.BlockOps().(*BlockOpsStandard)
		if !ok {
			return NoPrefetch
		}
		status, err := bops.queue.getPrefetchStatus(ptr.ID)
		if err != nil {
			c.MakeLogger("").CDebugf(ctx,
				"Error getting prefetch status: %+v", err)
			return NoPrefetch
		}
		return status
	}

	prefetchStatus, err := dbc.GetPrefetchStatus(
		ctx, tlfID, ptr.ID, DiskBlockAnyCache)
	if err != nil {
		return NoPrefetch
	}
	return prefetchStatus
}
800054
func (d *DB) AddrsForNode(nodePub *btcec.PublicKey) ([]net.Addr, error) {
	var (
		linkNode  *LinkNode
		graphNode LightningNode
	)

	dbErr := d.View(func(tx *bbolt.Tx) error {
		var err error

		linkNode, err = fetchLinkNode(tx, nodePub)
		if err != nil {
			return err
		}

		// We'll also query the graph for this peer to see if they have
		// any addresses that we don't currently have stored within the
		// link node database.
		nodes := tx.Bucket(nodeBucket)
		if nodes == nil {
			return ErrGraphNotFound
		}
		compressedPubKey := nodePub.SerializeCompressed()
		graphNode, err = fetchLightningNode(nodes, compressedPubKey)
		if err != nil && err != ErrGraphNodeNotFound {
			// If the node isn't found, then that's OK, as we still
			// have the link node data.
			return err
		}

		return nil
	})
	if dbErr != nil {
		return nil, dbErr
	}

	// Now that we have both sources of addrs for this node, we'll use a
	// map to de-duplicate any addresses between the two sources, and
	// produce a final list of the combined addrs.
	addrs := make(map[string]net.Addr)
	for _, addr := range linkNode.Addresses {
		addrs[addr.String()] = addr
	}
	for _, addr := range graphNode.Addresses {
		addrs[addr.String()] = addr
	}
	dedupedAddrs := make([]net.Addr, 0, len(addrs))
	for _, addr := range addrs {
		dedupedAddrs = append(dedupedAddrs, addr)
	}

	return dedupedAddrs, nil
}
566452
func FindResourceSecuredBy(r *raml.Resource) []raml.DefinitionChoice {
	if len(r.SecuredBy) > 0 {
		return r.SecuredBy
	}
	if r.Parent == nil {
		return []raml.DefinitionChoice{}
	}
	return FindResourceSecuredBy(r.Parent)
}
1341382
func IsForbiddenError(err error) (bool, error) {
	e, ok := errs.Cause(err).(ForbiddenError)
	if !ok {
		return false, nil
	}
	return true, e
}
193024
func (s *stackV1Beta1) IsColliding(servicesClient corev1.ServiceInterface, st Stack) error {
	for _, srv := range st.getServices() {
		if err := verify(servicesClient, st.Name, srv); err != nil {
			return err
		}
	}
	return nil
}
175316
func (c *ConsulBackend) fetchServiceTags(active bool, perfStandby bool) []string {
	activeTag := "standby"
	if active {
		activeTag = "active"
	}

	result := append(c.serviceTags, activeTag)

	if perfStandby {
		result = append(c.serviceTags, "performance-standby")
	}

	return result
}
1366814
func NewSQLStorageAuthority(
	dbMap *gorp.DbMap,
	clk clock.Clock,
	logger blog.Logger,
	scope metrics.Scope,
	parallelismPerRPC int,
) (*SQLStorageAuthority, error) {
	SetSQLDebug(dbMap, logger)

	ssa := &SQLStorageAuthority{
		dbMap:             dbMap,
		clk:               clk,
		log:               logger,
		parallelismPerRPC: parallelismPerRPC,
	}

	ssa.countCertificatesByName = ssa.countCertificatesByNameImpl
	ssa.countCertificatesByExactName = ssa.countCertificatesByExactNameImpl
	if features.Enabled(features.FasterRateLimit) {
		ssa.countCertificatesByName = ssa.countCertificatesFaster
		ssa.countCertificatesByExactName = ssa.countCertificatesFaster
	}
	ssa.getChallenges = ssa.getChallengesImpl

	return ssa, nil
}
721913
func (db *DB) StoreBlockSummary(bd *apitypes.BlockDataBasic) error {
	return db.StoreBlock(bd, true, true)
}