Documentation ¶
Index ¶
- func BytesToU32(b []byte) uint32
- func BytesToU32Slice(b []byte) []uint32
- func CompareKeys(key1, key2 []byte) int
- func Copy(a []byte) []byte
- func FormatKey(key []byte) string
- func KeyWithTs(key []byte, ts uint64) []byte
- func ParseKey(key []byte) []byte
- func ParseTs(key []byte) uint64
- func SafeCopy(a, src []byte) []byte
- func SameKey(src, dst []byte) bool
- func U32SliceToBytes(u32s []uint32) []byte
- func U32ToBytes(v uint32) []byte
- type Iterator
- type ValueStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToU32 ¶
BytesToU32 converts the given byte slice to uint32
func BytesToU32Slice ¶
BytesToU32Slice converts the given byte slice to uint32 slice
func CompareKeys ¶
func U32SliceToBytes ¶
U32SliceToBytes converts the given Uint32 slice to byte slice
Types ¶
type Iterator ¶
type Iterator interface { Next() Rewind() Seek(key []byte) Key() []byte Value() ValueStruct Valid() bool // All iterators should be closed so that file garbage collection works. Close() error }
Iterator is an interface for a basic iterator.
type ValueStruct ¶
type ValueStruct struct { Meta byte ExpiresAt uint64 Value []byte Version uint64 // This field is not serialized. Only for internal usage. }
ValueStruct represents the value info that can be associated with a key, but also the internal Meta field.
func (*ValueStruct) Decode ¶
func (v *ValueStruct) Decode(b []byte)
Decode uses the length of the slice to infer the length of the Value field.
func (*ValueStruct) Encode ¶
func (v *ValueStruct) Encode(b []byte) uint32
Encode expects a slice of length at least v.EncodedSize().
func (*ValueStruct) EncodeTo ¶
func (v *ValueStruct) EncodeTo(buf *bytes.Buffer)
EncodeTo should be kept in sync with the Encode function above. The reason this function exists is to avoid creating byte arrays per key-value pair in table/builder.go.
func (*ValueStruct) EncodedSize ¶
func (v *ValueStruct) EncodedSize() uint32
EncodedSize is the size of the ValueStruct when encoded
func (*ValueStruct) Write ¶
func (v *ValueStruct) Write(buf *bytes.Buffer)
EncodeTo should be kept in sync with the Encode function above. The reason this function exists is to avoid creating byte arrays per key-value pair in table/builder.go.