objects

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BlockSize = 255

Variables

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

Functions

func BlockExist added in v0.3.0

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

func BlockIndexExist added in v0.3.0

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

func BlocksCount added in v0.3.0

func BlocksCount(rowsCount uint32) uint32

func CombineRowBytesIntoBlock added in v0.3.0

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

func CommitExist added in v0.3.0

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

func DeleteAllCommit added in v0.3.0

func DeleteAllCommit(s Store) error

func DeleteBlock added in v0.3.0

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

func DeleteBlockIndex added in v0.3.0

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

func DeleteCommit added in v0.3.0

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

func DeleteTable added in v0.3.0

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

func DeleteTableIndex added in v0.3.0

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

func GetAllBlockKeys added in v0.3.0

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

func GetAllCommitKeys added in v0.3.0

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

func GetAllTableKeys added in v0.3.0

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

func GetBlock added in v0.3.0

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

func GetBlockBytes added in v0.3.0

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

func GetTableIndex added in v0.3.0

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

func NopCloser added in v0.3.0

func NopCloser(r io.ReadSeeker) io.ReadSeekCloser

func ReadBlockFrom added in v0.3.0

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

func SaveBlock added in v0.3.0

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

func SaveBlockIndex added in v0.3.0

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

func SaveCommit added in v0.3.0

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

func SaveTable added in v0.3.0

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

func SaveTableIndex added in v0.3.0

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

func StringSliceIsLess added in v0.3.0

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

func TableExist added in v0.3.0

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

func TableIndexExist added in v0.3.0

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

func ValidateBlockBytes added in v0.3.11

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

func ValidateStrListBytes added in v0.3.11

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

func WriteBlockTo added in v0.3.0

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

Types

type BlockIndex added in v0.3.0

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

func GetBlockIndex added in v0.3.0

func GetBlockIndex(s Store, sum []byte) (*BlockIndex, error)

func IndexBlock added in v0.3.0

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

func IndexBlockFromBytes added in v0.3.0

func IndexBlockFromBytes(dec *StrListDecoder, hash hash.Hash, e *StrListEditor, blk []byte, pk []uint32) (*BlockIndex, error)

func ReadBlockIndex added in v0.3.0

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

func (*BlockIndex) Get added in v0.3.0

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

func (*BlockIndex) Len added in v0.3.0

func (idx *BlockIndex) Len() int

func (*BlockIndex) Less added in v0.3.0

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

func (*BlockIndex) ReadFrom added in v0.3.0

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

func (*BlockIndex) Swap added in v0.3.0

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

func (*BlockIndex) WriteTo added in v0.3.0

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

type Commit

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

func GetCommit added in v0.3.0

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

func ReadCommitFrom added in v0.3.0

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

func (*Commit) ReadFrom added in v0.3.0

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

func (*Commit) WriteTo added in v0.3.0

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

type Diff added in v0.3.0

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

type Store added in v0.3.0

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 added in v0.3.0

type StrList []byte

func (StrList) LessThan added in v0.3.0

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 added in v0.3.0

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

type StrListDecoder added in v0.2.0

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

StrListDecoder decodes string slice.

func NewStrListDecoder added in v0.2.0

func NewStrListDecoder(reuseRecords bool) *StrListDecoder

func (*StrListDecoder) Decode added in v0.2.0

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

func (*StrListDecoder) Read added in v0.2.0

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

func (*StrListDecoder) ReadBytes added in v0.3.0

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

type StrListEditor added in v0.3.0

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 added in v0.3.0

func NewStrListEditor(columns []uint32) *StrListEditor

func (*StrListEditor) PickFrom added in v0.3.0

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

func (*StrListEditor) RemoveFrom added in v0.3.0

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

type StrListEncoder added in v0.2.0

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

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

func NewStrListEncoder added in v0.2.0

func NewStrListEncoder(reuseRecords bool) *StrListEncoder

func (*StrListEncoder) Encode added in v0.2.0

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

type Table added in v0.2.0

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

func GetTable added in v0.3.0

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

func NewTable added in v0.3.0

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

func ReadTableFrom added in v0.3.0

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

func (*Table) PrimaryKey added in v0.3.0

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

func (*Table) ReadFrom added in v0.3.0

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

func (*Table) WriteTo added in v0.3.0

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

type UintListDecoder added in v0.2.0

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

UintListDecoder decodes string slice.

func NewUintListDecoder added in v0.2.0

func NewUintListDecoder(reuseRecords bool) *UintListDecoder

func (*UintListDecoder) Decode added in v0.2.0

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

func (*UintListDecoder) Read added in v0.2.0

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

type UintListEncoder added in v0.2.0

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

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

func NewUintListEncoder added in v0.2.0

func NewUintListEncoder() *UintListEncoder

func (*UintListEncoder) Encode added in v0.2.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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