// getIfNewerThan returns the data it is newer than the given time.
// Otherwise, it returns nil. The caller should acquire the lock.
512541
func (c *cache) getIfNewerThan(id types.UID, minTime time.Time) *data {
	d, ok := c.pods[id]
	globalTimestampIsNewer := (c.timestamp != nil && c.timestamp.After(minTime))
	if !ok && globalTimestampIsNewer {
		// Status is not cached, but the global timestamp is newer than
		// minTime, return the default status.
		return makeDefaultData(id)
	}
	if ok && (d.modified.After(minTime) || globalTimestampIsNewer) {
		// Status is cached, return status if either of the following is true.
		//   * status was modified after minTime
		//   * the global timestamp of the cache is newer than minTime.
		return d
	}
	// The pod status is not ready.
	return nil
}
128409
func (md *MDServerMemory) GetForTLFByTime(
	ctx context.Context, id tlf.ID, serverTime time.Time) (
	*RootMetadataSigned, error) {
	if err := checkContext(ctx); err != nil {
		return nil, err
	}

	md.lock.RLock()
	defer md.lock.RUnlock()

	key, err := md.getMDKey(id, kbfsmd.NullBranchID, kbfsmd.Merged)
	if err != nil {
		return nil, err
	}
	err = md.checkShutdownRLocked()
	if err != nil {
		return nil, err
	}

	blockList, ok := md.mdDb[key]
	if !ok {
		return nil, nil
	}
	blocks := blockList.blocks

	// Iterate backward until we find a timestamp less than `serverTime`.
	for i := len(blocks) - 1; i >= 0; i-- {
		t := blocks[i].timestamp
		if t.After(serverTime) {
			continue
		}

		max := md.config.MetadataVersion()
		ver := blocks[i].version
		buf := blocks[i].encodedMd
		rmds, err := DecodeRootMetadataSigned(
			md.config.Codec(), id, ver, max, buf, t)
		if err != nil {
			return nil, err
		}
		return rmds, nil
	}

	return nil, errors.Errorf(
		"No MD found for TLF %s and serverTime %s", id, serverTime)
}
146099
func (p *PushEvent) GetForced() bool {
	if p == nil || p.Forced == nil {
		return false
	}
	return *p.Forced
}
581002
func getNodeKeyFromNodeID(nodeID string) string {
	dbg.Assert(len(nodeID) > 0, "%s", "nodeID string can not be empty")
	return filepath.Join(baseKey, nodeKey, nodeID)
}
1115842
func getWaitTime(now time.Time, maxWait time.Duration) time.Duration {
	wait := nextProvision.Sub(now) // might be negative

	// When the system clock falls back an hour, the wait time might be an hour.
	// This sanity check prevents this error.
	if wait > maxWait {
		return maxWait
	}
	if wait < 0 {
		return 0
	}
	return wait
}
1330011
func (w *WebHookPayload) GetForced() bool {
	if w == nil || w.Forced == nil {
		return false
	}
	return *w.Forced
}
86979
func (r Ticket) GetLastViewedDate() (resp datatypes.Time, err error) {
	err = r.Session.DoRequest("SoftLayer_Ticket", "getLastViewedDate", nil, &r.Options, &resp)
	return
}
50044
func (p *PullRequestComment) GetOriginalCommitID() string {
	if p == nil || p.OriginalCommitID == nil {
		return ""
	}
	return *p.OriginalCommitID
}
507727
func (b *Box) GetInnerRect() (int, int, int, int) {
	if b.innerX >= 0 {
		return b.innerX, b.innerY, b.innerWidth, b.innerHeight
	}
	x, y, width, height := b.GetRect()
	if b.border {
		x++
		y++
		width -= 2
		height -= 2
	}
	return x + b.paddingLeft,
		y + b.paddingTop,
		width - b.paddingLeft - b.paddingRight,
		height - b.paddingTop - b.paddingBottom
}
612383
func GetStatusFromErr(err error) int {
	obj, ok := err.(*UnexpectedResponseError)
	if !ok {
		return -1
	}
	return obj.Actual
}
492687
func (p *PullRequestReviewRequest) GetCommitID() string {
	if p == nil || p.CommitID == nil {
		return ""
	}
	return *p.CommitID
}
105730
func (p *PushEvent) GetAfter() string {
	if p == nil || p.After == nil {
		return ""
	}
	return *p.After
}
293012
func (m *MarketplacePurchaseEvent) GetEffectiveDate() Timestamp {
	if m == nil || m.EffectiveDate == nil {
		return Timestamp{}
	}
	return *m.EffectiveDate
}
841802
func (obj *Doc) GetDatabaseInfoRaw(ctx context.Context, connectionId string) (json.RawMessage, error) {
	result := &struct {
		Info json.RawMessage	`json:"qInfo"`
	} {}
	err := obj.rpc(ctx, "GetDatabaseInfo", result, ensureEncodable(connectionId))
	return result.Info, err 
}
1104671
func (db *TXDatabaseOverlay) GetFBlock(keymr string) (interfaces.IFBlock, error) {
	h, err := primitives.NewShaHashFromStr(keymr)
	if err != nil {
		return nil, err
	}

	fBlock, err := db.DBO.FetchFBlock(h)
	if err != nil {
		return nil, err
	}
	return fBlock, nil
}
986006
func (a *Authenticator) getBaseTokenLocked(ctx context.Context, lifetime time.Duration) (*internal.Token, error) {
	if !a.isActing() {
		panic("impossible")
	}

	// Already have a good token?
	if lifetime > 0 && !internal.TokenExpiresInRnd(ctx, a.baseToken.token, lifetime) {
		return a.baseToken.token, nil
	}

	// Need to make one.
	return a.baseToken.compareAndRefresh(ctx, compareAndRefreshOp{
		lock:     nil, // already holding the lock
		prev:     a.baseToken.token,
		lifetime: lifetime,
		refreshCb: func(ctx context.Context, prev *internal.Token) (*internal.Token, error) {
			return a.baseToken.renewToken(ctx, prev, nil)
		},
	})
}
867119
func (kva *KvAlert) getNextIDFromKVDB() (int64, error) {
	kv := kva.GetKvdbInstance()
	nextAlertID := 0
	kvp, err := kv.Create(getNextAlertIDKey(), strconv.FormatInt(int64(nextAlertID+1), 10), 0)

	for err != nil {
		kvp, err = kv.GetVal(getNextAlertIDKey(), &nextAlertID)
		if err != nil {
			err = ErrNotInitialized
			return -1, err
		}
		prevValue := kvp.Value
		newKvp := *kvp
		newKvp.Value = []byte(strconv.FormatInt(int64(nextAlertID+1), 10))
		kvp, err = kv.CompareAndSet(&newKvp, kvdb.KVFlags(0), prevValue)
	}
	return int64(nextAlertID), err
}