objects

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2023 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

View Source
const BlockSize = 255

Variables

View Source
var ErrKeyNotFound = fmt.Errorf("key not found")

Functions

func BlockExist

func BlockExist(s Store, sum []byte) bool

func BlockIndexExist

func BlockIndexExist(s Store, sum []byte) bool

func BlocksCount

func BlocksCount(rowsCount uint32) uint32

func CombineRowBytesIntoBlock

func CombineRowBytesIntoBlock(blk [][]byte) []byte

func CommitExist

func CommitExist(s Store, sum []byte) bool

func DeleteAllCommit

func DeleteAllCommit(s Store) error

func DeleteBlock

func DeleteBlock(s Store, sum []byte) error

func DeleteBlockIndex

func DeleteBlockIndex(s Store, sum []byte) error

func DeleteCommit

func DeleteCommit(s Store, sum []byte) error

func DeleteTable

func DeleteTable(s Store, sum []byte) error

func DeleteTableIndex

func DeleteTableIndex(s Store, sum []byte) error

func DeleteTableProfile added in v0.8.0

func DeleteTableProfile(s Store, sum []byte) error

func GetAllBlockIndexKeys added in v0.8.5

func GetAllBlockIndexKeys(s Store) ([][]byte, error)

func GetAllBlockKeys

func GetAllBlockKeys(s Store) ([][]byte, error)

func GetAllCommitKeys

func GetAllCommitKeys(s Store) ([][]byte, error)

func GetAllTableIndexKeys added in v0.8.5

func GetAllTableIndexKeys(s Store) ([][]byte, error)

func GetAllTableKeys

func GetAllTableKeys(s Store) ([][]byte, error)

func GetAllTableProfileKeys added in v0.8.5

func GetAllTableProfileKeys(s Store) ([][]byte, error)

func GetBlock

func GetBlock(s Store, buf, sum []byte) (blk [][]string, dst []byte, err error)

func GetBlockBytes

func GetBlockBytes(s Store, sum []byte) ([]byte, error)

func GetTableIndex

func GetTableIndex(s Store, sum []byte) ([][]string, error)

func NopCloser

func NopCloser(r io.ReadSeeker) io.ReadSeekCloser

func Prefixes added in v0.11.11

func Prefixes() []string

func ReadBlockFrom

func ReadBlockFrom(r io.Reader) (int64, [][]string, error)

func SaveBlock

func SaveBlock(s Store, buf, content []byte) (sum, dst []byte, err error)

func SaveBlockIndex

func SaveBlockIndex(s Store, buf, content []byte) (sum, dst []byte, err error)

func SaveCommit

func SaveCommit(s Store, content []byte) (sum []byte, err error)

func SaveCompressedBlock added in v0.6.0

func SaveCompressedBlock(s Store, content, compressed []byte) (sum []byte, err error)

func SaveTable

func SaveTable(s Store, content []byte) (sum []byte, err error)

func SaveTableIndex

func SaveTableIndex(s Store, sum, content []byte) (err error)

func SaveTableProfile added in v0.8.0

func SaveTableProfile(s Store, sum, content []byte) (err error)

func StringSliceIsLess

func StringSliceIsLess(pk []uint32, a, b []string) bool

func TableExist

func TableExist(s Store, sum []byte) bool

func TableIndexExist

func TableIndexExist(s Store, sum []byte) bool

func ValidateBlockBytes

func ValidateBlockBytes(b []byte) (err error)

func ValidateStrListBytes

func ValidateStrListBytes(b []byte) (int, error)

func WriteBlockTo

func WriteBlockTo(enc *StrListEncoder, w io.Writer, blk [][]string) (int64, error)

Types

type BlockIndex

type BlockIndex struct {
	Rows [][]byte
	// contains filtered or unexported fields
}

func GetBlockIndex

func GetBlockIndex(s Store, buf, sum []byte) (idx *BlockIndex, dst []byte, err error)

func IndexBlock

func IndexBlock(enc *StrListEncoder, hash hash.Hash, blk [][]string, pk []uint32) (*BlockIndex, error)

func IndexBlockFromBytes

func IndexBlockFromBytes(dec *StrListDecoder, hash *meow.Digest, e *StrListEditor, blockBytes []byte, pk []uint32) (*BlockIndex, error)

IndexBlockFromBytes creates BlockIndex from block bytes

func ReadBlockIndex

func ReadBlockIndex(r io.Reader) (int64, *BlockIndex, error)

func (*BlockIndex) Get

func (idx *BlockIndex) Get(pkSum []byte) (byte, []byte)

func (*BlockIndex) Len

func (idx *BlockIndex) Len() int

func (*BlockIndex) Less

func (idx *BlockIndex) Less(i, j int) bool

func (*BlockIndex) ReadFrom

func (idx *BlockIndex) ReadFrom(r io.Reader) (int64, error)

func (*BlockIndex) Swap

func (idx *BlockIndex) Swap(i, j int)

func (*BlockIndex) WriteTo

func (idx *BlockIndex) WriteTo(w io.Writer) (int64, error)

type ColumnProfile added in v0.8.0

type ColumnProfile struct {
	Name         string      `json:"name"`
	NACount      uint32      `json:"naCount"`
	Min          *float64    `json:"min,omitempty"`
	Max          *float64    `json:"max,omitempty"`
	Mean         *float64    `json:"mean,omitempty"`
	Median       *float64    `json:"median,omitempty"`
	StdDeviation *float64    `json:"stdDeviation,omitempty"`
	MinStrLen    uint16      `json:"minStrLen"`
	MaxStrLen    uint16      `json:"maxStrLen"`
	AvgStrLen    uint16      `json:"avgStrLen"`
	TopValues    ValueCounts `json:"topValues,omitempty"`
	Percentiles  []float64   `json:"percentiles,omitempty"`
}

type Commit

type Commit struct {
	Sum         []byte
	Table       []byte
	AuthorName  string
	AuthorEmail string
	Time        time.Time
	Message     string
	Parents     [][]byte
}

func GetCommit

func GetCommit(s Store, sum []byte) (*Commit, error)

func ReadCommitFrom

func ReadCommitFrom(r io.Reader) (int64, *Commit, error)

func (*Commit) ReadFrom

func (c *Commit) ReadFrom(r io.Reader) (int64, error)

func (*Commit) WriteTo

func (c *Commit) WriteTo(w io.Writer) (int64, error)

type Diff

type Diff struct {
	PK        []byte
	Sum       []byte
	OldSum    []byte
	Offset    uint32
	OldOffset uint32
}

type FloatListDecoder added in v0.8.0

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

FloatListDecoder decodes string slice.

func NewFloatListDecoder added in v0.8.0

func NewFloatListDecoder(reuseRecords bool) *FloatListDecoder

func (*FloatListDecoder) Decode added in v0.8.0

func (d *FloatListDecoder) Decode(b []byte) []float64

func (*FloatListDecoder) Read added in v0.8.0

func (d *FloatListDecoder) Read(r io.Reader) (int64, []float64, error)

type FloatListEncoder added in v0.8.0

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

FloatListEncoder encodes string slice. Max bytes size for each string is 65536 bytes

func NewFloatListEncoder added in v0.8.0

func NewFloatListEncoder() *FloatListEncoder

func (*FloatListEncoder) Encode added in v0.8.0

func (e *FloatListEncoder) Encode(sl []float64) []byte

type Store

type Store interface {
	Get([]byte) ([]byte, error)
	Set([]byte, []byte) error
	Delete([]byte) error
	Exist([]byte) bool
	Filter([]byte) (map[string][]byte, error)
	FilterKey([]byte) ([][]byte, error)
	Clear([]byte) error
	Close() error
}

type StrList

type StrList []byte

func (StrList) LessThan

func (b StrList) LessThan(columns []uint32, c StrList) bool

LessThan returns true if a is less than b based on given column indices

func (StrList) ReadColumns

func (b StrList) ReadColumns(columns []uint32) []string

type StrListDecoder

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

StrListDecoder decodes string slice.

func NewStrListDecoder

func NewStrListDecoder(reuseRecords bool) *StrListDecoder

func (*StrListDecoder) Decode

func (d *StrListDecoder) Decode(b []byte) []string

func (*StrListDecoder) Read

func (d *StrListDecoder) Read(r io.Reader) (int64, []string, error)

func (*StrListDecoder) ReadBytes

func (d *StrListDecoder) ReadBytes(r io.Reader) (n int, b []byte, err error)

ReadBytes returns the number of bytes and the actual bytes of encoded StrList

type StrListEditor

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

StrListEditor can either remove certain columns from StrList or remove everything except certain columns. It is built to minimize allocations so given StrList will always be edit in place.

func NewStrListEditor

func NewStrListEditor(columns []uint32) *StrListEditor

func (*StrListEditor) PickFrom

func (r *StrListEditor) PickFrom(dst, src []byte) []byte

func (*StrListEditor) RemoveFrom

func (r *StrListEditor) RemoveFrom(b []byte) []byte

type StrListEncoder

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

StrListEncoder encodes string slice. Max bytes size for each string is 65536 bytes

func NewStrListEncoder

func NewStrListEncoder(reuseRecords bool) *StrListEncoder

func (*StrListEncoder) Encode

func (e *StrListEncoder) Encode(sl []string) []byte

type Table

type Table struct {
	Sum          []byte
	Columns      []string
	PK           []uint32
	RowsCount    uint32
	Blocks       [][]byte
	BlockIndices [][]byte
}

func GetTable

func GetTable(s Store, sum []byte) (*Table, error)

func NewTable

func NewTable(columns []string, pk []uint32) *Table

func ReadTableFrom

func ReadTableFrom(r io.Reader) (int64, *Table, error)

func (*Table) HasValidBlockIndices added in v0.12.1

func (t *Table) HasValidBlockIndices() bool

func (*Table) PrimaryKey

func (t *Table) PrimaryKey() []string

func (*Table) ReadFrom

func (t *Table) ReadFrom(r io.Reader) (int64, error)

func (*Table) WriteTo

func (t *Table) WriteTo(w io.Writer) (int64, error)

type TableProfile added in v0.8.0

type TableProfile struct {
	Version   uint32           `json:"-"`
	RowsCount uint32           `json:"rowsCount"`
	Columns   []*ColumnProfile `json:"columns"`
}

func GetTableProfile added in v0.8.0

func GetTableProfile(s Store, sum []byte) (*TableProfile, error)

func (*TableProfile) ReadFrom added in v0.8.0

func (t *TableProfile) ReadFrom(r io.Reader) (total int64, err error)

func (*TableProfile) WriteTo added in v0.8.0

func (t *TableProfile) WriteTo(w io.Writer) (total int64, err error)

type UintListDecoder

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

UintListDecoder decodes string slice.

func NewUintListDecoder

func NewUintListDecoder(reuseRecords bool) *UintListDecoder

func (*UintListDecoder) Decode

func (d *UintListDecoder) Decode(b []byte) []uint32

func (*UintListDecoder) Read

func (d *UintListDecoder) Read(r io.Reader) (int64, []uint32, error)

type UintListEncoder

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

UintListEncoder encodes string slice. Max bytes size for each string is 65536 bytes

func NewUintListEncoder

func NewUintListEncoder() *UintListEncoder

func (*UintListEncoder) Encode

func (e *UintListEncoder) Encode(sl []uint32) []byte

type ValueCount added in v0.8.0

type ValueCount struct {
	Value string `json:"v"`
	Count uint32 `json:"c"`
}

type ValueCounts added in v0.8.0

type ValueCounts []ValueCount

func (ValueCounts) IsEmpty added in v0.8.0

func (a ValueCounts) IsEmpty() bool

func (ValueCounts) Len added in v0.8.0

func (a ValueCounts) Len() int

func (ValueCounts) Less added in v0.8.0

func (a ValueCounts) Less(i, j int) bool

func (ValueCounts) Swap added in v0.8.0

func (a ValueCounts) Swap(i, j int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL