// getLookoutEpoch retrieves the lookout tip block epoch from the given bucket.
// A nil epoch is returned if no update exists.
487784
func getLookoutEpoch(bkt *bbolt.Bucket) *chainntnfs.BlockEpoch {
	epochBytes := bkt.Get(lookoutTipKey)
	if len(epochBytes) != 36 {
		return nil
	}

	var hash chainhash.Hash
	copy(hash[:], epochBytes[:32])
	height := byteOrder.Uint32(epochBytes[32:])

	return &chainntnfs.BlockEpoch{
		Hash:   &hash,
		Height: int32(height),
	}
}
878119
func (m *Monitor) GetPos() (x, y int) {
	var xpos, ypos C.int
	C.glfwGetMonitorPos(m.data, &xpos, &ypos)
	panicError()
	return int(xpos), int(ypos)
}
939817
func FindUnmountableSecrets(g osgraph.Graph, f osgraph.Namer) []osgraph.Marker {
	markers := []osgraph.Marker{}

	for _, uncastPodSpecNode := range g.NodesByKind(kubegraph.PodSpecNodeKind) {
		podSpecNode := uncastPodSpecNode.(*kubegraph.PodSpecNode)
		unmountableSecrets := CheckForUnmountableSecrets(g, podSpecNode)

		topLevelNode := osgraph.GetTopLevelContainerNode(g, podSpecNode)
		topLevelString := f.ResourceName(topLevelNode)

		saString := "MISSING_SA"
		saNodes := g.SuccessorNodesByEdgeKind(podSpecNode, kubeedges.ReferencedServiceAccountEdgeKind)
		if len(saNodes) > 0 {
			saString = f.ResourceName(saNodes[0])
		}

		for _, unmountableSecret := range unmountableSecrets {
			markers = append(markers, osgraph.Marker{
				Node:         podSpecNode,
				RelatedNodes: []graph.Node{unmountableSecret},

				Severity: osgraph.WarningSeverity,
				Key:      UnmountableSecretWarning,
				Message: fmt.Sprintf("%s is attempting to mount a secret %s disallowed by %s",
					topLevelString, f.ResourceName(unmountableSecret), saString),
			})
		}
	}

	return markers
}
219681
func (cs *ConsensusState) GetLastHeight() int64 {
	cs.mtx.RLock()
	defer cs.mtx.RUnlock()
	return cs.RoundState.Height - 1
}
1166885
func SampleCollectorToProto(c *SampleCollector) *tipb.SampleCollector {
	collector := &tipb.SampleCollector{
		NullCount: c.NullCount,
		Count:     c.Count,
		FmSketch:  FMSketchToProto(c.FMSketch),
		TotalSize: &c.TotalSize,
	}
	if c.CMSketch != nil {
		collector.CmSketch = CMSketchToProto(c.CMSketch)
	}
	for _, item := range c.Samples {
		collector.Samples = append(collector.Samples, item.Value.GetBytes())
	}
	return collector
}
716300
func StringToTimeHookFunc(layout string) DecodeHookFunc {
	return func(
		f reflect.Type,
		t reflect.Type,
		data interface{}) (interface{}, error) {
		if f.Kind() != reflect.String {
			return data, nil
		}
		if t != reflect.TypeOf(time.Time{}) {
			return data, nil
		}

		// Convert it by parsing
		return time.Parse(layout, data.(string))
	}
}
786963
func (f *File) GetLoopInfo() (i *LoopInfo) {
	c := new(C.SF_LOOP_INFO)
	r := C.sf_command(f.s, C.SFC_GET_LOOP_INFO, unsafe.Pointer(c), C.int(unsafe.Sizeof(*c)))
	if r == C.SF_TRUE {
		i = new(LoopInfo)
		i.TimeSig.Numerator = int16(c.time_sig_num)
		i.TimeSig.Denominator = int16(c.time_sig_den)
		i.Mode = LoopMode(c.loop_mode)
		i.Beats = int(c.num_beats)
		i.Bpm = float32(c.bpm)
		i.RootKey = int(c.root_key)
		for index, value := range c.future {
			i.Future[index] = int(value)
		}
	}
	return
}
974738
func (u *UserContext) GetOcticon() string {
	if u == nil || u.Octicon == nil {
		return ""
	}
	return *u.Octicon
}
430988
func (db *WiredDB) GetTip() (*exptypes.WebBasicBlock, error) {
	tip, err := db.DB.getTip()
	if err != nil {
		return nil, err
	}
	blockdata := exptypes.WebBasicBlock{
		Height:      tip.Height,
		Size:        tip.Size,
		Hash:        tip.Hash,
		Difficulty:  tip.Difficulty,
		StakeDiff:   tip.StakeDiff,
		Time:        tip.Time.S.UNIX(),
		NumTx:       tip.NumTx,
		PoolSize:    tip.PoolInfo.Size,
		PoolValue:   tip.PoolInfo.Value,
		PoolValAvg:  tip.PoolInfo.ValAvg,
		PoolWinners: tip.PoolInfo.Winners,
	}
	return &blockdata, nil
}
679085
func GetBlockStepCtx(r *http.Request) int {
	step, ok := r.Context().Value(ctxBlockStep).(int)
	if !ok {
		apiLog.Error("block step is not set or is not an int")
		return -1
	}
	return step
}
1113557
func GetHook(repoPath, name string) (*Hook, error) {
	if !IsValidHookName(name) {
		return nil, ErrNotValidHook
	}
	h := &Hook{
		name: name,
		path: path.Join(repoPath, HookDir, name),
	}
	if isFile(h.path) {
		data, err := ioutil.ReadFile(h.path)
		if err != nil {
			return nil, err
		}
		h.IsActive = true
		h.Content = string(data)
		return h, nil
	}

	// Check sample file
	samplePath := path.Join(repoPath, HookSampleDir, h.name) + ".sample"
	if isFile(samplePath) {
		data, err := ioutil.ReadFile(samplePath)
		if err != nil {
			return nil, err
		}
		h.Sample = string(data)
	}
	return h, nil
}
278831
func GetOk(req *http.Request, key interface{}) (val interface{}, ok bool) {
	crc := getContextReadCloser(req)
	val, ok = crc.Context()[key]
	return
}
1007874
func (s *RepositoriesService) GetPreReceiveHook(ctx context.Context, owner, repo string, id int64) (*PreReceiveHook, *Response, error) {
	u := fmt.Sprintf("repos/%v/%v/pre-receive-hooks/%d", owner, repo, id)
	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	// TODO: remove custom Accept header when this API fully launches.
	req.Header.Set("Accept", mediaTypePreReceiveHooksPreview)

	h := new(PreReceiveHook)
	resp, err := s.client.Do(ctx, req, h)
	if err != nil {
		return nil, resp, err
	}

	return h, resp, nil
}
1183872
func (c *Config) okloopback(r *http.Request) bool {
	return c.PermitClearLoopback && isLoopback(r)
}
1249365
func (p *PingEvent) GetHookID() int64 {
	if p == nil || p.HookID == nil {
		return 0
	}
	return *p.HookID
}
1188033
func GetLightStepAccessToken(tracer opentracing.Tracer) (string, error) {
	switch lsTracer := tracer.(type) {
	case Tracer:
		return lsTracer.Options().AccessToken, nil
	case *tracerv0_14:
		return GetLightStepAccessToken(lsTracer.Tracer)
	default:
		return "", newEventUnsupportedTracer(tracer)
	}
}
1358209
func (h *HookStats) GetTotalHooks() int {
	if h == nil || h.TotalHooks == nil {
		return 0
	}
	return *h.TotalHooks
}