Documentation ¶
Index ¶
- type Snapshot
- func (s *Snapshot) Copy() *Snapshot
- func (s *Snapshot) CurrentTs() uint64
- func (s *Snapshot) DoHandleDDL(job *timodel.Job) error
- func (s *Snapshot) Drop()
- func (s *Snapshot) DumpToString() string
- func (s *Snapshot) FillSchemaName(job *timodel.Job) error
- func (s *Snapshot) HandleDDL(job *timodel.Job) error
- func (s *Snapshot) IsIneligibleTableID(id int64) bool
- func (s *Snapshot) IsTruncateTableID(id int64) bool
- func (s *Snapshot) IterPartitions(includeIneligible bool, f func(id int64, i *model.TableInfo))
- func (s *Snapshot) IterSchemaNames(f func(schema string, target int64))
- func (s *Snapshot) IterSchemas(f func(i *timodel.DBInfo))
- func (s *Snapshot) IterTableNames(f func(schema int64, table string, target int64))
- func (s *Snapshot) IterTables(includeIneligible bool, f func(i *model.TableInfo))
- func (s *Snapshot) PhysicalTableByID(id int64) (*model.TableInfo, bool)
- func (s *Snapshot) PreTableInfo(job *timodel.Job) (*model.TableInfo, error)
- func (s *Snapshot) PrintStatus(logger func(msg string, fields ...zap.Field))
- func (s *Snapshot) SchemaByID(id int64) (*timodel.DBInfo, bool)
- func (s *Snapshot) SchemaByTableID(tableID int64) (*timodel.DBInfo, bool)
- func (s *Snapshot) SchemaCount() (count int)
- func (s *Snapshot) SchemaIDByName(schema string) (int64, bool)
- func (s *Snapshot) TableByName(schema, table string) (*model.TableInfo, bool)
- func (s *Snapshot) TableCount(includeIneligible bool, filter func(schema, table string) bool) (count int)
- func (s *Snapshot) TableIDByName(schema string, table string) (int64, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot stores the source TiDB all schema information. If no special comments, all public methods are thread-safe.
func NewEmptySnapshot ¶
NewEmptySnapshot creates an empty schema snapshot.
func NewSnapshotFromMeta ¶
func NewSnapshotFromMeta( id model.ChangeFeedID, meta timeta.Reader, currentTs uint64, forceReplicate bool, filter filter.Filter, ) (*Snapshot, error)
NewSnapshotFromMeta creates a schema snapshot from meta.
func (*Snapshot) Copy ¶
Copy creates a new schema snapshot based on the given one. The copied one shares same internal data structures with the old one to save memory usage.
func (*Snapshot) DoHandleDDL ¶
DoHandleDDL is like HandleDDL but doesn't fill schema name into job. NOTE: it's public because some tests in the upper package need this.
func (*Snapshot) Drop ¶
func (s *Snapshot) Drop()
Drop drops the snapshot. It must be called when GC some snapshots. Drop a snapshot will also drop all snapshots with a less timestamp.
func (*Snapshot) DumpToString ¶
DumpToString dumps the snapshot to a string.
func (*Snapshot) FillSchemaName ¶
FillSchemaName fills the schema name in ddl job.
func (*Snapshot) IsIneligibleTableID ¶
IsIneligibleTableID returns true if the table is ineligible.
func (*Snapshot) IsTruncateTableID ¶
IsTruncateTableID returns true if the table id have been truncated by truncate table DDL.
func (*Snapshot) IterPartitions ¶
IterPartitions iterates all partitions in the snapshot.
func (*Snapshot) IterSchemaNames ¶
IterSchemaNames iterates all schema names in the snapshot.
func (*Snapshot) IterSchemas ¶
IterSchemas iterates all schemas in the snapshot.
func (*Snapshot) IterTableNames ¶
IterTableNames iterates all table names in the snapshot.
func (*Snapshot) IterTables ¶
IterTables iterates all tables in the snapshot.
func (*Snapshot) PhysicalTableByID ¶
PhysicalTableByID returns the TableInfo by table id or partition id. The second returned value is false if no table with the specified id is found. NOTE: The returned table info should always be READ-ONLY!
func (*Snapshot) PreTableInfo ¶
PreTableInfo returns the table info which will be overwritten by the specified job
func (*Snapshot) PrintStatus ¶
PrintStatus prints the schema snapshot.
func (*Snapshot) SchemaByID ¶
SchemaByID returns the DBInfo by schema id. The second returned value is false if no schema with the specified id is found. NOTE: The returned table info should always be READ-ONLY!
func (*Snapshot) SchemaByTableID ¶
SchemaByTableID returns the schema ID by table ID.
func (*Snapshot) SchemaCount ¶
SchemaCount counts schemas in the snapshot. It's only for tests.
func (*Snapshot) SchemaIDByName ¶
SchemaIDByName gets the schema id from the given schema name.
func (*Snapshot) TableByName ¶
TableByName queries a table by name, The second returned value is false if no table with the specified name is found. NOTE: The returned table info should always be READ-ONLY!