ckputil

package
v0.0.0-debug-20260702 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableObjectsAttr_Accout     = "account_id"
	TableObjectsAttr_DB         = "db_id"
	TableObjectsAttr_Table      = "table_id"
	TableObjectsAttr_ObjectType = "object_type"
	TableObjectsAttr_ID         = "id"
	TableObjectsAttr_CreateTS   = "create_ts"
	TableObjectsAttr_DeleteTS   = "delete_ts"

	// TableObjects should be clustered by `table`+`object_type`+`id` + `is_deleted`
	TableObjectsAttr_Cluster = "cluster"
)
View Source
const (
	TableObjectsAttr_Accout_Idx     = ioutil.TableObjectsAttr_Accout_Idx
	TableObjectsAttr_DB_Idx         = ioutil.TableObjectsAttr_DB_Idx
	TableObjectsAttr_Table_Idx      = ioutil.TableObjectsAttr_Table_Idx
	TableObjectsAttr_ObjectType_Idx = ioutil.TableObjectsAttr_ObjectType_Idx
	TableObjectsAttr_ID_Idx         = ioutil.TableObjectsAttr_ID_Idx
	TableObjectsAttr_CreateTS_Idx   = ioutil.TableObjectsAttr_CreateTS_Idx
	TableObjectsAttr_DeleteTS_Idx   = ioutil.TableObjectsAttr_DeleteTS_Idx
	TableObjectsAttr_Cluster_Idx    = ioutil.TableObjectsAttr_Cluster_Idx

	TableObjectsAttr_PhysicalAddr_Idx = 8
)
View Source
const (
	ObjectType_Invalid   = ioutil.ObjectType_Invalid
	ObjectType_Data      = ioutil.ObjectType_Data
	ObjectType_Tombstone = ioutil.ObjectType_Tombstone
)
View Source
const (
	MetaAttr_Table       = "table_id"
	MetaAttr_ObjectType  = "object_type"
	MetaAttr_Start       = "start_rowid"
	MetaAttr_End         = "end_rowid"
	MetaAttr_ObjectStats = "objectStats"
)
View Source
const (
	MetaAttr_Table_Idx       = 0
	MetaAttr_ObjectType_Idx  = 1
	MetaAttr_Start_Idx       = 2
	MetaAttr_End_Idx         = 3
	MetaAttr_ObjectStats_Idx = 4
)

Variables

used to scan data with columns: [table object attrs, `phy_addr`]

View Source
var DataScan_TableIDSeqnums = append(TableObjectsSeqnums, objectio.SEQNUM_ROWID)
View Source
var DataScan_TableIDTypes = append(TableObjectsTypes, objectio.RowidType)
View Source
var DataSinkerFactory ioutil.FileSinkerFactory
View Source
var MetaSchema_TableRange_Attrs = MetaAttrs
View Source
var MetaSchema_TableRange_Seqnums = MetaSeqnums

MetaSchema ['table_id', 'object_type', 'start_row', 'end_row', 'location'] [uint64, int8, row id, row id, string] `table_id` is the id of the table `object_type` is the type of the object [Data|Tombstone] `start_row` is the start rowid of the table in the object `end_row` is the end rowid of the table in the object (same object as `start_row`) `location` is the location of the object

View Source
var MetaSchema_TableRange_Types = MetaTypes
View Source
var MetaSeqnums = []uint16{0, 1, 2, 3, 4}
View Source
var MetaSinkerFactory ioutil.FileSinkerFactory
View Source
var MetaTypes = []types.Type{
	types.T_uint64.ToType(),
	types.T_int8.ToType(),
	types.T_Rowid.ToType(),
	types.T_Rowid.ToType(),
	types.T_char.ToType(),
}
View Source
var TableObjectsSeqnums = []uint16{0, 1, 2, 3, 4, 5, 6, 7}
View Source
var TableObjectsTypes = []types.Type{
	types.T_uint32.ToType(),
	types.T_uint64.ToType(),
	types.T_uint64.ToType(),
	types.T_int8.ToType(),
	types.T_char.ToType(),
	types.T_TS.ToType(),
	types.T_TS.ToType(),
	types.T_char.ToType(),
}

Functions

func CollectTableRanges

func CollectTableRanges(
	ctx context.Context,
	objs []objectio.ObjectStats,
	data *batch.Batch,
	mp *mpool.MPool,
	fs fileservice.FileService,
) (err error)

func CollectTableRangesFromFile

func CollectTableRangesFromFile(
	ctx context.Context,
	obj objectio.ObjectStats,
	data *batch.Batch,
	mp *mpool.MPool,
	fs fileservice.FileService,
) (err error)

the data in the obj must be sorted by the table id and object type

func EncodeCluser

func EncodeCluser(
	packer *types.Packer,
	tableId uint64,
	objectType int8,
	obj *objectio.ObjectId,
	isDeleted bool,
)

func ForEachFile

func ForEachFile(
	ctx context.Context,
	obj objectio.ObjectStats,
	forEachRow func(
		accout uint32,
		dbid, tid uint64,
		objectType int8,
		objectStats objectio.ObjectStats,
		start, end types.TS,
		rowID types.Rowid,
	) error,
	postEachRow func() error,
	mp *mpool.MPool,
	fs fileservice.FileService,
) (err error)

func GetMaxTSOfCompactCKP

func GetMaxTSOfCompactCKP(
	ctx context.Context,
	fs fileservice.FileService,
) (ts types.TS, err error)

GetMaxTSOfCompactCKP returns the max ts of the compact checkpoint

func ListCKPMetaFiles

func ListCKPMetaFiles(
	ctx context.Context,
	fs fileservice.FileService,
) (files []ioutil.TSRangeFile, err error)

ListCKPMetaFiles returns all checkpoint meta files

func ListCKPMetaNames

func ListCKPMetaNames(
	ctx context.Context,
	fs fileservice.FileService,
) (files []string, err error)

ListCKPMetaNames returns the names of all checkpoint meta files

func MakeDataScanTableEntryBatch

func MakeDataScanTableEntryBatch() *batch.Batch

func MakeDataScanTableIDBatch

func MakeDataScanTableIDBatch() *batch.Batch

func MakeTableRangeBatch

func MakeTableRangeBatch() *batch.Batch

func NewDataSinker

func NewDataSinker(
	mp *mpool.MPool,
	fs fileservice.FileService,
	opts ...ioutil.SinkerOption,
) *ioutil.Sinker

func NewMetaBatch

func NewMetaBatch() *batch.Batch

func NewMetaSinker

func NewMetaSinker(
	mp *mpool.MPool,
	fs fileservice.FileService,
	opts ...ioutil.SinkerOption,
) *ioutil.Sinker

func NewObjectListBatch

func NewObjectListBatch() *batch.Batch

func ScanObjectStats

func ScanObjectStats(
	data *batch.Batch,
) (objs []objectio.ObjectStats)

func TableRangesRows

func TableRangesRows(r []TableRange) int

func TableRangesString

func TableRangesString(r []TableRange) string

Types

type ObjectIter

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

func NewObjectIter

func NewObjectIter(
	ctx context.Context,
	ranges []TableRange,
	mp *mpool.MPool,
	fs fileservice.FileService,
) (iter ObjectIter)

func (*ObjectIter) Close

func (iter *ObjectIter) Close()

func (*ObjectIter) Entry

func (iter *ObjectIter) Entry() (ret objectio.ObjectEntry)

func (*ObjectIter) Next

func (iter *ObjectIter) Next() (bool, error)

func (*ObjectIter) Reset

func (iter *ObjectIter) Reset()

type TableRange

type TableRange struct {
	TableID     uint64
	ObjectType  int8
	Start       types.Rowid
	End         types.Rowid
	ObjectStats objectio.ObjectStats
}

func ExportToTableRanges

func ExportToTableRanges(
	data *batch.Batch,
) (ranges []TableRange)

func ExportToTableRangesByFilter

func ExportToTableRangesByFilter(
	data *batch.Batch,
	tableId uint64,
	objectType int8,
) (ranges []TableRange)

data should be sorted by table id and object type the schema of the table entry

func (*TableRange) AppendTo

func (r *TableRange) AppendTo(bat *batch.Batch, mp *mpool.MPool) (err error)

the schema of the table entry 0: table id 1: object type 2: start rowid 3: end rowid 4: location

func (*TableRange) IsEmpty

func (r *TableRange) IsEmpty() bool

func (*TableRange) MarshalJSON

func (r *TableRange) MarshalJSON() ([]byte, error)

func (*TableRange) Rows

func (r *TableRange) Rows() int

func (*TableRange) String

func (r *TableRange) String() string

Jump to

Keyboard shortcuts

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