indexwrapper

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(raw []byte, ctyp CompressType) []byte

func Decompress

func Decompress(src []byte, dst []byte, ctyp CompressType) error

func NewImmutableIndex

func NewImmutableIndex() *immutableIndex

func NewMutableIndex

func NewMutableIndex(keyT types.Type) *mutableIndex

func TranslateError

func TranslateError(err error) error

Types

type BFReader

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

func NewBFReader

func NewBFReader(mgr base.INodeManager, file common.IVFile, id *common.ID) *BFReader

func (*BFReader) Destroy

func (reader *BFReader) Destroy() (err error)

func (*BFReader) MayContainsAnyKeys

func (reader *BFReader) MayContainsAnyKeys(keys containers.Vector, visibility *roaring.Bitmap) (bool, *roaring.Bitmap, error)

func (*BFReader) MayContainsKey

func (reader *BFReader) MayContainsKey(key any) (bool, error)

type BFWriter

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

func NewBFWriter

func NewBFWriter() *BFWriter

func (*BFWriter) AddValues

func (writer *BFWriter) AddValues(values containers.Vector) error

func (*BFWriter) Finalize

func (writer *BFWriter) Finalize() (*IndexMeta, error)

func (*BFWriter) Init

func (writer *BFWriter) Init(file common.IRWFile, cType CompressType, colIdx uint16, internalIdx uint16) error

func (*BFWriter) Query

func (writer *BFWriter) Query(key any) (bool, error)

Query is only used for testing or debugging

type CompressType

type CompressType uint8
const (
	Plain CompressType = iota
	Lz4
)

type DeletesMap

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

func NewDeletesMap

func NewDeletesMap(typ types.Type) *DeletesMap

func (*DeletesMap) GetMaxTS

func (m *DeletesMap) GetMaxTS() uint64

func (*DeletesMap) HasDeleteFrom

func (m *DeletesMap) HasDeleteFrom(key any, fromTs uint64) (existed bool)

func (*DeletesMap) IsKeyDeleted

func (m *DeletesMap) IsKeyDeleted(key any, ts uint64) (deleted bool, existed bool)

func (*DeletesMap) LogDeletedKey

func (m *DeletesMap) LogDeletedKey(key any, row uint32, ts uint64) (err error)

func (*DeletesMap) RemoveOne added in v0.5.1

func (m *DeletesMap) RemoveOne(key any, row uint32)

func (*DeletesMap) RemoveTs added in v0.5.1

func (m *DeletesMap) RemoveTs(ts uint64)

func (*DeletesMap) RowCount

func (m *DeletesMap) RowCount(key any) int

func (*DeletesMap) Size

func (m *DeletesMap) Size() int

type Index

type Index interface {
	io.Closer
	Destroy() error

	// Dedup returns wether the specified key is existed
	// If key is existed, return ErrDuplicate
	// If any other unknown error happens, return error
	// If key is not found, return nil
	Dedup(key any) error

	BatchDedup(keys containers.Vector, rowmask *roaring.Bitmap) (keyselects *roaring.Bitmap, err error)

	// BatchUpsert batch insert the specific keys
	// If any deduplication, it will fetch the old value first, fill the active map with new value, insert the old value into delete map
	// If any other unknown error hanppens, return error
	BatchUpsert(keysCtx *index.KeysCtx, offset int, ts uint64) (*index.BatchResp, error)

	// Delete delete the specific key
	// If the specified key not found in active map, return ErrNotFound
	// If any other error happens, return error
	// Delete the specific key from active map and then insert it into delete map
	Delete(key any, ts uint64) error
	GetActiveRow(key any) (row uint32, err error)
	// Check deletes map for specified key @ts
	// If deleted is true, the specified key was deleted @ts
	// If existed is false, the specified key was not found in deletes map
	IsKeyDeleted(key any, ts uint64) (deleted bool, existed bool)
	HasDeleteFrom(key any, fromTs uint64) bool
	GetMaxDeleteTS() uint64

	String() string

	ReadFrom(data.Block) error
	WriteTo(data.Block) error
}

type IndexMeta

type IndexMeta struct {
	IdxType     IndexType
	CompType    CompressType
	ColIdx      uint16
	InternalIdx uint16
	Size        uint32
	RawSize     uint32
}

func NewEmptyIndexMeta

func NewEmptyIndexMeta() *IndexMeta

func (*IndexMeta) Marshal

func (meta *IndexMeta) Marshal() ([]byte, error)

func (*IndexMeta) SetCompressType

func (meta *IndexMeta) SetCompressType(typ CompressType)

func (*IndexMeta) SetIndexType

func (meta *IndexMeta) SetIndexType(typ IndexType)

func (*IndexMeta) SetIndexedColumn

func (meta *IndexMeta) SetIndexedColumn(colIdx uint16)

func (*IndexMeta) SetInternalIndex

func (meta *IndexMeta) SetInternalIndex(idx uint16)

func (*IndexMeta) SetSize

func (meta *IndexMeta) SetSize(raw, exact uint32)

func (*IndexMeta) Unmarshal

func (meta *IndexMeta) Unmarshal(buf []byte) error

type IndexType

type IndexType uint8
const (
	InvalidIndexType IndexType = iota
	BlockZoneMapIndex
	SegmentZoneMapIndex
	StaticFilterIndex
	ARTIndex
)

type IndicesMeta

type IndicesMeta struct {
	Metas []IndexMeta
}

func NewEmptyIndicesMeta

func NewEmptyIndicesMeta() *IndicesMeta

func (*IndicesMeta) AddIndex

func (metas *IndicesMeta) AddIndex(meta IndexMeta)

func (*IndicesMeta) Marshal

func (metas *IndicesMeta) Marshal() ([]byte, error)

func (*IndicesMeta) Unmarshal

func (metas *IndicesMeta) Unmarshal(buf []byte) error

type ZMReader

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

func NewZMReader

func NewZMReader(mgr base.INodeManager, file common.IVFile, id *common.ID) *ZMReader

func (*ZMReader) Contains

func (reader *ZMReader) Contains(key any) bool

func (*ZMReader) ContainsAny

func (reader *ZMReader) ContainsAny(keys containers.Vector) (visibility *roaring.Bitmap, ok bool)

func (*ZMReader) Destroy

func (reader *ZMReader) Destroy() (err error)

type ZMWriter

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

func NewZMWriter

func NewZMWriter() *ZMWriter

func (*ZMWriter) AddValues

func (writer *ZMWriter) AddValues(values containers.Vector) (err error)

func (*ZMWriter) Finalize

func (writer *ZMWriter) Finalize() (*IndexMeta, error)

func (*ZMWriter) Init

func (writer *ZMWriter) Init(file common.IRWFile, cType CompressType, colIdx uint16, internalIdx uint16) error

func (*ZMWriter) SetMinMax

func (writer *ZMWriter) SetMinMax(min, max any, typ types.Type) (err error)

Jump to

Keyboard shortcuts

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