Documentation ¶
Index ¶
- Constants
- type Column
- type ColumnFlagType
- type EventPuller
- type ItemType
- type JSONEventBatchMixedDecoder
- type MessageDDL
- type MessageRow
- type SortItem
- type TableBuffer
- func (t *TableBuffer) Append(item *SortItem) error
- func (t *TableBuffer) Clear()
- func (t *TableBuffer) IsEmpty() bool
- func (t *TableBuffer) ReloadMeta(tbl table.Table, allocator autoid.Allocators)
- func (t *TableBuffer) ResetTableInfo()
- func (t *TableBuffer) ShouldApply() bool
- func (t *TableBuffer) TableID() int64
- func (t *TableBuffer) TableInfo() table.Table
Constants ¶
const ( // BatchVersion1 represents the version of batch format. BatchVersion1 uint64 = 1 )
TODO let cdc import these flags.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Column ¶
type Column struct { Type byte `json:"t"` // WhereHandle is deprecated // WhereHandle is replaced by HandleKey in Flag. WhereHandle *bool `json:"h,omitempty"` Flag ColumnFlagType `json:"f"` Value interface{} `json:"v"` }
Column represents the column data define by cdc.
type ColumnFlagType ¶
type ColumnFlagType uint64
ColumnFlagType represents the type of Column.
const ( // BinaryFlag means the Column charset is binary. BinaryFlag ColumnFlagType = 1 << ColumnFlagType(iota) // HandleKeyFlag means the Column is selected as the handle key. HandleKeyFlag // GeneratedColumnFlag means the Column is a generated Column. GeneratedColumnFlag // PrimaryKeyFlag means the Column is primary key. PrimaryKeyFlag // UniqueKeyFlag means the Column is unique key. UniqueKeyFlag // MultipleKeyFlag means the Column is multiple key. MultipleKeyFlag // NullableFlag means the Column is nullable. NullableFlag )
type EventPuller ¶
type EventPuller struct {
// contains filtered or unexported fields
}
EventPuller pulls next event in ts order.
func NewEventPuller ¶
func NewEventPuller( ctx context.Context, schema string, table string, ddlFiles []string, rowChangedFiles []string, storage storage.ExternalStorage) (*EventPuller, error)
NewEventPuller create eventPuller by given log files, we assume files come in ts order.
func (*EventPuller) PullOneEvent ¶
func (e *EventPuller) PullOneEvent(ctx context.Context) (*SortItem, error)
PullOneEvent pulls one event in ts order. The Next event which can be DDL item or Row changed Item depends on next commit ts.
type JSONEventBatchMixedDecoder ¶
type JSONEventBatchMixedDecoder struct {
// contains filtered or unexported fields
}
JSONEventBatchMixedDecoder decodes the byte of a batch into the original messages.
func NewJSONEventBatchDecoder ¶
func NewJSONEventBatchDecoder(data []byte) (*JSONEventBatchMixedDecoder, error)
NewJSONEventBatchDecoder creates a new JSONEventBatchDecoder.
func (*JSONEventBatchMixedDecoder) HasNext ¶
func (b *JSONEventBatchMixedDecoder) HasNext() bool
HasNext represents whether it has next kv to decode.
type MessageDDL ¶
type MessageDDL struct { Query string `json:"q"` Type timodel.ActionType `json:"t"` }
MessageDDL represents the ddl changes.
type MessageRow ¶
type MessageRow struct { Update map[string]Column `json:"u,omitempty"` PreColumns map[string]Column `json:"p,omitempty"` Delete map[string]Column `json:"d,omitempty"` }
MessageRow represents the row changes in same commit ts.
type SortItem ¶
type SortItem struct { ItemType ItemType Data interface{} Schema string Table string RowID int64 TS uint64 }
SortItem represents a DDL item or Row changed item.
type TableBuffer ¶
type TableBuffer struct { KvPairs []kv.Row KvEncoder kv.Encoder // contains filtered or unexported fields }
TableBuffer represents the kv buffer of this table. we restore one tableBuffer in one goroutine. this is the concurrent unit of log restore.
func NewTableBuffer ¶
func NewTableBuffer(tbl table.Table, allocators autoid.Allocators, flushKVPairs int, flushKVSize int64) *TableBuffer
NewTableBuffer creates TableBuffer.
func (*TableBuffer) Append ¶
func (t *TableBuffer) Append(item *SortItem) error
Append appends the item to this buffer.
func (*TableBuffer) ReloadMeta ¶
func (t *TableBuffer) ReloadMeta(tbl table.Table, allocator autoid.Allocators)
ReloadMeta reload columns after 1. table buffer created. 2. every ddl executed.
func (*TableBuffer) ResetTableInfo ¶
func (t *TableBuffer) ResetTableInfo()
ResetTableInfo set tableInfo to nil for next reload.
func (*TableBuffer) ShouldApply ¶
func (t *TableBuffer) ShouldApply() bool
ShouldApply tells whether we should flush memory kv buffer to storage.
func (*TableBuffer) TableID ¶
func (t *TableBuffer) TableID() int64
TableID returns the table id of this buffer.
func (*TableBuffer) TableInfo ¶
func (t *TableBuffer) TableInfo() table.Table
TableInfo returns the table info of this buffer.