encoding

package
Version: v0.0.0-...-4281e50 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodePropertyValue

func DecodePropertyValue(buffer []byte) (int64, []byte, error)

func MustInt64

func MustInt64(got []int64, err error) []int64

Types

type Delta

type Delta struct {
	// contains filtered or unexported fields
}

func NewDelta

func NewDelta(buffer []byte) *Delta

func (*Delta) Get

func (d *Delta) Get(index int64) (int64, error)

func (*Delta) InsertAt

func (d *Delta) InsertAt(index, value int64) error

func (*Delta) Int64

func (d *Delta) Int64() ([]int64, error)

func (*Delta) MustValues

func (d *Delta) MustValues() []int64

func (*Delta) Next

func (d *Delta) Next(token DeltaToken) (DeltaToken, error)

func (*Delta) Raw

func (d *Delta) Raw() []byte

func (*Delta) Size

func (d *Delta) Size() int

func (*Delta) SplitAt

func (d *Delta) SplitAt(index int64) (left, right *Delta, err error)

type DeltaToken

type DeltaToken struct {
	Value int64
	// contains filtered or unexported fields
}

type Dictionary

type Dictionary struct {
	// contains filtered or unexported fields
}

func NewDictionary

func NewDictionary(buffer []byte) *Dictionary

func (*Dictionary) AppendTo

func (d *Dictionary) AppendTo(w io.Writer) error

func (*Dictionary) Get

func (d *Dictionary) Get(index int) ([]byte, error)

func (*Dictionary) Lookup

func (d *Dictionary) Lookup(key []byte) (int64, error)

func (*Dictionary) LookupString

func (d *Dictionary) LookupString(key string) (int64, error)

func (*Dictionary) Size

func (d *Dictionary) Size() int

type DictionaryRLE

type DictionaryRLE struct {
	// contains filtered or unexported fields
}

func NewDictionaryRLE

func NewDictionaryRLE(dict, data []byte) *DictionaryRLE

func (*DictionaryRLE) Get

func (d *DictionaryRLE) Get(index int64) ([]byte, error)

func (*DictionaryRLE) InsertAt

func (d *DictionaryRLE) InsertAt(index int64, value []byte) error

func (*DictionaryRLE) Lookup

func (d *DictionaryRLE) Lookup(value []byte) (int64, error)

func (*DictionaryRLE) Next

func (*DictionaryRLE) RowCount

func (d *DictionaryRLE) RowCount() int

func (*DictionaryRLE) Size

func (d *DictionaryRLE) Size() int

func (*DictionaryRLE) SplitAt

func (d *DictionaryRLE) SplitAt(index int64) (left, right *DictionaryRLE, err error)

type DictionaryRLEToken

type DictionaryRLEToken struct {
	Value []byte
	// contains filtered or unexported fields
}

type LogicalType

type LogicalType uint8
const (
	LogicalTypeUnknown  LogicalType = 0
	LogicalTypeInt64    LogicalType = 1
	LogicalTypeString   LogicalType = 2
	LogicalTypeProperty LogicalType = 3
)

type Plain

type Plain struct {
	// contains filtered or unexported fields
}

func NewPlain

func NewPlain(rawType RawType, buffer []byte) *Plain

func (*Plain) InsertAt

func (p *Plain) InsertAt(index int64, value Value) error

func (*Plain) Next

func (p *Plain) Next(token PlainToken) (PlainToken, error)

func (*Plain) RowCount

func (p *Plain) RowCount() int

func (*Plain) Size

func (p *Plain) Size() int

func (*Plain) SplitAt

func (p *Plain) SplitAt(index int64) (left, right *Plain, err error)

type PlainToken

type PlainToken struct {
	Index int
	Value Value
	// contains filtered or unexported fields
}

type RLE

type RLE struct {
	// contains filtered or unexported fields
}

func NewRLE

func NewRLE(buffer []byte) *RLE

func (*RLE) DeleteAt

func (r *RLE) DeleteAt(index int64) error

func (*RLE) Get

func (r *RLE) Get(index int64) (int64, error)

func (*RLE) InsertAt

func (r *RLE) InsertAt(index, v int64) error

func (*RLE) Int64

func (r *RLE) Int64() ([]int64, error)

func (*RLE) Next

func (r *RLE) Next(token RLEToken) (RLEToken, error)

func (*RLE) RowCount

func (r *RLE) RowCount() int

func (*RLE) Size

func (r *RLE) Size() int

func (*RLE) SplitAt

func (r *RLE) SplitAt(index int64) (left, right *RLE, err error)

func (*RLE) Translate

func (r *RLE) Translate(index int64, isDelete func(opType int64) bool) (int64, error)

Translate returns actual index within the page for the requested element accounting for deletes.

For example, if the page consists of the operations: ins, ins, ins, del, ins and we ask to translate index 2, what we should get is index 4 since we have a del that would cancel out an ins.

type RLEToken

type RLEToken struct {
	Pos    int
	Repeat int
	Index  int
	Value  int64
}

type RawType

type RawType uint8
const (
	RawTypeUnknown   RawType = 0
	RawTypeVarInt    RawType = 1
	RawTypeByteArray RawType = 2
)

type Value

type Value struct {
	Int     int64
	Bytes   []byte
	RawType RawType
	// contains filtered or unexported fields
}

func ByteSliceValue

func ByteSliceValue(data []byte) Value

ByteSliceValue encodes to a var int length followed by the bytes

func Int64Value

func Int64Value(v int64) Value

Int64Value encodes to var int value

func PropertyValue

func PropertyValue(key int64, value []byte) Value

PropertyValue encodes to: * var int total length * var int key length * key bytes * var int value length * value bytes

While we could remove total length at the top, this would require a new raw format. Instead, we'll take the var int hit to allow us to encode the property as a byte slice.

func ReadValue

func ReadValue(rawType RawType, buffer []byte) (Value, error)

func RuneValue

func RuneValue(r rune) Value

RuneValue encodes var int value

func StringValue

func StringValue(s string) Value

StringValue encodes to a var int length followed by a byte array

func (Value) Append

func (v Value) Append(buffer []byte) ([]byte, error)

func (Value) Copy

func (v Value) Copy(target []byte)

func (Value) Length

func (v Value) Length() int

Length of encoded element

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL