// TopoChecksum returns the checksum of the current state of the topo
323393
func (tw *TopologyWatcher) TopoChecksum() uint32 {
	tw.mu.Lock()
	defer tw.mu.Unlock()

	return tw.topoChecksum
}
947604
func (l *State) CheckStack(size int) bool {
	callInfo := l.callInfo
	ok := l.stackLast-l.top > size
	if !ok && l.top+extraStack <= maxStack-size {
		ok = l.protect(func() { l.growStack(size) }) == nil
	}
	if ok && callInfo.top < l.top+size {
		callInfo.setTop(l.top + size)
	}
	return ok
}
388581
func (m *Context) ToPB() *ContextPb {
	m.init()
	pb := &ContextPb{}
	pb.Schema = m.SchemaName
	pb.Fingerprint = m.fingerprint
	pb.Id = m.id
	return pb
}
826433
func (s *GetJobOutputOutput) SetChecksum(v string) *GetJobOutputOutput {
	s.Checksum = &v
	return s
}
964843
func (b ICMPv4) SetChecksum(checksum uint16) {
	binary.BigEndian.PutUint16(b[2:], checksum)
}
32422
func (s *CreateIntentVersionInput) SetChecksum(v string) *CreateIntentVersionInput {
	s.Checksum = &v
	return s
}
529152
func (b *block) ComputeChecksum() (unsigned, signed int64) {
	for i, c := range b {
		if 148 <= i && i < 156 {
			c = ' ' // Treat the checksum field itself as all spaces.
		}
		unsigned += int64(c)
		signed += int64(int8(c))
	}
	return unsigned, signed
}
685573
func (r *Route) PseudoHeaderChecksum(protocol tcpip.TransportProtocolNumber, totalLen uint16) uint16 {
	return header.PseudoHeaderChecksum(protocol, r.LocalAddress, r.RemoteAddress, totalLen)
}
574614
func copyAndChecksum(w io.Writer, r io.Reader) (string, error) {
	h := sha1.New()
	mw := io.MultiWriter(w, h)
	if _, err := io.Copy(mw, r); err != nil {
		return "", err
	}
	return hex.EncodeToString(h.Sum(nil)), nil
}
902704
func (s *BotAliasMetadata) SetChecksum(v string) *BotAliasMetadata {
	s.Checksum = &v
	return s
}
1196377
func (s *CreateSlotTypeVersionOutput) SetChecksum(v string) *CreateSlotTypeVersionOutput {
	s.Checksum = &v
	return s
}
716965
func (s *UploadArchiveInput) SetChecksum(v string) *UploadArchiveInput {
	s.Checksum = &v
	return s
}
801162
func fileChecksum(path string) (string, error) {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		return "", err
	}
	hash := sha1.New()
	io.WriteString(hash, string(data))
	return fmt.Sprintf("%x", hash.Sum(nil)), nil
}
736099
func (m Migration) Checksum() string {
	return fmt.Sprintf("%x", md5.Sum([]byte(m.Script)))
}
611765
func FileChecksum(filepath string, hsh hash.Hash) (string, error) {
	src, err := os.Open(filepath)
	if err != nil {
		return "", err
	}
	defer src.Close()

	_, err = io.Copy(hsh, src)
	if err != nil {
		return "", err
	}
	return fmt.Sprintf("%x", hsh.Sum(nil)), nil
}
367108
func (p *PhysicalIndexScan) ToPB(ctx sessionctx.Context) (*tipb.Executor, error) {
	columns := make([]*model.ColumnInfo, 0, p.schema.Len())
	tableColumns := p.Table.Cols()
	for _, col := range p.schema.Columns {
		if col.ID == model.ExtraHandleID {
			columns = append(columns, model.NewExtraHandleColInfo())
		} else {
			columns = append(columns, model.FindColumnInfo(tableColumns, col.ColName.L))
		}
	}
	idxExec := &tipb.IndexScan{
		TableId: p.Table.ID,
		IndexId: p.Index.ID,
		Columns: model.ColumnsToProto(columns, p.Table.PKIsHandle),
		Desc:    p.Desc,
	}
	unique := checkCoverIndex(p.Index, p.Ranges)
	idxExec.Unique = &unique
	return &tipb.Executor{Tp: tipb.ExecType_TypeIndexScan, IdxScan: idxExec}, nil
}
606301
func (b IPv4) SetChecksum(v uint16) {
	binary.BigEndian.PutUint16(b[checksum:], v)
}