// appendTableRecordPrefix appends table record prefix  "t[tableID]_r".
353430
func appendTableRecordPrefix(buf []byte, tableID int64) []byte {
	buf = append(buf, tablePrefix...)
	buf = codec.EncodeInt(buf, tableID)
	buf = append(buf, recordPrefixSep...)
	return buf
}
417371
func ParseDevAddrPrefix(prefixString string) (prefix DevAddrPrefix, err error) {
	pattern := regexp.MustCompile("([[:xdigit:]]{8})/([[:digit:]]+)")
	matches := pattern.FindStringSubmatch(prefixString)
	if len(matches) != 3 {
		err = errors.New("Invalid Prefix")
		return
	}
	addr, _ := ParseDevAddr(matches[1])         // errors handled in regexp
	prefix.Length, _ = strconv.Atoi(matches[2]) // errors handled in regexp
	prefix.DevAddr = addr.Mask(prefix.Length)
	return
}
125789
func (t *Table) AppendTable(t2 *Table) error {
	t.mu.Lock()
	defer t.mu.Unlock()
	if t2 == nil {
		return nil
	}
	if len(t.AvailableBindings) > 0 && !equalBindings(t.mbs, t2.mbs) {
		return fmt.Errorf("AppendTable can only append to an empty table or equally binded table; intead got %v and %v", t.AvailableBindings, t2.AvailableBindings)
	}
	if len(t.AvailableBindings) == 0 {
		t.AvailableBindings, t.mbs = t2.AvailableBindings, t2.mbs
	}
	t.Data = append(t.Data, t2.Data...)
	return nil
}
517505
func AppendArray(b []byte, n int) []byte {
	return appendPrefix(b, '*', int64(n))
}
1125118
func (b *BatchProvider) Append(table, chain string, rulespec ...string) error {
	b.Lock()
	defer b.Unlock()

	if _, ok := b.batchTables[table]; !ok {
		return b.ipt.Append(table, chain, rulespec...)
	}

	if _, ok := b.rules[table]; !ok {
		b.rules[table] = map[string][]string{}
	}

	if _, ok := b.rules[table][chain]; !ok {
		b.rules[table][chain] = []string{}
	}

	rule := strings.Join(rulespec, " ")

	b.rules[table][chain] = append(b.rules[table][chain], rule)

	return nil
}
595772
func formatPAXRecord(k, v string) string {
	const padding = 3 // Extra padding for ' ', '=', and '\n'
	size := len(k) + len(v) + padding
	size += len(strconv.Itoa(size))
	record := fmt.Sprintf("%d %s=%s\n", size, k, v)

	// Final adjustment if adding size field increased the record size.
	if len(record) != size {
		size = len(record)
		record = fmt.Sprintf("%d %s=%s\n", size, k, v)
	}
	return record
}
892779
func (pdb *prefixDB) Iterator(start, end []byte) Iterator {
	pdb.mtx.Lock()
	defer pdb.mtx.Unlock()

	var pstart, pend []byte
	pstart = append(cp(pdb.prefix), start...)
	if end == nil {
		pend = cpIncr(pdb.prefix)
	} else {
		pend = append(cp(pdb.prefix), end...)
	}
	return newPrefixIterator(
		pdb.prefix,
		start,
		end,
		pdb.db.Iterator(
			pstart,
			pend,
		),
	)
}
429702
func (errs *MultiError) Append(err error) {
	if err != nil {
		*errs = append(*errs, err)
	}
}
67933
func (c *Conn) MatchPrefix(key string, maxrecords int64) ([]string, error) {
	keystransmit := []KV{
		{"prefix", []byte(key)},
		{"max", []byte(strconv.FormatInt(maxrecords, 10))},
	}
	code, m, err := c.doRPC("/rpc/match_prefix", keystransmit)
	if err != nil {
		return nil, err
	}
	if code != 200 {
		return nil, makeError(m)
	}
	res := make([]string, 0, len(m))
	for _, kv := range m {
		if kv.Key[0] == '_' {
			res = append(res, string(kv.Key[1:]))
		}
	}
	if len(res) == 0 {
		// yeah, gokabinet was weird here.
		return nil, ErrSuccess
	}
	return res, nil
}
1175495
func (b *BatchBuilder) AddWithPrefix(prefix string, builder Builder) *BatchBuilder {
	stmt, names := builder.ToCql()
	return b.AddStmtWithPrefix(prefix, stmt, names)
}
750712
func (t Term) Append(args ...interface{}) Term {
	return constructMethodTerm(t, "Append", p.Term_APPEND, args, map[string]interface{}{})
}
1196087
func AppendDwordReg(regs []Register, name string, value uint32) []Register {
	var buf bytes.Buffer
	binary.Write(&buf, binary.LittleEndian, value)
	return append(regs, Register{name, buf.Bytes(), fmt.Sprintf("%#08x", value)})
}
1246064
func (mb *Builder) AppendReference(d distribution.Describable) error {
	mb.layers = append(mb.layers, d.Descriptor())
	return nil
}
282778
func (c *CommitLog) Append(p []byte) (offset int64, err error) {
	l := Log(p)
	if c.checkSplit() {
		if err := c.split(); err != nil {
			return offset, err
		}
	}
	offset = c.NewestOffset()
	l.PutOffset(offset)
	if _, err := c.activeSegment().Write(l); err != nil {
		return offset, err
	}
	return offset, nil
}
162709
func AddPrefix(path string) string {
	if !strings.HasPrefix(path, Prefix) {
		path = Prefix + path
	}
	return path
}
631566
func (c *RollingCounter) Append(o *RollingCounter) error {
	c.Inc(int(o.Count()))
	return nil
}
270592
func (h *BindHandle) GetAllBindRecord() (bindRecords []*BindMeta) {
	bindRecordMap := h.bindInfo.Load().(cache)
	for _, bindRecord := range bindRecordMap {
		bindRecords = append(bindRecords, bindRecord...)
	}
	return bindRecords
}