import "github.com/pingcap/tipb/go-binlog"
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 DumpDDLJobsReq DumpDDLJobsResp NotifyReq NotifyResp
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 Meta Entity
binlog.pb.go cistern.pb.go pump.pb.go
var ( ErrInvalidLengthBinlog = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowBinlog = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthCistern = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowCistern = fmt.Errorf("proto: integer overflow") )
var ( ErrInvalidLengthPump = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowPump = fmt.Errorf("proto: integer overflow") )
var BinlogType_name = map[int32]string{ 0: "Prewrite", 1: "Commit", 2: "Rollback", 3: "PreDDL", 4: "PostDDL", }
var BinlogType_value = map[string]int32{ "Prewrite": 0, "Commit": 1, "Rollback": 2, "PreDDL": 3, "PostDDL": 4, }
var MutationType_name = map[int32]string{ 0: "Insert", 1: "Update", 2: "DeleteID", 3: "DeletePK", 4: "DeleteRow", }
var MutationType_value = map[string]int32{ "Insert": 0, "Update": 1, "DeleteID": 2, "DeletePK": 3, "DeleteRow": 4, }
func RegisterCisternServer(s *grpc.Server, srv CisternServer)
func RegisterPumpServer(s *grpc.Server, srv PumpServer)
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. DdlQuery []byte `protobuf:"bytes,6,opt,name=ddl_query,json=ddlQuery" json:"ddl_query,omitempty"` // ddl_job_id is used for DDL Binlog. // If ddl_job_id is setted, this is a DDL Binlog and ddl_query contains the DDL query, we can query the informations about this job from TiKV. DdlJobId int64 `protobuf:"varint,7,opt,name=ddl_job_id,json=ddlJobId" json:"ddl_job_id"` // ddl_schema_state is used for DDL Binlog. DdlSchemaState int32 `protobuf:"varint,8,opt,name=ddl_schema_state,json=ddlSchemaState" json:"ddl_schema_state"` 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 (m *Binlog) GetTp() BinlogType
const ( BinlogType_Prewrite BinlogType = 0 BinlogType_Commit BinlogType = 1 BinlogType_Rollback BinlogType = 2 BinlogType_PreDDL BinlogType = 3 BinlogType_PostDDL BinlogType = 4 )
func (x BinlogType) Enum() *BinlogType
func (BinlogType) EnumDescriptor() ([]byte, []int)
func (x BinlogType) String() string
func (x *BinlogType) UnmarshalJSON(data []byte) error
type CisternClient interface { // DumpBinlog dumps continuous binlog items in a stream from a given position DumpBinlog(ctx context.Context, in *DumpBinlogReq, opts ...grpc.CallOption) (Cistern_DumpBinlogClient, error) // DumpDDLJobs dumps all history DDL jobs before a specified commitTS DumpDDLJobs(ctx context.Context, in *DumpDDLJobsReq, opts ...grpc.CallOption) (*DumpDDLJobsResp, error) // Notify notifies all living cisterns that a new pump is coming // the living cisterns can be queried from pd Notify(ctx context.Context, in *NotifyReq, opts ...grpc.CallOption) (*NotifyResp, error) }
func NewCisternClient(cc *grpc.ClientConn) CisternClient
type CisternServer interface { // DumpBinlog dumps continuous binlog items in a stream from a given position DumpBinlog(*DumpBinlogReq, Cistern_DumpBinlogServer) error // DumpDDLJobs dumps all history DDL jobs before a specified commitTS DumpDDLJobs(context.Context, *DumpDDLJobsReq) (*DumpDDLJobsResp, error) // Notify notifies all living cisterns that a new pump is coming // the living cisterns can be queried from pd Notify(context.Context, *NotifyReq) (*NotifyResp, error) }
type Cistern_DumpBinlogClient interface { Recv() (*DumpBinlogResp, error) grpc.ClientStream }
type Cistern_DumpBinlogServer interface { Send(*DumpBinlogResp) error grpc.ServerStream }
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"` }
func (*DumpBinlogReq) Descriptor() ([]byte, []int)
func (m *DumpBinlogReq) GetBeginCommitTS() int64
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 struct { // CommitTS specifies the commitTS of binlog CommitTS int64 `protobuf:"varint,1,opt,name=commitTS,proto3" json:"commitTS,omitempty"` // payloads is bytecodes encoded from binlog item Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` // ddljob is json bytes marshaled from corresponding ddljob struct if payload is a DDL type of binlog Ddljob []byte `protobuf:"bytes,3,opt,name=ddljob,proto3" json:"ddljob,omitempty"` }
func (*DumpBinlogResp) Descriptor() ([]byte, []int)
func (m *DumpBinlogResp) GetCommitTS() int64
func (m *DumpBinlogResp) GetDdljob() []byte
func (m *DumpBinlogResp) GetPayload() []byte
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 DumpDDLJobsReq struct { // beginCommitTS is the start point of drainer processing binlog, DumpDDLJobs() returns // all history DDL jobs before this position, then drainer will apply these DDL jobs // in order of job ID to restore the whole schema info at that moment. BeginCommitTS int64 `protobuf:"varint,1,opt,name=beginCommitTS,proto3" json:"beginCommitTS,omitempty"` }
func (*DumpDDLJobsReq) Descriptor() ([]byte, []int)
func (m *DumpDDLJobsReq) GetBeginCommitTS() int64
func (m *DumpDDLJobsReq) Marshal() (dAtA []byte, err error)
func (m *DumpDDLJobsReq) MarshalTo(dAtA []byte) (int, error)
func (*DumpDDLJobsReq) ProtoMessage()
func (m *DumpDDLJobsReq) Reset()
func (m *DumpDDLJobsReq) Size() (n int)
func (m *DumpDDLJobsReq) String() string
func (m *DumpDDLJobsReq) Unmarshal(dAtA []byte) error
type DumpDDLJobsResp struct { // ddljobs is an array of JSON encoded history DDL jobs Ddljobs [][]byte `protobuf:"bytes,1,rep,name=ddljobs" json:"ddljobs,omitempty"` }
func (*DumpDDLJobsResp) Descriptor() ([]byte, []int)
func (m *DumpDDLJobsResp) GetDdljobs() [][]byte
func (m *DumpDDLJobsResp) Marshal() (dAtA []byte, err error)
func (m *DumpDDLJobsResp) MarshalTo(dAtA []byte) (int, error)
func (*DumpDDLJobsResp) ProtoMessage()
func (m *DumpDDLJobsResp) Reset()
func (m *DumpDDLJobsResp) Size() (n int)
func (m *DumpDDLJobsResp) String() string
func (m *DumpDDLJobsResp) Unmarshal(dAtA []byte) error
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"` // checksum of binlog payload. Checksum []byte `protobuf:"bytes,3,opt,name=checksum,proto3" json:"checksum,omitempty"` // The meta information of the binlog entity. Meta Meta `protobuf:"bytes,4,opt,name=meta" json:"meta"` }
type Meta struct { // The binlog's start ts, used in Prewrite, Commit and Rollback type binlog. StartTs int64 `protobuf:"varint,1,opt,name=startTs,proto3" json:"startTs,omitempty"` // The binlog's commit ts, used only in Commit type binlog. CommitTs int64 `protobuf:"varint,2,opt,name=commitTs,proto3" json:"commitTs,omitempty"` }
Meta saves the binlog's meta information.
const ( MutationType_Insert MutationType = 0 MutationType_Update MutationType = 1 MutationType_DeleteID MutationType = 2 MutationType_DeletePK MutationType = 3 MutationType_DeleteRow MutationType = 4 )
func (x MutationType) Enum() *MutationType
func (MutationType) EnumDescriptor() ([]byte, []int)
func (x MutationType) String() string
func (x *MutationType) UnmarshalJSON(data []byte) error
type NotifyReq struct { }
type NotifyResp struct { }
func (*NotifyResp) Descriptor() ([]byte, []int)
func (m *NotifyResp) Marshal() (dAtA []byte, err error)
func (m *NotifyResp) MarshalTo(dAtA []byte) (int, error)
func (*NotifyResp) ProtoMessage()
func (m *NotifyResp) Reset()
func (m *NotifyResp) Size() (n int)
func (m *NotifyResp) String() string
func (m *NotifyResp) Unmarshal(dAtA []byte) error
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.
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() ([]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 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"` }
func (*PullBinlogReq) Descriptor() ([]byte, []int)
func (m *PullBinlogReq) GetClusterID() uint64
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 struct { // The binlog entity that send in a stream Entity Entity `protobuf:"bytes,1,opt,name=entity" json:"entity"` }
func (*PullBinlogResp) Descriptor() ([]byte, []int)
func (m *PullBinlogResp) GetEntity() 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 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) // Sends binlog stream from a given location. PullBinlogs(ctx context.Context, in *PullBinlogReq, opts ...grpc.CallOption) (Pump_PullBinlogsClient, error) }
func NewPumpClient(cc *grpc.ClientConn) PumpClient
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) // Sends binlog stream from a given location. PullBinlogs(*PullBinlogReq, Pump_PullBinlogsServer) error }
type Pump_PullBinlogsClient interface { Recv() (*PullBinlogResp, error) grpc.ClientStream }
type Pump_PullBinlogsServer interface { Send(*PullBinlogResp) error grpc.ServerStream }
type TableMutation struct { TableId int64 `protobuf:"varint,1,opt,name=table_id,json=tableId" json:"table_id"` // The inserted row contains all column values. InsertedRows [][]byte `protobuf:"bytes,2,rep,name=inserted_rows,json=insertedRows" json:"inserted_rows,omitempty"` // The updated row contains old values and new values of the row. UpdatedRows [][]byte `protobuf:"bytes,3,rep,name=updated_rows,json=updatedRows" json:"updated_rows,omitempty"` // Obsolete field. DeletedIds []int64 `protobuf:"varint,4,rep,name=deleted_ids,json=deletedIds" json:"deleted_ids,omitempty"` // Obsolete field. DeletedPks [][]byte `protobuf:"bytes,5,rep,name=deleted_pks,json=deletedPks" json:"deleted_pks,omitempty"` // The row value of the deleted row. DeletedRows [][]byte `protobuf:"bytes,6,rep,name=deleted_rows,json=deletedRows" json:"deleted_rows,omitempty"` // Used to apply table mutations in original sequence. Sequence []MutationType `protobuf:"varint,7,rep,name=sequence,enum=binlog.MutationType" json:"sequence,omitempty"` XXX_unrecognized []byte `json:"-"` }
TableMutation contains mutations in a table.
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) GetSequence() []MutationType
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 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() ([]byte, []int)
func (m *WriteBinlogReq) GetClusterID() uint64
func (m *WriteBinlogReq) GetPayload() []byte
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 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() ([]byte, []int)
func (m *WriteBinlogResp) GetErrmsg() string
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
Package binlog imports 6 packages (graph) and is imported by 200 packages. Updated 2019-12-05. Refresh now. Tools for package owners.