Documentation ¶
Overview ¶
Package binlog is a generated protocol buffer package.
It is generated from these files:
binlog.proto
It has these top-level messages:
TableMutation PrewriteValue Binlog
Package binlog is a generated protocol buffer package.
It is generated from these files:
cistern.proto
It has these top-level messages:
DumpBinlogReq DumpBinlogResp
Package binlog is a generated protocol buffer package.
It is generated from these files:
pump.proto
It has these top-level messages:
WriteBinlogReq WriteBinlogResp PullBinlogReq PullBinlogResp Pos Entity
Index ¶
- Variables
- func RegisterCisternServer(s *grpc.Server, srv CisternServer)
- func RegisterPumpServer(s *grpc.Server, srv PumpServer)
- type Binlog
- func (*Binlog) Descriptor() ([]byte, []int)
- func (m *Binlog) GetCommitTs() int64
- func (m *Binlog) GetDdlJobId() int64
- func (m *Binlog) GetDdlQuery() []byte
- func (m *Binlog) GetPrewriteKey() []byte
- func (m *Binlog) GetPrewriteValue() []byte
- func (m *Binlog) GetStartTs() int64
- func (m *Binlog) GetTp() BinlogType
- func (m *Binlog) Marshal() (data []byte, err error)
- func (m *Binlog) MarshalTo(data []byte) (int, error)
- func (*Binlog) ProtoMessage()
- func (m *Binlog) Reset()
- func (m *Binlog) Size() (n int)
- func (m *Binlog) String() string
- func (m *Binlog) Unmarshal(data []byte) error
- type BinlogType
- type CisternClient
- type CisternServer
- type DumpBinlogReq
- func (*DumpBinlogReq) Descriptor() ([]byte, []int)
- func (m *DumpBinlogReq) Marshal() (data []byte, err error)
- func (m *DumpBinlogReq) MarshalTo(data []byte) (int, error)
- func (*DumpBinlogReq) ProtoMessage()
- func (m *DumpBinlogReq) Reset()
- func (m *DumpBinlogReq) Size() (n int)
- func (m *DumpBinlogReq) String() string
- func (m *DumpBinlogReq) Unmarshal(data []byte) error
- type DumpBinlogResp
- func (*DumpBinlogResp) Descriptor() ([]byte, []int)
- func (m *DumpBinlogResp) Marshal() (data []byte, err error)
- func (m *DumpBinlogResp) MarshalTo(data []byte) (int, error)
- func (*DumpBinlogResp) ProtoMessage()
- func (m *DumpBinlogResp) Reset()
- func (m *DumpBinlogResp) Size() (n int)
- func (m *DumpBinlogResp) String() string
- func (m *DumpBinlogResp) Unmarshal(data []byte) error
- type Entity
- func (*Entity) Descriptor() ([]byte, []int)
- func (m *Entity) GetPos() Pos
- func (m *Entity) Marshal() (data []byte, err error)
- func (m *Entity) MarshalTo(data []byte) (int, error)
- func (*Entity) ProtoMessage()
- func (m *Entity) Reset()
- func (m *Entity) Size() (n int)
- func (m *Entity) String() string
- func (m *Entity) Unmarshal(data []byte) error
- type Pos
- type PrewriteValue
- func (*PrewriteValue) Descriptor() ([]byte, []int)
- func (m *PrewriteValue) GetMutations() []TableMutation
- func (m *PrewriteValue) GetSchemaVersion() int64
- func (m *PrewriteValue) Marshal() (data []byte, err error)
- func (m *PrewriteValue) MarshalTo(data []byte) (int, error)
- func (*PrewriteValue) ProtoMessage()
- func (m *PrewriteValue) Reset()
- func (m *PrewriteValue) Size() (n int)
- func (m *PrewriteValue) String() string
- func (m *PrewriteValue) Unmarshal(data []byte) error
- type PullBinlogReq
- func (*PullBinlogReq) Descriptor() ([]byte, []int)
- func (m *PullBinlogReq) GetStartFrom() Pos
- func (m *PullBinlogReq) Marshal() (data []byte, err error)
- func (m *PullBinlogReq) MarshalTo(data []byte) (int, error)
- func (*PullBinlogReq) ProtoMessage()
- func (m *PullBinlogReq) Reset()
- func (m *PullBinlogReq) Size() (n int)
- func (m *PullBinlogReq) String() string
- func (m *PullBinlogReq) Unmarshal(data []byte) error
- type PullBinlogResp
- func (*PullBinlogResp) Descriptor() ([]byte, []int)
- func (m *PullBinlogResp) GetEntities() []Entity
- func (m *PullBinlogResp) Marshal() (data []byte, err error)
- func (m *PullBinlogResp) MarshalTo(data []byte) (int, error)
- func (*PullBinlogResp) ProtoMessage()
- func (m *PullBinlogResp) Reset()
- func (m *PullBinlogResp) Size() (n int)
- func (m *PullBinlogResp) String() string
- func (m *PullBinlogResp) Unmarshal(data []byte) error
- type PumpClient
- type PumpServer
- type TableMutation
- func (*TableMutation) Descriptor() ([]byte, []int)
- func (m *TableMutation) GetDeletedIds() []int64
- func (m *TableMutation) GetDeletedPks() [][]byte
- func (m *TableMutation) GetDeletedRows() [][]byte
- func (m *TableMutation) GetInsertedRows() [][]byte
- func (m *TableMutation) GetTableId() int64
- func (m *TableMutation) GetUpdatedRows() [][]byte
- func (m *TableMutation) Marshal() (data []byte, err error)
- func (m *TableMutation) MarshalTo(data []byte) (int, error)
- func (*TableMutation) ProtoMessage()
- func (m *TableMutation) Reset()
- func (m *TableMutation) Size() (n int)
- func (m *TableMutation) String() string
- func (m *TableMutation) Unmarshal(data []byte) error
- type WriteBinlogReq
- func (*WriteBinlogReq) Descriptor() ([]byte, []int)
- func (m *WriteBinlogReq) Marshal() (data []byte, err error)
- func (m *WriteBinlogReq) MarshalTo(data []byte) (int, error)
- func (*WriteBinlogReq) ProtoMessage()
- func (m *WriteBinlogReq) Reset()
- func (m *WriteBinlogReq) Size() (n int)
- func (m *WriteBinlogReq) String() string
- func (m *WriteBinlogReq) Unmarshal(data []byte) error
- type WriteBinlogResp
- func (*WriteBinlogResp) Descriptor() ([]byte, []int)
- func (m *WriteBinlogResp) Marshal() (data []byte, err error)
- func (m *WriteBinlogResp) MarshalTo(data []byte) (int, error)
- func (*WriteBinlogResp) ProtoMessage()
- func (m *WriteBinlogResp) Reset()
- func (m *WriteBinlogResp) Size() (n int)
- func (m *WriteBinlogResp) String() string
- func (m *WriteBinlogResp) Unmarshal(data []byte) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidLengthBinlog = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowBinlog = fmt.Errorf("proto: integer overflow") )
View Source
var ( ErrInvalidLengthCistern = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowCistern = fmt.Errorf("proto: integer overflow") )
View Source
var ( ErrInvalidLengthPump = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowPump = fmt.Errorf("proto: integer overflow") )
View Source
var BinlogType_name = map[int32]string{
0: "Prewrite",
1: "Commit",
2: "Rollback",
3: "PreDDL",
4: "PostDDL",
}
View Source
var BinlogType_value = map[string]int32{
"Prewrite": 0,
"Commit": 1,
"Rollback": 2,
"PreDDL": 3,
"PostDDL": 4,
}
Functions ¶
func RegisterCisternServer ¶
func RegisterCisternServer(s *grpc.Server, srv CisternServer)
func RegisterPumpServer ¶
func RegisterPumpServer(s *grpc.Server, srv PumpServer)
Types ¶
type Binlog ¶
type Binlog struct { Tp BinlogType `protobuf:"varint,1,opt,name=tp,enum=binlog.BinlogType" json:"tp"` // start_ts is used in Prewrite, Commit and Rollback binlog Type. // It is used for pairing prewrite log to commit log or rollback log. StartTs int64 `protobuf:"varint,2,opt,name=start_ts,json=startTs" json:"start_ts"` // commit_ts is used only in binlog type Commit. CommitTs int64 `protobuf:"varint,3,opt,name=commit_ts,json=commitTs" json:"commit_ts"` // prewrite key is used only in Prewrite binlog type. // It is the primary key of the transaction, is used to check that the transaction is // commited or not if it failed to pair to commit log or rollback log within a time window. PrewriteKey []byte `protobuf:"bytes,4,opt,name=prewrite_key,json=prewriteKey" json:"prewrite_key,omitempty"` // prewrite_data is marshalled from PrewriteData type, // we do not need to unmarshal prewrite data before the binlog have been successfully paired. PrewriteValue []byte `protobuf:"bytes,5,opt,name=prewrite_value,json=prewriteValue" json:"prewrite_value,omitempty"` // ddl_query is the original ddl statement query, used for PreDDL type. DdlQuery []byte `protobuf:"bytes,6,opt,name=ddl_query,json=ddlQuery" json:"ddl_query,omitempty"` // ddl_job_id is used for PreDDL and PostDDL binlog type. // If PreDDL has matching PostDDL with the same job_id, we can execute the DDL right away, otherwise, // we can use the job_id to check if the ddl statement has been successfully added to DDL job list. DdlJobId int64 `protobuf:"varint,7,opt,name=ddl_job_id,json=ddlJobId" json:"ddl_job_id"` XXX_unrecognized []byte `json:"-"` }
Binlog contains all the changes in a transaction, which can be used to reconstruct SQL statement, then export to other systems.
func (*Binlog) Descriptor ¶
func (*Binlog) GetCommitTs ¶
func (*Binlog) GetDdlJobId ¶
func (*Binlog) GetDdlQuery ¶
func (*Binlog) GetPrewriteKey ¶
func (*Binlog) GetPrewriteValue ¶
func (*Binlog) GetStartTs ¶
func (*Binlog) GetTp ¶
func (m *Binlog) GetTp() BinlogType
func (*Binlog) ProtoMessage ¶
func (*Binlog) ProtoMessage()
type BinlogType ¶
type BinlogType int32
const ( BinlogType_Prewrite BinlogType = 0 BinlogType_Commit BinlogType = 1 BinlogType_Rollback BinlogType = 2 BinlogType_PreDDL BinlogType = 3 BinlogType_PostDDL BinlogType = 4 )
func (BinlogType) Enum ¶
func (x BinlogType) Enum() *BinlogType
func (BinlogType) EnumDescriptor ¶
func (BinlogType) EnumDescriptor() ([]byte, []int)
func (BinlogType) String ¶
func (x BinlogType) String() string
func (*BinlogType) UnmarshalJSON ¶
func (x *BinlogType) UnmarshalJSON(data []byte) error
type CisternClient ¶
type CisternClient interface { // DumpBinlog dumps a continuous binlogs from a given position in binlog-server. DumpBinlog(ctx context.Context, in *DumpBinlogReq, opts ...grpc.CallOption) (*DumpBinlogResp, error) }
func NewCisternClient ¶
func NewCisternClient(cc *grpc.ClientConn) CisternClient
type CisternServer ¶
type CisternServer interface { // DumpBinlog dumps a continuous binlogs from a given position in binlog-server. DumpBinlog(context.Context, *DumpBinlogReq) (*DumpBinlogResp, error) }
type DumpBinlogReq ¶
type DumpBinlogReq struct { // beginCommitTS speicifies the position from which begin to dump binlogs. // note that actually the result of dump starts from the one next to beginCommitTS // it should be zero in case of the first request. BeginCommitTS int64 `protobuf:"varint,1,opt,name=beginCommitTS,proto3" json:"beginCommitTS,omitempty"` // limit defines the maximum number of binlogs requested once call. Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` }
func (*DumpBinlogReq) Descriptor ¶
func (*DumpBinlogReq) Descriptor() ([]byte, []int)
func (*DumpBinlogReq) Marshal ¶
func (m *DumpBinlogReq) Marshal() (data []byte, err error)
func (*DumpBinlogReq) ProtoMessage ¶
func (*DumpBinlogReq) ProtoMessage()
func (*DumpBinlogReq) Reset ¶
func (m *DumpBinlogReq) Reset()
func (*DumpBinlogReq) Size ¶
func (m *DumpBinlogReq) Size() (n int)
func (*DumpBinlogReq) String ¶
func (m *DumpBinlogReq) String() string
func (*DumpBinlogReq) Unmarshal ¶
func (m *DumpBinlogReq) Unmarshal(data []byte) error
type DumpBinlogResp ¶
type DumpBinlogResp struct { // An empty errmsg means that the successful acquisition of binlogs. Errmsg string `protobuf:"bytes,1,opt,name=errmsg,proto3" json:"errmsg,omitempty"` // payloads is an array of binlog bytecodes returned. Payloads [][]byte `protobuf:"bytes,2,rep,name=payloads" json:"payloads,omitempty"` // endCommitTS is the commitTS of the last one in binlog payloads // client can use it as beginCommitTS of the next request of dump. EndCommitTS int64 `protobuf:"varint,3,opt,name=endCommitTS,proto3" json:"endCommitTS,omitempty"` }
func (*DumpBinlogResp) Descriptor ¶
func (*DumpBinlogResp) Descriptor() ([]byte, []int)
func (*DumpBinlogResp) Marshal ¶
func (m *DumpBinlogResp) Marshal() (data []byte, err error)
func (*DumpBinlogResp) ProtoMessage ¶
func (*DumpBinlogResp) ProtoMessage()
func (*DumpBinlogResp) Reset ¶
func (m *DumpBinlogResp) Reset()
func (*DumpBinlogResp) Size ¶
func (m *DumpBinlogResp) Size() (n int)
func (*DumpBinlogResp) String ¶
func (m *DumpBinlogResp) String() string
func (*DumpBinlogResp) Unmarshal ¶
func (m *DumpBinlogResp) Unmarshal(data []byte) error
type Entity ¶
type Entity struct { // The position of the binlog entity. Pos Pos `protobuf:"bytes,1,opt,name=pos" json:"pos"` // The payload of binlog entity. Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` }
func (*Entity) Descriptor ¶
func (*Entity) ProtoMessage ¶
func (*Entity) ProtoMessage()
type Pos ¶
type Pos struct { // The suffix of binlog file, like .000001 .000002 Suffix uint64 `protobuf:"varint,1,opt,name=suffix,proto3" json:"suffix,omitempty"` // The binlog offset in a file. Offset int64 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` }
Binlogs are stored in a number of sequential files in a directory. The Pos describes the position of a binlog.
func (*Pos) Descriptor ¶
func (*Pos) ProtoMessage ¶
func (*Pos) ProtoMessage()
type PrewriteValue ¶
type PrewriteValue struct { SchemaVersion int64 `protobuf:"varint,1,opt,name=schema_version,json=schemaVersion" json:"schema_version"` Mutations []TableMutation `protobuf:"bytes,2,rep,name=mutations" json:"mutations"` XXX_unrecognized []byte `json:"-"` }
func (*PrewriteValue) Descriptor ¶
func (*PrewriteValue) Descriptor() ([]byte, []int)
func (*PrewriteValue) GetMutations ¶
func (m *PrewriteValue) GetMutations() []TableMutation
func (*PrewriteValue) GetSchemaVersion ¶
func (m *PrewriteValue) GetSchemaVersion() int64
func (*PrewriteValue) Marshal ¶
func (m *PrewriteValue) Marshal() (data []byte, err error)
func (*PrewriteValue) ProtoMessage ¶
func (*PrewriteValue) ProtoMessage()
func (*PrewriteValue) Reset ¶
func (m *PrewriteValue) Reset()
func (*PrewriteValue) Size ¶
func (m *PrewriteValue) Size() (n int)
func (*PrewriteValue) String ¶
func (m *PrewriteValue) String() string
func (*PrewriteValue) Unmarshal ¶
func (m *PrewriteValue) Unmarshal(data []byte) error
type PullBinlogReq ¶
type PullBinlogReq struct { // Specifies which clusterID of binlog to pull. ClusterID uint64 `protobuf:"varint,1,opt,name=clusterID,proto3" json:"clusterID,omitempty"` // The position from which the binlog will be sent. StartFrom Pos `protobuf:"bytes,2,opt,name=startFrom" json:"startFrom"` // The max number of binlog in a batch to pull. Batch int32 `protobuf:"varint,3,opt,name=batch,proto3" json:"batch,omitempty"` }
func (*PullBinlogReq) Descriptor ¶
func (*PullBinlogReq) Descriptor() ([]byte, []int)
func (*PullBinlogReq) GetStartFrom ¶
func (m *PullBinlogReq) GetStartFrom() Pos
func (*PullBinlogReq) Marshal ¶
func (m *PullBinlogReq) Marshal() (data []byte, err error)
func (*PullBinlogReq) ProtoMessage ¶
func (*PullBinlogReq) ProtoMessage()
func (*PullBinlogReq) Reset ¶
func (m *PullBinlogReq) Reset()
func (*PullBinlogReq) Size ¶
func (m *PullBinlogReq) Size() (n int)
func (*PullBinlogReq) String ¶
func (m *PullBinlogReq) String() string
func (*PullBinlogReq) Unmarshal ¶
func (m *PullBinlogReq) Unmarshal(data []byte) error
type PullBinlogResp ¶
type PullBinlogResp struct { // An empty errmsg means that the successful acquisition of binlogs. Errmsg string `protobuf:"bytes,1,opt,name=errmsg,proto3" json:"errmsg,omitempty"` // The binlog entities pulled in a batch Entities []Entity `protobuf:"bytes,2,rep,name=entities" json:"entities"` }
func (*PullBinlogResp) Descriptor ¶
func (*PullBinlogResp) Descriptor() ([]byte, []int)
func (*PullBinlogResp) GetEntities ¶
func (m *PullBinlogResp) GetEntities() []Entity
func (*PullBinlogResp) Marshal ¶
func (m *PullBinlogResp) Marshal() (data []byte, err error)
func (*PullBinlogResp) ProtoMessage ¶
func (*PullBinlogResp) ProtoMessage()
func (*PullBinlogResp) Reset ¶
func (m *PullBinlogResp) Reset()
func (*PullBinlogResp) Size ¶
func (m *PullBinlogResp) Size() (n int)
func (*PullBinlogResp) String ¶
func (m *PullBinlogResp) String() string
func (*PullBinlogResp) Unmarshal ¶
func (m *PullBinlogResp) Unmarshal(data []byte) error
type PumpClient ¶
type PumpClient interface { // Writes a binlog to the local file on the pump machine. // A response with an empty errmsg is returned if the binlog is written successfully. WriteBinlog(ctx context.Context, in *WriteBinlogReq, opts ...grpc.CallOption) (*WriteBinlogResp, error) // Obtains a batch of binlog from a given location. PullBinlogs(ctx context.Context, in *PullBinlogReq, opts ...grpc.CallOption) (*PullBinlogResp, error) }
func NewPumpClient ¶
func NewPumpClient(cc *grpc.ClientConn) PumpClient
type PumpServer ¶
type PumpServer interface { // Writes a binlog to the local file on the pump machine. // A response with an empty errmsg is returned if the binlog is written successfully. WriteBinlog(context.Context, *WriteBinlogReq) (*WriteBinlogResp, error) // Obtains a batch of binlog from a given location. PullBinlogs(context.Context, *PullBinlogReq) (*PullBinlogResp, error) }
type TableMutation ¶
type TableMutation struct { TableId int64 `protobuf:"varint,1,opt,name=table_id,json=tableId" json:"table_id"` // For inserted rows and updated rows, we save all column values of the row. InsertedRows [][]byte `protobuf:"bytes,2,rep,name=inserted_rows,json=insertedRows" json:"inserted_rows,omitempty"` UpdatedRows [][]byte `protobuf:"bytes,3,rep,name=updated_rows,json=updatedRows" json:"updated_rows,omitempty"` // If the table PK is handle, we can only save the id of the deleted row. DeletedIds []int64 `protobuf:"varint,4,rep,name=deleted_ids,json=deletedIds" json:"deleted_ids,omitempty"` // If the table has PK but PK is not handle, we save the PK of the deleted row. DeletedPks [][]byte `protobuf:"bytes,5,rep,name=deleted_pks,json=deletedPks" json:"deleted_pks,omitempty"` // If the table doesn't have PK, we save the row value of the deleted row. DeletedRows [][]byte `protobuf:"bytes,6,rep,name=deleted_rows,json=deletedRows" json:"deleted_rows,omitempty"` XXX_unrecognized []byte `json:"-"` }
TableMutation contains mutations in a table.
func (*TableMutation) Descriptor ¶
func (*TableMutation) Descriptor() ([]byte, []int)
func (*TableMutation) GetDeletedIds ¶
func (m *TableMutation) GetDeletedIds() []int64
func (*TableMutation) GetDeletedPks ¶
func (m *TableMutation) GetDeletedPks() [][]byte
func (*TableMutation) GetDeletedRows ¶
func (m *TableMutation) GetDeletedRows() [][]byte
func (*TableMutation) GetInsertedRows ¶
func (m *TableMutation) GetInsertedRows() [][]byte
func (*TableMutation) GetTableId ¶
func (m *TableMutation) GetTableId() int64
func (*TableMutation) GetUpdatedRows ¶
func (m *TableMutation) GetUpdatedRows() [][]byte
func (*TableMutation) Marshal ¶
func (m *TableMutation) Marshal() (data []byte, err error)
func (*TableMutation) ProtoMessage ¶
func (*TableMutation) ProtoMessage()
func (*TableMutation) Reset ¶
func (m *TableMutation) Reset()
func (*TableMutation) Size ¶
func (m *TableMutation) Size() (n int)
func (*TableMutation) String ¶
func (m *TableMutation) String() string
func (*TableMutation) Unmarshal ¶
func (m *TableMutation) Unmarshal(data []byte) error
type WriteBinlogReq ¶
type WriteBinlogReq struct { // The identifier of tidb-cluster, which is given at tidb startup. // Must specify the clusterID for each binlog to write. ClusterID uint64 `protobuf:"varint,1,opt,name=clusterID,proto3" json:"clusterID,omitempty"` // Payload bytes can be decoded back to binlog struct by the protobuf. Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` }
func (*WriteBinlogReq) Descriptor ¶
func (*WriteBinlogReq) Descriptor() ([]byte, []int)
func (*WriteBinlogReq) Marshal ¶
func (m *WriteBinlogReq) Marshal() (data []byte, err error)
func (*WriteBinlogReq) ProtoMessage ¶
func (*WriteBinlogReq) ProtoMessage()
func (*WriteBinlogReq) Reset ¶
func (m *WriteBinlogReq) Reset()
func (*WriteBinlogReq) Size ¶
func (m *WriteBinlogReq) Size() (n int)
func (*WriteBinlogReq) String ¶
func (m *WriteBinlogReq) String() string
func (*WriteBinlogReq) Unmarshal ¶
func (m *WriteBinlogReq) Unmarshal(data []byte) error
type WriteBinlogResp ¶
type WriteBinlogResp struct { // An empty errmsg returned means a successful write. // Otherwise return the error description. Errmsg string `protobuf:"bytes,1,opt,name=errmsg,proto3" json:"errmsg,omitempty"` }
func (*WriteBinlogResp) Descriptor ¶
func (*WriteBinlogResp) Descriptor() ([]byte, []int)
func (*WriteBinlogResp) Marshal ¶
func (m *WriteBinlogResp) Marshal() (data []byte, err error)
func (*WriteBinlogResp) ProtoMessage ¶
func (*WriteBinlogResp) ProtoMessage()
func (*WriteBinlogResp) Reset ¶
func (m *WriteBinlogResp) Reset()
func (*WriteBinlogResp) Size ¶
func (m *WriteBinlogResp) Size() (n int)
func (*WriteBinlogResp) String ¶
func (m *WriteBinlogResp) String() string
func (*WriteBinlogResp) Unmarshal ¶
func (m *WriteBinlogResp) Unmarshal(data []byte) error
Click to show internal directories.
Click to hide internal directories.