func (blk *TagBlock) TagValueElem(key, value []byte) TagValueElem {
	var valueElem TagBlockValueElem
	if !blk.DecodeTagValueElem(key, value, &valueElem) {
		return nil
	}
	return &valueElem
}
TagValueElem returns an element for a tag value.
package tsi1
import (
	"bytes"
	"encoding/binary"
	"errors"
	"fmt"
	"io"
	"github.com/influxdata/influxdb/pkg/rhh"
)
const TagBlockVersion = 1
const (
	TagKeyTombstoneFlag = 0x01
)
const (
	TagValueTombstoneFlag = 0x01
)
const (
	TagKeyNSize      = 8
	TagKeyOffsetSize = 8
	TagValueNSize      = 8
	TagValueOffsetSize = 8
)
var (
	ErrUnsupportedTagBlockVersion = errors.New("unsupported tag block version")
	ErrTagBlockSizeMismatch       = errors.New("tag block size mismatch")
)
type TagBlock struct {
	data []byte
	valueData []byte
	keyData   []byte
	hashData  []byte
	version int  
}
func (blk *TagBlock) Version() int { return blk.version }
func (blk *TagBlock) UnmarshalBinary(data []byte) error {
	t, err := ReadTagBlockTrailer(data)
	if err != nil {
		return err
	}
	if int64(len(data)) != t.Size {
		return ErrTagBlockSizeMismatch
	}
	blk.valueData = data[t.ValueData.Offset:]
	blk.valueData = blk.valueData[:t.ValueData.Size]
	blk.keyData = data[t.KeyData.Offset:]
	blk.keyData = blk.keyData[:t.KeyData.Size]
	blk.hashData = data[t.HashIndex.Offset:]
	blk.hashData = blk.hashData[:t.HashIndex.Size]
	blk.data = data
	return nil
}
func (blk *TagBlock) TagKeyElem(key []byte) TagKeyElem {
	var elem TagBlockKeyElem
	if !blk.DecodeTagKeyElem(key, &elem) {
		return nil
	}
	return &elem
}
func (blk *TagBlock) DecodeTagKeyElem(key []byte, elem *TagBlockKeyElem) bool {
	keyN := int64(binary.BigEndian.Uint64(blk.hashData[:TagKeyNSize]))
	hash := rhh.HashKey(key)
	pos := hash % keyN
	var d int64
	for {
		offset := binary.BigEndian.Uint64(blk.hashData[TagKeyNSize+(pos*TagKeyOffsetSize):])
		if offset == 0 {
			return false
		}
		elem.unmarshal(blk.data[offset:], blk.data)
		if bytes.Equal(elem.key, key) {
			return true
		}
		if d > rhh.Dist(rhh.HashKey(elem.key), pos, keyN) {
			return false
		}
		pos = (pos + 1) % keyN
		d++
		if d > keyN {
			return false
		}
	}
}