base

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockType

type BlockType uint8
const (
	// TRANSIENT_BLK means blk is in memtable
	TRANSIENT_BLK BlockType = iota

	// PERSISTENT_BLK means that blk has created a .blk file
	// TOTO : don't create a .blk file, write it to a .seg file
	PERSISTENT_BLK

	// PERSISTENT_SORTED_BLK means that blk has been
	// written or & merged in the .seg(segment) file
	PERSISTENT_SORTED_BLK
)

func (BlockType) String

func (bt BlockType) String() string

type IBaseFile

type IBaseFile interface {
	io.Closer
	common.IRef
	GetIndicesMeta() *IndicesMeta

	// ReadPoint reads Part to buf, and detects Pointer.Len
	// in aoe, the Pointer is Column
	ReadPoint(ptr *Pointer, buf []byte)

	// ReadPart is to use part[colIdx] to find Pointer and then call ReadPoint
	// the external Read interface is implemented through ReadPart
	ReadPart(colIdx uint64, id common.ID, buf []byte)

	// PrefetchPart calls readahead in Linux
	PrefetchPart(colIdx uint64, id common.ID) error

	// PartSize returns a Pointer Len or OriginLen
	PartSize(colIdx uint64, id common.ID, isOrigin bool) int64

	// DataCompressAlgo returns the compress type of the BaseFIle
	DataCompressAlgo(common.ID) int

	// Stat retruns FileInfo of the BaseFile
	// initialize at the time of new(BaseFIle)
	Stat() common.FileInfo
	MakeVirtualIndexFile(*IndexMeta) common.IVFile
	GetDir() string

	CopyTo(dir string) error
	LinkTo(dir string) error
}

IBaseFile is block&segment file interface, cannot provide external services, need New a ColumnPart provide external services. When New a block&segment object, initPointers is called to initialize the Pointers of CloumnPart

type IBlockFile

type IBlockFile interface {
	IBaseFile
}

type IManager

type IManager interface {
	// RegisterSortedFiles adds physical segment file(SORTED_SEG)
	// to Manager.SortedFiles[]
	RegisterSortedFiles(common.ID) (ISegmentFile, error)

	// RegisterUnsortedFiles adds logical segment file(UNSORTED_SEG)
	// to Manager.UnsortedFiles[]
	RegisterUnsortedFiles(common.ID) (ISegmentFile, error)

	// UnregisterUnsortedFile deletes a logical segment file
	// from Manager.UnsortedFiles[]
	UnregisterUnsortedFile(common.ID)

	// UnregisterSortedFile deletes a physical segment file
	// from Manager.SortedFiles[]
	UnregisterSortedFile(common.ID)

	// UpgradeFile creates a physical segment file based on common.ID and
	// delete it from Manager.UnsortedFiles[] and add it to Manager.SortedFiles[]
	UpgradeFile(common.ID) ISegmentFile

	GetSortedFile(common.ID) ISegmentFile
	GetUnsortedFile(common.ID) ISegmentFile

	// String print every item of Manager.SortedFiles[]&Manager.UnsortedFiles[]
	String() string
}

IManager is a segment file manager that maintains SortedFiles[]&UnsortedFiles[] and can create a physical segment file

type ISegmentFile

type ISegmentFile interface {
	IBaseFile

	// RefBlock acquires a reference to the underlying block.
	RefBlock(blkId common.ID)

	// UnrefBlock releases the reference to the underlying block
	UnrefBlock(blkId common.ID)

	RegisterTBlock(blkId common.ID) (IBlockFile, error)
	RefTBlock(blkId common.ID) IBlockFile

	GetBlockSize(blkId common.ID) int64

	// ReadBlockPoint reads a Pointer data to buf,
	// which called by EmbedBlockIndexFile.
	ReadBlockPoint(id common.ID, ptr *Pointer, buf []byte)
	GetBlockIndicesMeta(id common.ID) *IndicesMeta

	MakeVirtualBlkIndexFile(id common.ID, meta *IndexMeta) common.IVFile

	MakeVirtualSeparateIndexFile(file *os.File, id *common.ID, meta *IndexMeta) common.IVFile

	// MakeVirtualPartFile creates a new column part. ColumnPart provides external Read services
	MakeVirtualPartFile(id *common.ID) common.IVFile
}

type IndexMeta

type IndexMeta struct {
	Type IndexType
	Cols *roaring.Bitmap
	Ptr  *Pointer
}

func (*IndexMeta) String

func (m *IndexMeta) String() string

type IndexType

type IndexType = uint16
const (
	ZoneMap IndexType = iota
	NumBsi
	FixStrBsi
)

type IndicesMeta

type IndicesMeta struct {
	Data []*IndexMeta
}

func NewIndicesMeta

func NewIndicesMeta() *IndicesMeta

func (*IndicesMeta) String

func (m *IndicesMeta) String() string

type Key

type Key struct {
	Col uint64
	ID  common.ID
}

type Pointer

type Pointer struct {
	// Offset type is int64 because the parameter of ReadAt is int64
	Offset int64

	// Len is the length of Column storage is generally compressed
	Len uint64

	// OriginLen is the original length of Column and has not been compressed
	OriginLen uint64
}

type SegmentType

type SegmentType uint8
const (
	// UNSORTED_SEG is logical segment file,
	// only .blk&memtbale files have not been merged,
	// or only memtbale block.
	UNSORTED_SEG SegmentType = iota

	// SORTED_SEG is (block count) Already FULL, merge sorted.
	SORTED_SEG
)

func (SegmentType) String

func (st SegmentType) String() string

Jump to

Keyboard shortcuts

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