model

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PreparePhyAddrData added in v0.6.0

func PreparePhyAddrData(
	id *objectio.Blockid, startRow, length uint32, pool *containers.VectorPool,
) (col containers.Vector, err error)

Types

type AOT added in v0.7.0

type AOT[B BlockT[R], R RowsT[R]] struct {
	sync.Mutex
	// contains filtered or unexported fields
}

AOT stands for append-only-table append-only is the most common form of data organization. A basic data structure is abstracted here, which can cover most scenarios, such as logtail data and checkpoint data

func NewAOT added in v0.7.0

func NewAOT[B BlockT[R], R RowsT[R]](
	blockSize int,
	blockFactory func(R) B,
	lessFn func(_, _ B) bool) *AOT[B, R]

func (*AOT[B, R]) Append added in v0.7.0

func (aot *AOT[B, R]) Append(rows R) (err error)

One appender

func (*AOT[B, R]) BlockCount added in v0.7.0

func (aot *AOT[B, R]) BlockCount() int

func (*AOT[B, R]) Close added in v0.7.0

func (aot *AOT[B, R]) Close()

func (*AOT[B, R]) GetBlocks added in v1.0.0

func (aot *AOT[B, R]) GetBlocks() *btree.BTreeG[B]

func (*AOT[B, R]) Max added in v0.7.0

func (aot *AOT[B, R]) Max() (b B)

func (*AOT[B, R]) Min added in v0.7.0

func (aot *AOT[B, R]) Min() (b B)

func (*AOT[B, R]) Scan added in v0.7.0

func (aot *AOT[B, R]) Scan(fn func(_ B) bool)

func (*AOT[B, R]) Snapshot added in v0.7.0

func (aot *AOT[B, R]) Snapshot() AOTSnapshot[B, R]

func (*AOT[B, R]) String added in v0.7.0

func (aot *AOT[B, R]) String() string

func (*AOT[B, R]) Truncate added in v0.7.0

func (aot *AOT[B, R]) Truncate(stopFn func(_ B) bool) (cnt int)

Truncate prunes the blocks. Deletable blocks are those have all txns prepared before the given timestamp For example: truncate the table by timestamp blocks: (Page1[bornTs=1], Page2[bornTs=10], Page3[bornTs=20]) Call Remain Delete Truncate(ts=5): (Page1,Page2,Page3), () Truncate(ts=12): (Page2,Page3), (Page1) Truncate(ts=30): (Page3), (Page1,Page2)

type AOTSnapshot added in v0.7.0

type AOTSnapshot[B BlockT[R], R RowsT[R]] interface {
	// Ascend the table within the range [pivot, last]
	Ascend(pivot B, iter func(blk B) bool)

	// Descend the table within the range [pivot, first]
	Descend(pivot B, iter func(blk B) bool)
}

AOTSnapshot represents the snapshot of a AOT

type BaseTreeVisitor added in v0.8.0

type BaseTreeVisitor struct {
	TableFn   func(uint64, uint64) error
	SegmentFn func(uint64, uint64, *objectio.Segmentid) error
	BlockFn   func(uint64, uint64, *objectio.Segmentid, uint16, uint16) error
}

func (*BaseTreeVisitor) String added in v0.8.0

func (visitor *BaseTreeVisitor) String() string

func (*BaseTreeVisitor) VisitBlock added in v0.8.0

func (visitor *BaseTreeVisitor) VisitBlock(
	dbID, tableID uint64, segmentID *objectio.Segmentid, Num, Seq uint16) (err error)

func (*BaseTreeVisitor) VisitSegment added in v0.8.0

func (visitor *BaseTreeVisitor) VisitSegment(dbID, tableID uint64, segmentID *objectio.Segmentid) (err error)

func (*BaseTreeVisitor) VisitTable added in v0.8.0

func (visitor *BaseTreeVisitor) VisitTable(dbID, tableID uint64) (err error)

type BatchBlock added in v0.7.0

type BatchBlock struct {
	*containers.Batch
	ID uint64
}

func NewBatchBlock added in v0.7.0

func NewBatchBlock(id uint64, attrs []string, colTypes []types.Type, opts containers.Options) *BatchBlock

func (*BatchBlock) IsAppendable added in v0.7.0

func (blk *BatchBlock) IsAppendable() bool

type BlockT added in v0.7.0

type BlockT[R RowsT[R]] interface {
	// Append appends a group of rows into the block
	Append(R) error

	// IsAppendable specifies wether the block is appendable
	IsAppendable() bool

	// Length specifies the row count of the block
	Length() int

	String() string

	// Close release the block bound resources
	// It should be called when the block is not used
	Close()
}

BlockT represents a block of rows

type HashPageTable added in v0.6.0

type HashPageTable = TransferTable[*TransferHashPage]

type LRUCache added in v0.8.0

type LRUCache interface {
	Set(ctx context.Context, k any, v []byte)
	Get(ctx context.Context, k any) ([]byte, bool)
	Size() int64
}

func NewSimpleLRU added in v0.8.0

func NewSimpleLRU(capacity int64) LRUCache

type PageT added in v0.6.0

type PageT[T common.IRef] interface {
	common.IRef
	Pin() *common.PinnedItem[T]
	TTL(time.Time, time.Duration) bool
	ID() *common.ID
}

type PreparedCompactedBlockData

type PreparedCompactedBlockData struct {
	Columns       *containers.Batch
	SortKey       containers.Vector
	SchemaVersion uint32
	Seqnums       []uint16
}

func NewPreparedCompactedBlockData

func NewPreparedCompactedBlockData() *PreparedCompactedBlockData

func (*PreparedCompactedBlockData) Close

func (preparer *PreparedCompactedBlockData) Close()

type RowsT added in v0.7.0

type RowsT[T any] interface {
	// row count
	Length() int

	// returns a window of the group of rows
	Window(offset, length int) T
}

RowsT represents a group of rows

type SegmentTree added in v0.8.0

type SegmentTree struct {
	ID   *objectio.Segmentid
	Blks map[keyT]struct{}
}

func NewSegmentTree added in v0.8.0

func NewSegmentTree(id *objectio.Segmentid) *SegmentTree

func (*SegmentTree) AddBlock added in v0.8.0

func (stree *SegmentTree) AddBlock(Num, Seq uint16)

func (*SegmentTree) Equal added in v0.8.0

func (stree *SegmentTree) Equal(o *SegmentTree) bool

func (*SegmentTree) IsEmpty added in v0.8.0

func (stree *SegmentTree) IsEmpty() bool

func (*SegmentTree) Merge added in v0.8.0

func (stree *SegmentTree) Merge(ot *SegmentTree)

func (*SegmentTree) ReadFrom added in v0.8.0

func (stree *SegmentTree) ReadFrom(r io.Reader) (n int64, err error)

func (*SegmentTree) Shrink added in v0.8.0

func (stree *SegmentTree) Shrink(id *objectio.Blockid) (empty bool)

func (*SegmentTree) WriteTo added in v0.8.0

func (stree *SegmentTree) WriteTo(w io.Writer) (n int64, err error)

type TableTree added in v0.8.0

type TableTree struct {
	DbID uint64
	ID   uint64
	Segs map[objectio.Segmentid]*SegmentTree
}

func NewTableTree added in v0.8.0

func NewTableTree(dbID, id uint64) *TableTree

func (*TableTree) AddBlock added in v0.8.0

func (ttree *TableTree) AddBlock(id *objectio.Blockid)

func (*TableTree) AddSegment added in v0.8.0

func (ttree *TableTree) AddSegment(sid *objectio.Segmentid)

func (*TableTree) Compact added in v0.8.0

func (ttree *TableTree) Compact() (empty bool)

func (*TableTree) Equal added in v0.8.0

func (ttree *TableTree) Equal(o *TableTree) bool

func (*TableTree) GetSegment added in v0.8.0

func (ttree *TableTree) GetSegment(id types.Uuid) *SegmentTree

func (*TableTree) IsEmpty added in v0.8.0

func (ttree *TableTree) IsEmpty() bool

func (*TableTree) Merge added in v0.8.0

func (ttree *TableTree) Merge(ot *TableTree)

func (*TableTree) ReadFrom added in v0.8.0

func (ttree *TableTree) ReadFrom(r io.Reader) (n int64, err error)

func (*TableTree) ShortBlocksString added in v1.0.0

func (ttree *TableTree) ShortBlocksString() string

func (*TableTree) Shrink added in v0.8.0

func (ttree *TableTree) Shrink(segID types.Uuid) (empty bool)

func (*TableTree) WriteTo added in v0.8.0

func (ttree *TableTree) WriteTo(w io.Writer) (n int64, err error)

type TimedSliceBlock added in v0.7.0

type TimedSliceBlock[R any] struct {
	BornTS types.TS
	Rows   []R
}

func NewTimedSliceBlock added in v0.7.0

func NewTimedSliceBlock[R any](ts types.TS) *TimedSliceBlock[R]

func (*TimedSliceBlock[R]) Append added in v0.7.0

func (blk *TimedSliceBlock[R]) Append(rows R) (err error)

func (*TimedSliceBlock[R]) Close added in v0.7.0

func (blk *TimedSliceBlock[R]) Close()

func (*TimedSliceBlock[R]) IsAppendable added in v0.7.0

func (blk *TimedSliceBlock[R]) IsAppendable() bool

func (*TimedSliceBlock[R]) Length added in v0.7.0

func (blk *TimedSliceBlock[R]) Length() int

func (*TimedSliceBlock[R]) String added in v0.7.0

func (blk *TimedSliceBlock[R]) String() string

type TransDels added in v1.0.0

type TransDels struct {

	// row -> commit ts
	Mapping map[int]types.TS
	// contains filtered or unexported fields
}

func NewTransDels added in v1.0.0

func NewTransDels(endts types.TS) *TransDels

func (*TransDels) PPString added in v1.0.0

func (t *TransDels) PPString() string

type TransDelsForBlks added in v1.0.0

type TransDelsForBlks struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTransDelsForBlks added in v1.0.0

func NewTransDelsForBlks() *TransDelsForBlks

func (*TransDelsForBlks) GetDelsForBlk added in v1.0.0

func (t *TransDelsForBlks) GetDelsForBlk(blkid types.Blockid) *TransDels

func (*TransDelsForBlks) Prune added in v1.0.0

func (t *TransDelsForBlks) Prune(gap time.Duration)

func (*TransDelsForBlks) SetDelsForBlk added in v1.0.0

func (t *TransDelsForBlks) SetDelsForBlk(blkid types.Blockid, dels *TransDels)

type TransferHashPage added in v0.6.0

type TransferHashPage struct {
	common.RefHelper
	// contains filtered or unexported fields
}

func NewTransferHashPage added in v0.6.0

func NewTransferHashPage(id *common.ID, ts time.Time) *TransferHashPage

func (*TransferHashPage) BornTS added in v0.6.0

func (page *TransferHashPage) BornTS() time.Time

func (*TransferHashPage) Close added in v0.6.0

func (page *TransferHashPage) Close()

func (*TransferHashPage) ID added in v0.6.0

func (page *TransferHashPage) ID() *common.ID

func (*TransferHashPage) Pin added in v0.6.0

func (*TransferHashPage) String added in v0.6.0

func (page *TransferHashPage) String() string

func (*TransferHashPage) TTL added in v0.6.0

func (page *TransferHashPage) TTL(now time.Time, ttl time.Duration) bool

func (*TransferHashPage) Train added in v0.6.0

func (page *TransferHashPage) Train(from uint32, to types.Rowid)

func (*TransferHashPage) Transfer added in v0.6.0

func (page *TransferHashPage) Transfer(from uint32) (dest types.Rowid, ok bool)

type TransferTable added in v0.6.0

type TransferTable[T PageT[T]] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewTransferTable added in v0.6.0

func NewTransferTable[T PageT[T]](ttl time.Duration) *TransferTable[T]

func (*TransferTable[T]) AddPage added in v0.6.0

func (table *TransferTable[T]) AddPage(page T) (dup bool)

func (*TransferTable[T]) Close added in v0.6.0

func (table *TransferTable[T]) Close()

func (*TransferTable[T]) DeletePage added in v0.6.0

func (table *TransferTable[T]) DeletePage(id *common.ID) (deleted bool)

func (*TransferTable[T]) Len added in v0.6.0

func (table *TransferTable[T]) Len() int

func (*TransferTable[T]) Pin added in v0.6.0

func (table *TransferTable[T]) Pin(id common.ID) (pinned *common.PinnedItem[T], err error)

func (*TransferTable[T]) RunTTL added in v0.6.0

func (table *TransferTable[T]) RunTTL(now time.Time)

type Tree added in v0.8.0

type Tree struct {
	Tables map[uint64]*TableTree
}

func NewTree added in v0.8.0

func NewTree() *Tree

func (*Tree) AddBlock added in v0.8.0

func (tree *Tree) AddBlock(dbID, tableID uint64, id *objectio.Blockid)

func (*Tree) AddSegment added in v0.8.0

func (tree *Tree) AddSegment(dbID, tableID uint64, id *objectio.Segmentid)

func (*Tree) AddTable added in v0.8.0

func (tree *Tree) AddTable(dbID, id uint64)

func (*Tree) Compact added in v0.8.0

func (tree *Tree) Compact() (empty bool)

func (*Tree) Equal added in v0.8.0

func (tree *Tree) Equal(o *Tree) bool

func (*Tree) GetSegment added in v0.8.0

func (tree *Tree) GetSegment(tableID uint64, segID types.Uuid) *SegmentTree

func (*Tree) GetTable added in v0.8.0

func (tree *Tree) GetTable(id uint64) *TableTree

func (*Tree) HasTable added in v0.8.0

func (tree *Tree) HasTable(id uint64) bool

func (*Tree) IsEmpty added in v0.8.0

func (tree *Tree) IsEmpty() bool

func (*Tree) Merge added in v0.8.0

func (tree *Tree) Merge(ot *Tree)

func (*Tree) ReadFrom added in v0.8.0

func (tree *Tree) ReadFrom(r io.Reader) (n int64, err error)

func (*Tree) Reset added in v0.8.0

func (tree *Tree) Reset()

func (*Tree) Shrink added in v0.8.0

func (tree *Tree) Shrink(tableID uint64) (empty bool)

func (*Tree) String added in v0.8.0

func (tree *Tree) String() string

func (*Tree) TableCount added in v0.8.0

func (tree *Tree) TableCount() int

func (*Tree) Visit added in v0.8.0

func (tree *Tree) Visit(visitor TreeVisitor) (err error)

func (*Tree) WriteTo added in v0.8.0

func (tree *Tree) WriteTo(w io.Writer) (n int64, err error)

type TreeVisitor added in v0.8.0

type TreeVisitor interface {
	VisitTable(dbID, id uint64) error
	VisitSegment(uint64, uint64, *objectio.Segmentid) error
	VisitBlock(uint64, uint64, *objectio.Segmentid, uint16, uint16) error
	String() string
}

Jump to

Keyboard shortcuts

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