You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/internal/controller/cache/index/builder.go

34 lines
640 B

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package index
import (
"bytes"
)
// indexSeparator delimits the segments of our radix tree keys.
const indexSeparator = "\x00"
type Builder bytes.Buffer
func (i *Builder) Raw(v []byte) {
(*bytes.Buffer)(i).Write(v)
}
func (i *Builder) String(s string) {
(*bytes.Buffer)(i).WriteString(s)
(*bytes.Buffer)(i).WriteString(indexSeparator)
}
func (i *Builder) Bytes() []byte {
return (*bytes.Buffer)(i).Bytes()
}
func (i *Builder) Write(b []byte) (int, error) {
(*bytes.Buffer)(i).Write(b)
(*bytes.Buffer)(i).WriteString(indexSeparator)
return len(b), nil
}