cache

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: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MO_OFF           = 2
	MO_ROWID_IDX     = 0
	MO_TIMESTAMP_IDX = 1
)
View Source
const (
	GcBuffer = 128
)

Variables

This section is empty.

Functions

func InitTableItemWithColumns

func InitTableItemWithColumns(item *TableItem, cols Columns)

func ParseColumnsBatchAnd

func ParseColumnsBatchAnd(bat *batch.Batch, f func(map[TableItemKey]Columns))

func ParseDatabaseBatchAnd

func ParseDatabaseBatchAnd(bat *batch.Batch, f func(*DatabaseItem))

func ParseTablesBatchAnd

func ParseTablesBatchAnd(bat *batch.Batch, f func(*TableItem))

Types

type CatalogCache

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

catalog cache

func NewCatalog

func NewCatalog() *CatalogCache

func (*CatalogCache) CanServe added in v1.2.0

func (cc *CatalogCache) CanServe(ts types.TS) bool

func (*CatalogCache) Databases

func (cc *CatalogCache) Databases(accountId uint32, ts timestamp.Timestamp) []string

func (*CatalogCache) DeleteDatabase

func (cc *CatalogCache) DeleteDatabase(bat *batch.Batch)

func (*CatalogCache) DeleteTable

func (cc *CatalogCache) DeleteTable(bat *batch.Batch)

func (*CatalogCache) GC

func (*CatalogCache) GetDatabase

func (cc *CatalogCache) GetDatabase(db *DatabaseItem) bool

func (*CatalogCache) GetStartTS

func (cc *CatalogCache) GetStartTS() types.TS

func (*CatalogCache) GetTable

func (cc *CatalogCache) GetTable(tbl *TableItem) bool

func (*CatalogCache) GetTableById added in v0.8.0

func (cc *CatalogCache) GetTableById(aid uint32, databaseId, tblId uint64) *TableItem

GetTableById's complexicity is O(n), where n is the number of all items of the database.

func (*CatalogCache) GetTableByIdAndTime

func (cc *CatalogCache) GetTableByIdAndTime(accountID uint32, databaseId, tblId uint64, ts timestamp.Timestamp) *TableItem

GetTableByIdAndTime's complexicity is O(n), where n is the number of all tables in the database Note: if databaseId is 0, it means the database is not specified. will scan all tables under the account

func (*CatalogCache) GetTableByName added in v1.2.0

func (cc *CatalogCache) GetTableByName(aid uint32, databaseID uint64, tableName string) *TableItem

GetTableByName's complexicity is O(n), where n is the number of all items of the database.

func (*CatalogCache) HasNewerVersion

func (cc *CatalogCache) HasNewerVersion(qry *TableChangeQuery) bool

func (*CatalogCache) InsertColumns

func (cc *CatalogCache) InsertColumns(bat *batch.Batch)

func (*CatalogCache) InsertDatabase

func (cc *CatalogCache) InsertDatabase(bat *batch.Batch)

func (*CatalogCache) InsertTable

func (cc *CatalogCache) InsertTable(bat *batch.Batch)

func (*CatalogCache) Tables

func (cc *CatalogCache) Tables(accountId uint32, databaseId uint64,
	ts timestamp.Timestamp) ([]string, []uint64)

func (*CatalogCache) UpdateDuration added in v1.2.0

func (cc *CatalogCache) UpdateDuration(start types.TS, end types.TS)

func (*CatalogCache) UpdateStart added in v1.2.0

func (cc *CatalogCache) UpdateStart(ts types.TS)

type Columns

type Columns []catalog.Column

func (Columns) Len

func (cols Columns) Len() int

func (Columns) Less

func (cols Columns) Less(i, j int) bool

func (Columns) Swap

func (cols Columns) Swap(i, j int)

type DatabaseItem

type DatabaseItem struct {
	// database key
	AccountId uint32
	Name      string
	Ts        timestamp.Timestamp

	// database value
	Id        uint64
	Typ       string
	CreateSql string
	Rowid     types.Rowid
	CPKey     []byte
	// contains filtered or unexported fields
}

func (*DatabaseItem) String

func (item *DatabaseItem) String() string

type GCReport

type GCReport struct {
	TScanItem  int
	TStaleItem int
	TStaleCpk  int
	DScanItem  int
	DStaleItem int
	DStaleCpk  int
}

type TableChangeQuery

type TableChangeQuery struct {
	AccountId  uint32
	DatabaseId uint64
	Name       string
	Version    uint32
	TableId    uint64
	Ts         timestamp.Timestamp
}

type TableItem

type TableItem struct {
	// table key
	AccountId  uint32
	DatabaseId uint64
	Name       string
	Ts         timestamp.Timestamp

	// table value
	Id           uint64
	TableDef     *plan.TableDef
	Defs         []engine.TableDef
	Version      uint32
	DatabaseName string

	CPKey []byte

	// table def
	Kind           string
	ViewDef        string
	Constraint     []byte
	Comment        string
	Partitioned    int8
	Partition      string
	CreateSql      string
	CatalogVersion uint32
	ExtraInfo      *api.SchemaExtra

	// primary index
	PrimaryIdx    int
	PrimarySeqnum int
	// clusterBy key
	ClusterByIdx int

	LogicalId uint64
	// contains filtered or unexported fields
}

func (*TableItem) IsDeleted

func (item *TableItem) IsDeleted() bool

func (*TableItem) IsIndexTable

func (item *TableItem) IsIndexTable() bool

func (*TableItem) IsPartitionTable

func (item *TableItem) IsPartitionTable() bool

func (*TableItem) String

func (item *TableItem) String() string

type TableItemKey

type TableItemKey struct {
	AccountId  uint32
	DatabaseId uint64
	Name       string
	Id         uint64
	Ts         noSliceTs
}

Jump to

Keyboard shortcuts

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