Documentation
¶
Index ¶
- Constants
- func AddTransferPage(page *TransferHashPage, ioVector *fileservice.IOVector, bufs *[]*bytes.Buffer) error
- func DecodeTransferFileName(name string) (time.Time, error)
- func GetDiskTTL() time.Duration
- func GetTTL() time.Duration
- func GetTransferFS(fs *fileservice.TmpFileService) (fileservice.FileService, error)
- func GetTransferFileName() string
- func InitTransferPageIO() *fileservice.IOVector
- func ReleaseMarshalBufs(bufs []*bytes.Buffer)
- func SetDiskTTL(t time.Duration)
- func SetTTL(t time.Duration)
- func TransferFileGCFn(filePath string, fs fileservice.FileService) (neesGC bool, err error)
- func WriteTransferPage(ctx context.Context, fs fileservice.FileService, pages []*TransferHashPage, ...) error
- type AOT
- func (aot *AOT[B, R]) Append(rows R) (err error)
- func (aot *AOT[B, R]) BlockCount() int
- func (aot *AOT[B, R]) Close()
- func (aot *AOT[B, R]) GetBlocks() *btree.BTreeG[B]
- func (aot *AOT[B, R]) Max() (b B)
- func (aot *AOT[B, R]) Min() (b B)
- func (aot *AOT[B, R]) Scan(fn func(_ B) bool)
- func (aot *AOT[B, R]) Snapshot() AOTSnapshot[B, R]
- func (aot *AOT[B, R]) String() string
- func (aot *AOT[B, R]) Truncate(stopFn func(_ B) bool) (cnt int)
- type AOTSnapshot
- type BaseTreeVisitor
- type BatchBlock
- type BlockT
- type HashPageTable
- type PageT
- type Path
- type RowsT
- type TableRecord
- type TimedSliceBlock
- type TransDels
- type TransDelsForBlks
- type TransferHashPage
- func (page *TransferHashPage) BornTS() time.Time
- func (page *TransferHashPage) Clear()
- func (page *TransferHashPage) ClearPersistTable()
- func (page *TransferHashPage) Close()
- func (page *TransferHashPage) ID() *common.ID
- func (page *TransferHashPage) IsPersist() bool
- func (page *TransferHashPage) Length() int
- func (page *TransferHashPage) Marshal() *bytes.Buffer
- func (page *TransferHashPage) Pin() *common.PinnedItem[*TransferHashPage]
- func (page *TransferHashPage) SetBornTS(ts time.Time)
- func (page *TransferHashPage) SetPath(path Path)
- func (page *TransferHashPage) String() string
- func (page *TransferHashPage) TTL() uint8
- func (page *TransferHashPage) Train(m api.TransferMap)
- func (page *TransferHashPage) TrainDetached(m api.TransferMap)
- func (page *TransferHashPage) Transfer(from uint32) (dest types.Rowid, ok bool)
- func (page *TransferHashPage) Unmarshal(data []byte) (*api.TransferMap, error)
- type TransferTable
- func (table *TransferTable[T]) AddPage(page T) (dup bool)
- func (table *TransferTable[T]) Close()
- func (table *TransferTable[T]) DeletePage(id *common.ID) (deleted bool)
- func (table *TransferTable[T]) Len() int
- func (table *TransferTable[T]) Pin(id common.ID) (pinned *common.PinnedItem[T], err error)
- func (table *TransferTable[T]) RunTTL()
- type Tree
- func (tree *Tree) AddObject(dbID, tableID uint64, _ *objectio.ObjectId, _ bool)
- func (tree *Tree) AddTable(dbID, id uint64)
- func (tree *Tree) ApproxSize() int64
- func (tree *Tree) Equal(o *Tree) bool
- func (tree *Tree) GetTable(id uint64) *TableRecord
- func (tree *Tree) HasTable(id uint64) bool
- func (tree *Tree) IsEmpty() bool
- func (tree *Tree) Merge(ot *Tree)
- func (tree *Tree) ReadFromWithVersion(r io.Reader, ver uint16) (n int64, err error)
- func (tree *Tree) Reset()
- func (tree *Tree) Shrink(tableID uint64) (empty bool)
- func (tree *Tree) String() string
- func (tree *Tree) TableCount() int
- func (tree *Tree) Visit(visitor TreeVisitor) (err error)
- func (tree *Tree) WriteTo(w io.Writer) (n int64, err error)
- type TreeVisitor
Constants ¶
const ( MemoTreeVersion1 uint16 = iota MemoTreeVersion2 MemoTreeVersion3 MemoTreeVersion4 )
const (
TransferDir = "transfer"
)
Variables ¶
This section is empty.
Functions ¶
func AddTransferPage ¶
func AddTransferPage(page *TransferHashPage, ioVector *fileservice.IOVector, bufs *[]*bytes.Buffer) error
func GetDiskTTL ¶
func GetTransferFS ¶
func GetTransferFS(fs *fileservice.TmpFileService) (fileservice.FileService, error)
func GetTransferFileName ¶
func GetTransferFileName() string
func InitTransferPageIO ¶
func InitTransferPageIO() *fileservice.IOVector
func ReleaseMarshalBufs ¶
ReleaseMarshalBufs returns pooled bytes.Buffers obtained from Marshal back to the pool. Call after the data slices are no longer referenced (e.g. after fs.Write completes).
func SetDiskTTL ¶
func TransferFileGCFn ¶
func TransferFileGCFn(filePath string, fs fileservice.FileService) (neesGC bool, err error)
func WriteTransferPage ¶
func WriteTransferPage(ctx context.Context, fs fileservice.FileService, pages []*TransferHashPage, ioVector fileservice.IOVector, bufs []*bytes.Buffer) error
Types ¶
type AOT ¶ added in v0.7.0
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 (*AOT[B, R]) BlockCount ¶ added in v0.7.0
func (*AOT[B, R]) Snapshot ¶ added in v0.7.0
func (aot *AOT[B, R]) Snapshot() AOTSnapshot[B, R]
func (*AOT[B, R]) Truncate ¶ added in v0.7.0
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
func (*BaseTreeVisitor) String ¶ added in v0.8.0
func (visitor *BaseTreeVisitor) String() string
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 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 TableRecord ¶
func NewTableTree ¶ added in v0.8.0
func NewTableTree(dbID, id uint64) *TableRecord
func (*TableRecord) ApproxSize ¶
func (ttree *TableRecord) ApproxSize() int64
func (*TableRecord) ReadFromWithVersion ¶
type TimedSliceBlock ¶ added in v0.7.0
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
type TransDelsForBlks ¶ added in v1.0.0
func NewTransDelsForBlks ¶ added in v1.0.0
func NewTransDelsForBlks() *TransDelsForBlks
func (*TransDelsForBlks) DeleteDelsForBlk ¶
func (t *TransDelsForBlks) DeleteDelsForBlk(blkid types.Blockid)
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
type TransferHashPage ¶ added in v0.6.0
func NewTransferHashPage ¶ added in v0.6.0
func NewTransferHashPage(id *common.ID, ts time.Time, isTransient bool, fs *fileservice.TmpFileService, ttl, diskTTL time.Duration, createdObjIDs []*objectio.ObjectId) *TransferHashPage
func (*TransferHashPage) BornTS ¶ added in v0.6.0
func (page *TransferHashPage) BornTS() time.Time
func (*TransferHashPage) Clear ¶
func (page *TransferHashPage) Clear()
func (*TransferHashPage) ClearPersistTable ¶
func (page *TransferHashPage) ClearPersistTable()
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) IsPersist ¶
func (page *TransferHashPage) IsPersist() bool
func (*TransferHashPage) Length ¶ added in v1.0.0
func (page *TransferHashPage) Length() int
func (*TransferHashPage) Marshal ¶
func (page *TransferHashPage) Marshal() *bytes.Buffer
Marshal serializes non-deleted entries into a pooled bytes.Buffer. The caller MUST pass the returned buffer to ReleaseMarshalBufs (or transferMarshalBufPool.Put) after buf.Bytes() is no longer referenced. Returns nil when there are no entries to serialize.
func (*TransferHashPage) Pin ¶ added in v0.6.0
func (page *TransferHashPage) Pin() *common.PinnedItem[*TransferHashPage]
func (*TransferHashPage) SetBornTS ¶
func (page *TransferHashPage) SetBornTS(ts time.Time)
func (*TransferHashPage) SetPath ¶
func (page *TransferHashPage) SetPath(path Path)
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() uint8
func (*TransferHashPage) Train ¶ added in v0.6.0
func (page *TransferHashPage) Train(m api.TransferMap)
func (*TransferHashPage) TrainDetached ¶
func (page *TransferHashPage) TrainDetached(m api.TransferMap)
TrainDetached clones the transfer map so the page owns stable memory even if the source map was backed by a pooled slab that may be recycled later.
func (*TransferHashPage) Transfer ¶ added in v0.6.0
func (page *TransferHashPage) Transfer(from uint32) (dest types.Rowid, ok bool)
func (*TransferHashPage) Unmarshal ¶
func (page *TransferHashPage) Unmarshal(data []byte) (*api.TransferMap, error)
type TransferTable ¶ added in v0.6.0
func NewTransferTable ¶ added in v0.6.0
func NewTransferTable[T PageT[T]](ctx context.Context, fs fileservice.FileService) (*TransferTable[T], error)
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()
type Tree ¶ added in v0.8.0
type Tree struct {
Tables map[uint64]*TableRecord
}
func (*Tree) ApproxSize ¶
func (*Tree) GetTable ¶ added in v0.8.0
func (tree *Tree) GetTable(id uint64) *TableRecord
func (*Tree) ReadFromWithVersion ¶ added in v1.1.0
func (*Tree) TableCount ¶ added in v0.8.0
func (*Tree) Visit ¶ added in v0.8.0
func (tree *Tree) Visit(visitor TreeVisitor) (err error)