Documentation ¶
Index ¶
- Constants
- func DecodeTiDBType(ty byte, flag model.ColumnFlagType, bits []byte) (interface{}, error)
- func EncodeTiDBType(allocator *SliceAllocator, ty byte, flag model.ColumnFlagType, ...) []byte
- func NewBatchDecoderWithAllocator(allocator *SliceAllocator) codec.RowEventDecoder
- func NewBatchEncoder(config *common.Config) codec.RowEventEncoder
- func NewBatchEncoderBuilder(config *common.Config) codec.RowEventEncoderBuilder
- func NewBatchEncoderWithAllocator(allocator *SliceAllocator, config *common.Config) codec.RowEventEncoder
- type BatchEncoder
- func (e *BatchEncoder) AppendRowChangedEvent(_ context.Context, _ string, ev *model.RowChangedEvent, callback func()) error
- func (e *BatchEncoder) Build() []*common.Message
- func (e *BatchEncoder) EncodeCheckpointEvent(ts uint64) (*common.Message, error)
- func (e *BatchEncoder) EncodeDDLEvent(ev *model.DDLEvent) (*common.Message, error)
- type Headers
- type MessageDecoder
- type MessageEncoder
- type RowChangedEventBuffer
- func (b *RowChangedEventBuffer) AppendRowChangedEvent(ev *model.RowChangedEvent, onlyHandleKeyColumns bool) (rows, size int)
- func (b *RowChangedEventBuffer) Encode() []byte
- func (b *RowChangedEventBuffer) GetHeaders() *Headers
- func (b *RowChangedEventBuffer) Reset()
- func (b *RowChangedEventBuffer) RowsCount() int
- func (b *RowChangedEventBuffer) Size() int
- type SliceAllocator
Constants ¶
const ( // Version1 represents the version of craft format Version1 uint64 = 1 // DefaultBufferCapacity is default buffer size DefaultBufferCapacity = 1024 )
Variables ¶
This section is empty.
Functions ¶
func DecodeTiDBType ¶
func DecodeTiDBType(ty byte, flag model.ColumnFlagType, bits []byte) (interface{}, error)
DecodeTiDBType decodes TiDB types.
func EncodeTiDBType ¶
func EncodeTiDBType(allocator *SliceAllocator, ty byte, flag model.ColumnFlagType, value interface{}) []byte
EncodeTiDBType encodes TiDB types
func NewBatchDecoderWithAllocator ¶
func NewBatchDecoderWithAllocator( allocator *SliceAllocator, ) codec.RowEventDecoder
NewBatchDecoderWithAllocator creates a new batchDecoder with given allocator.
func NewBatchEncoder ¶
func NewBatchEncoder(config *common.Config) codec.RowEventEncoder
NewBatchEncoder creates a new BatchEncoder.
func NewBatchEncoderBuilder ¶
func NewBatchEncoderBuilder(config *common.Config) codec.RowEventEncoderBuilder
NewBatchEncoderBuilder creates a craft batchEncoderBuilder.
func NewBatchEncoderWithAllocator ¶
func NewBatchEncoderWithAllocator(allocator *SliceAllocator, config *common.Config) codec.RowEventEncoder
NewBatchEncoderWithAllocator creates a new BatchEncoder with given allocator.
Types ¶
type BatchEncoder ¶
type BatchEncoder struct {
// contains filtered or unexported fields
}
BatchEncoder encodes the events into the byte of a batch into craft binary format.
func (*BatchEncoder) AppendRowChangedEvent ¶
func (e *BatchEncoder) AppendRowChangedEvent( _ context.Context, _ string, ev *model.RowChangedEvent, callback func(), ) error
AppendRowChangedEvent implements the RowEventEncoder interface
func (*BatchEncoder) Build ¶
func (e *BatchEncoder) Build() []*common.Message
Build implements the RowEventEncoder interface
func (*BatchEncoder) EncodeCheckpointEvent ¶
func (e *BatchEncoder) EncodeCheckpointEvent(ts uint64) (*common.Message, error)
EncodeCheckpointEvent implements the RowEventEncoder interface
func (*BatchEncoder) EncodeDDLEvent ¶
EncodeDDLEvent implements the RowEventEncoder interface
type Headers ¶
type Headers struct {
// contains filtered or unexported fields
}
Headers in columnar layout
func (*Headers) GetPartition ¶
GetPartition returns partition of event at given index
type MessageDecoder ¶
type MessageDecoder struct {
// contains filtered or unexported fields
}
MessageDecoder decoder
func NewMessageDecoder ¶
func NewMessageDecoder(bits []byte, allocator *SliceAllocator) (*MessageDecoder, error)
NewMessageDecoder create a new message decode with bits and allocator
func (*MessageDecoder) DDLEvent ¶
func (d *MessageDecoder) DDLEvent(index int) (pmodel.ActionType, string, error)
DDLEvent decode a DDL event
func (*MessageDecoder) Headers ¶
func (d *MessageDecoder) Headers() (*Headers, error)
Headers decode headers of message
func (*MessageDecoder) RowChangedEvent ¶
func (d *MessageDecoder) RowChangedEvent(index int) (preColumns, columns *columnGroup, err error)
RowChangedEvent decode a row changeded event
type MessageEncoder ¶
type MessageEncoder struct {
// contains filtered or unexported fields
}
MessageEncoder is encoder for message
func NewDDLEventEncoder ¶
func NewDDLEventEncoder(allocator *SliceAllocator, ev *model.DDLEvent) *MessageEncoder
NewDDLEventEncoder creates a new encoder with given allocator and timestamp
func NewMessageEncoder ¶
func NewMessageEncoder(allocator *SliceAllocator) *MessageEncoder
NewMessageEncoder creates a new encoder with given allocator
func NewResolvedEventEncoder ¶
func NewResolvedEventEncoder(allocator *SliceAllocator, ts uint64) *MessageEncoder
NewResolvedEventEncoder creates a new encoder with given allocator and timestamp
type RowChangedEventBuffer ¶
type RowChangedEventBuffer struct {
// contains filtered or unexported fields
}
RowChangedEventBuffer is a buffer to save row changed events in batch
func NewRowChangedEventBuffer ¶
func NewRowChangedEventBuffer(allocator *SliceAllocator) *RowChangedEventBuffer
NewRowChangedEventBuffer creates new row changed event buffer with given allocator
func (*RowChangedEventBuffer) AppendRowChangedEvent ¶
func (b *RowChangedEventBuffer) AppendRowChangedEvent(ev *model.RowChangedEvent, onlyHandleKeyColumns bool) (rows, size int)
AppendRowChangedEvent append a new event to buffer
func (*RowChangedEventBuffer) Encode ¶
func (b *RowChangedEventBuffer) Encode() []byte
Encode row changed event buffer into bits
func (*RowChangedEventBuffer) GetHeaders ¶
func (b *RowChangedEventBuffer) GetHeaders() *Headers
GetHeaders returns headers of buffer
func (*RowChangedEventBuffer) RowsCount ¶
func (b *RowChangedEventBuffer) RowsCount() int
RowsCount returns number of rows batched in this buffer.
type SliceAllocator ¶
type SliceAllocator struct {
// contains filtered or unexported fields
}
SliceAllocator for different slice types
func NewSliceAllocator ¶
func NewSliceAllocator(batchSize int) *SliceAllocator
NewSliceAllocator creates a new slice allocator with given batch allocation size.