diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e8df176 --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +# Created by .ignore support plugin (hsz.mobi) +### Go template +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +.vscode +.idea + +vendor + +docker/var +docker/canal-server-logs +docker/example/meta.dat \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 6752b79..3502e42 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: go go: - - "1.10.x" - - "1.11.x" + - "1.14.x" -go_import_path: github.com/CanalClient/canal-go +go_import_path: github.com/withlin/canal-go diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 3e8f316..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - // 使用 IntelliSense 了解相关属性。 - // 悬停以查看现有属性的描述。 - // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - - { - "name": "GO", - "type": "go", - "request": "launch", - "mode": "debug", - "remotePath": "", - // "port": 7777, - // "host": "127.0.0.1", - "program": "${workspaceRoot}/samples/main.go", - "env": { - "GOPATH":"D:/GoWork" - }, - "args": [], - "showLog": false - } - ] -} diff --git a/README.md b/README.md index 67fab9d..744bf81 100644 --- a/README.md +++ b/README.md @@ -3,166 +3,3 @@ [![Build Status](https://travis-ci.org/withlin/canal-go.svg?branch=master)](https://travis-ci.org/withlin/canal-go) [![Go Report Card](https://goreportcard.com/badge/github.com/withlin/canal-go)](https://goreportcard.com/badge/github.com/withlin/canal-go) - -## 一.canal-go是什么? - -canal-go (完全兼容java客户端) 是阿里巴巴开源项目 Canal 的 golang 客户端。为 golang 开发者提供一个更友好的使用 Canal 的方式。Canal 是mysql数据库binlog的增量订阅&消费组件。 - -基于日志增量订阅&消费支持的业务: - -1. 数据库镜像 -2. 数据库实时备份 -3. 多级索引 (卖家和买家各自分库索引) -4. search build -5. 业务cache刷新 -6. 价格变化等重要业务消息 - -关于 Canal 的更多信息请访问 https://github.com/alibaba/canal/wiki - -## 二.应用场景 - -canal-go作为Canal的客户端,其应用场景就是Canal的应用场景。关于应用场景在Canal介绍一节已有概述。举一些实际的使用例子: - -1.代替使用轮询数据库方式来监控数据库变更,有效改善轮询耗费数据库资源。 - -2.根据数据库的变更实时更新搜索引擎,比如电商场景下商品信息发生变更,实时同步到商品搜索引擎 Elasticsearch、solr等 - -3.根据数据库的变更实时更新缓存,比如电商场景下商品价格、库存发生变更实时同步到redis - -4.数据库异地备份、数据同步 - -5.根据数据库变更触发某种业务,比如电商场景下,创建订单超过xx时间未支付被自动取消,我们获取到这条订单数据的状态变更即可向用户推送消息。 - -6.将数据库变更整理成自己的数据格式发送到kafka等消息队列,供消息队列的消费者进行消费。 - -## 三.工作原理 - -canal-go 是 Canal 的 golang 客户端,它与 Canal 是采用的Socket来进行通信的,传输协议是TCP,交互协议采用的是 Google Protocol Buffer 3.0。 - -## 四.工作流程 - -1.Canal连接到mysql数据库,模拟slave - -2.canal-go与Canal建立连接 - -2.数据库发生变更写入到binlog - -5.Canal向数据库发送dump请求,获取binlog并解析 - -4.canal-go向Canal请求数据库变更 - -4.Canal发送解析后的数据给canal-go - -5.canal-go收到数据,消费成功,发送回执。(可选) - -6.Canal记录消费位置。 - -以一张图来表示: - -![1537860226808](assets/668104-20180925182816462-2110152563.png) - -## 五.快速入门 - -### 1.安装Canal - -Canal的安装以及配置使用请查看 https://github.com/alibaba/canal/wiki/QuickStart - - -### 2.安装 - -````shell - -git clone https://github.com/withlin/canal-go.git - -export GO111MODULE=on - -go mod vendor - -```` - -### 3.建立与Canal的连接 - -````golang - -connector := client.NewSimpleCanalConnector("192.168.199.17", 11111, "", "", "example", 60000, 60*60*1000) - err :=connector.Connect() - if err != nil { - log.Println(err) - os.Exit(1) - } - err = connector.Subscribe(".*\\\\..*") - if err != nil { - log.Println(err) - os.Exit(1) - } - - for { - - message,err := connector.Get(100, nil, nil) - if err != nil { - log.Println(err) - os.Exit(1) - } - batchId := message.Id - if batchId == -1 || len(message.Entries) <= 0 { - time.Sleep(300 * time.Millisecond) - fmt.Println("===没有数据了===") - continue - } - - printEntry(message.Entries) - - } -```` - -更多详情请查看 [Sample](https://github.com/CanalSharp/canal-go/tree/master/samples) - -## 六.通过docker方式快速运行canal-go - -### 1.执行命令通过docker方式运行 mysql与canal - -````shell -git clone https://github.com/CanalClient/canal-go.git -cd canal-go -cd docker -docker-compose up -d -```` - -### 2.使用navicat等数据库管理工具连接mysql - -ip:运行docker的服务器ip - -mysql用户:root - -mysql密码:000000 - -mysql端口:4406 - -默认提供了一个test数据库,然后有一张名为test的表。 - -![1537866852816](assets/668104-20180925182815646-1209020640.png) - -### 3.运行Sample项目 - -### 4.测试 - -执行下列sql: - -````sql -insert into test values(1000,'111'); -update test set name='222' where id=1000; -delete from test where id=1000; -```` - - -可以看见我们分别执行 insert、update、delete 语句,我们的canal-go都获取到了数据库变更。 - - - -## 八.贡献代码 - -1.fork本项目 - -2.做出你的更改 - -3.提交 pull request diff --git a/client/canal_connector.go b/client/canal_connector.go index 22bb1a7..4df7620 100644 --- a/client/canal_connector.go +++ b/client/canal_connector.go @@ -16,17 +16,15 @@ package client -import pb "github.com/CanalClient/canal-go/protocol" +import pb "github.com/withlin/canal-go/protocol" type CanalConnector interface { - Connect() - Disconnect() - CheckValid() - Subscribe() - UnSubscribe() - Get(arg ...interface{}) pb.Message - GetWithoutAck(arg ...interface{}) pb.Message - Ack(batchId int64) - Rollback(arg ...interface{}) - StopRunning() + Connect() error + DisConnection() error + Subscribe(filter string) error + UnSubscribe() error + Get(batchSize int32, timeOut *int64, units *int32) (msg *pb.Message, err error) + GetWithOutAck(batchSize int32, timeOut *int64, units *int32) (msg *pb.Message, err error) + Ack(batchId int64) error + RollBack(batchId int64) error } diff --git a/client/cluster_canal_connector.go b/client/cluster_canal_connector.go index da39dfa..49ec102 100644 --- a/client/cluster_canal_connector.go +++ b/client/cluster_canal_connector.go @@ -2,10 +2,15 @@ package client import ( "errors" + "fmt" "log" + "sort" + "strings" "time" - pb "github.com/CanalClient/canal-go/protocol" + "github.com/go-zookeeper/zk" + + pb "github.com/withlin/canal-go/protocol" ) type ClusterCanalConnector struct { @@ -15,128 +20,297 @@ type ClusterCanalConnector struct { soTimeOut, idleTimeOut int32 filter string - RetryTimes int32 + RetryTimes int32 + currentSequence string + zkVersion int32 + + Path string } +const ( + path = "/canal-consumer" + runningFlag = byte(0) + notRunningFlag = byte(0) +) + func NewClusterCanalConnector(canalNode *CanalClusterNode, username string, password string, destination string, - soTimeOut int32, idleTimeOut int32) *ClusterCanalConnector { + soTimeOut int32, idleTimeOut int32) (*ClusterCanalConnector, error) { + + destinationPath := fmt.Sprintf("%s/%s", path, destination) + + err := checkRootPath(canalNode.zkClient, destinationPath) + if err != nil { + return nil, err + } - cc := &ClusterCanalConnector{ - canalNode: canalNode, username: username, password: password, - destination: destination, soTimeOut: soTimeOut, idleTimeOut: idleTimeOut, - RetryTimes: 3, + currentSequence, err := createEphemeralSequence(canalNode.zkClient, destinationPath) + if err != nil { + return nil, err } - return cc + cluster := &ClusterCanalConnector{ + canalNode: canalNode, + username: username, + password: password, + destination: destination, + soTimeOut: soTimeOut, + idleTimeOut: idleTimeOut, + RetryTimes: 0, + currentSequence: currentSequence, + zkVersion: 0, + Path: destinationPath, + } + + return cluster, nil } -// 重试失败后重新连接 -func (cc *ClusterCanalConnector) reTryWithConn(name string, do func() error) error { - return cc.reTry(name, func() error { - if cc.conn == nil { - cc.Connect() - } - if cc.conn == nil { - return errors.New("canal connect fail") - } - if err := do(); err != nil { - cc.Connect() - return err - } - return nil - }) +func (cc *ClusterCanalConnector) Connect() error { + log.Println("connecting canal server...") + err := cc.reconnect() + return err } -func (cc *ClusterCanalConnector) reTry(name string, do func() error) (err error) { - for times := int32(0); times < cc.RetryTimes; times++ { - if err = do(); err != nil { - log.Printf("%s err:%v, reTry", name, err) - time.Sleep(time.Second * 5) - } else { - return nil +func (cc *ClusterCanalConnector) reconnect() error { + err := cc.doConnect() + if err != nil { + log.Println("connect canal-server failed ", err) + cc.RetryTimes++ + if cc.RetryTimes < 5 { + time.Sleep(5 * time.Second) + return cc.reconnect() } + return err } - return + cc.RetryTimes = 0 + + return nil } -func (cc *ClusterCanalConnector) Connect() error { - log.Printf("Connect") - - return cc.reTry("Connect", func() error { - var ( - addr string - port int - err error - ) - cc.DisConnection() - if addr, port, err = cc.canalNode.GetNode(); err != nil { - log.Printf("canalNode.GetNode addr=%s, port=%d, err=%v\n", addr, port, err) - return err - } +func (cc *ClusterCanalConnector) doConnect() error { - conn := NewSimpleCanalConnector(addr, port, cc.username, cc.password, - cc.destination, cc.soTimeOut, cc.idleTimeOut) + log.Println("connecting...") - if cc.filter != "" { - conn.Filter = cc.filter - } + //等待成为最小的节点,最小的节点去运行 + err := cc.waitBecomeFirst() + if err != nil { + return fmt.Errorf("error wait become first zk node %s", err.Error()) + } - if err = conn.Connect(); err != nil { - log.Printf("conn.Connect err:%v", err) - conn.DisConnection() - return err - } - cc.conn = conn - return nil - }) + _, err = cc.canalNode.zkClient.Set(cc.Path+"/"+cc.currentSequence, []byte{runningFlag}, cc.zkVersion) + if err != nil { + return fmt.Errorf("error set running flag %s", err.Error()) + } + cc.zkVersion++ + + addr, port, err := cc.canalNode.GetNode() + if err != nil { + return fmt.Errorf("error get zk current node path %s", err.Error()) + } + + connector := NewSimpleCanalConnector(addr, port, cc.username, cc.password, cc.destination, cc.soTimeOut, cc.idleTimeOut) + cc.conn = connector + + err = connector.Connect() + if err != nil { + return err + } + + log.Println("connected to ", addr, " success") + + return nil } -func (cc *ClusterCanalConnector) DisConnection() { +func (cc *ClusterCanalConnector) DisConnection() error { if cc.conn != nil { cc.conn.DisConnection() + _, stat, _ := cc.canalNode.zkClient.Get(cc.Path + "/" + cc.currentSequence) + err := cc.canalNode.zkClient.Delete(cc.Path+"/"+cc.currentSequence, stat.Version) + if err != nil { + return fmt.Errorf("error delete temp consumer path %s", err.Error()) + } cc.conn = nil } + + return nil } func (cc *ClusterCanalConnector) Subscribe(filter string) error { - return cc.reTryWithConn("Subscribe", func() (err error) { - if err = cc.conn.Subscribe(filter); err == nil { - cc.filter = filter + err := cc.conn.Subscribe(filter) + if err != nil { + err = cc.reconnect() + if err != nil { + return err } - return - }) + return cc.Subscribe(filter) + } + + return nil } func (cc *ClusterCanalConnector) UnSubscribe() error { - return cc.reTryWithConn("UnSubscribe", func() error { - return cc.conn.UnSubscribe() - }) + err := cc.conn.UnSubscribe() + if err != nil { + err = cc.reconnect() + if err != nil { + return err + } + return cc.UnSubscribe() + } + + return nil } func (cc *ClusterCanalConnector) GetWithOutAck(batchSize int32, timeOut *int64, units *int32) (msg *pb.Message, err error) { - _ = cc.reTryWithConn("GetWithOutAck", func() error { - msg, err = cc.conn.GetWithOutAck(batchSize, timeOut, units) - return err - }) + msg, err = cc.conn.GetWithOutAck(batchSize, timeOut, units) + if err != nil { + err = cc.reconnect() + if err != nil { + return nil, err + } + return cc.conn.GetWithOutAck(batchSize, timeOut, units) + } + return } func (cc *ClusterCanalConnector) Get(batchSize int32, timeOut *int64, units *int32) (msg *pb.Message, err error) { - _ = cc.reTryWithConn("Get", func() error { - msg, err = cc.conn.Get(batchSize, timeOut, units) - return err - }) + msg, err = cc.conn.Get(batchSize, timeOut, units) + if err != nil { + err = cc.reconnect() + if err != nil { + return nil, err + } + return cc.conn.Get(batchSize, timeOut, units) + } + return } func (cc *ClusterCanalConnector) Ack(batchId int64) error { - return cc.reTryWithConn("Ack", func() error { - return cc.conn.Ack(batchId) - }) + err := cc.conn.Ack(batchId) + if err != nil { + err = cc.reconnect() + if err != nil { + return err + } + return cc.Ack(batchId) + } + + return nil } func (cc *ClusterCanalConnector) RollBack(batchId int64) error { - return cc.reTryWithConn("RollBack", func() error { - return cc.conn.RollBack(batchId) - }) + err := cc.conn.RollBack(batchId) + if err != nil { + err = cc.reconnect() + if err != nil { + return err + } + return cc.RollBack(batchId) + } + + return nil +} + +func createEphemeralSequence(zkClient *zk.Conn, destinationPath string) (string, error) { + node, err := zkClient.Create(destinationPath+"/", []byte{notRunningFlag}, zk.FlagEphemeral|zk.FlagSequence, + zk.WorldACL(zk.PermAll)) + if err != nil { + return "", err + } + split := strings.Split(node, "/") + currentSequence := split[len(split)-1] + return currentSequence, nil +} + +func checkRootPath(zkClient *zk.Conn, destinationPath string) error { + rootExists, _, err := zkClient.Exists(path) + if err != nil { + return err + } + if !rootExists { + _, err := zkClient.Create(path, []byte{}, 0, zk.WorldACL(zk.PermAll)) + if err != nil { + return err + } + } + exists, _, err := zkClient.Exists(destinationPath) + if err != nil { + return err + } + if !exists { + _, err := zkClient.Create(destinationPath, []byte{}, 0, zk.WorldACL(zk.PermAll)) + if err != nil { + return err + } + } + return nil +} + +func (cc *ClusterCanalConnector) waitBecomeFirst() error { + zkClient := cc.canalNode.zkClient + children, _, err := zkClient.Children(cc.Path) + if err != nil { + return err + } + + if len(children) == 0 { + return errors.New("没有子节点") + } + + sort.Strings(children) + + if cc.currentSequence != children[0] { + noSelf := true + + for i, child := range children { + if cc.currentSequence == child { + noSelf = false + previousPath := cc.Path + "/" + children[i-1] + //阻塞等待上一个比他小的节点删除 + log.Println("waiting") + err := waitDelete(zkClient, previousPath) + if err != nil { + return err + } + log.Println("waited") + + return cc.waitBecomeFirst() + } + } + + if noSelf { + //以防万一 + cc.currentSequence, err = createEphemeralSequence(zkClient, cc.Path) + if err != nil { + return err + } + // 再次创建临时节点成功后将版本设置为0,不然后续更新节点会出现版本冲突 + cc.zkVersion = 0 + return cc.waitBecomeFirst() + } + } + + return nil +} + +// 等待上一个比他小的节点失联,失联后等待10秒,10秒后还没恢复则确认已被删除 +func waitDelete(zkClient *zk.Conn, previousPath string) error { + existsW, _, events, err := zkClient.ExistsW(previousPath) + if err != nil { + return err + } + + if existsW { + event := <-events + if event.Type != zk.EventNodeDeleted { + return waitDelete(zkClient, previousPath) + } else { + //等待10秒再查看监听的节点是否确实不存在了,以防只是网络延迟造成的掉线 + time.Sleep(10 * time.Second) + return waitDelete(zkClient, previousPath) + } + } + + return nil } diff --git a/client/cluster_canal_node.go b/client/cluster_canal_node.go index df49b78..c796a2f 100644 --- a/client/cluster_canal_node.go +++ b/client/cluster_canal_node.go @@ -9,9 +9,14 @@ import ( "strings" "time" - "github.com/samuel/go-zookeeper/zk" + "github.com/go-zookeeper/zk" ) +/** +修改说明:去掉CanalClusterNode里的ServerRunningData和Event,不再监听,改为随用随取,因为不能确定取到值后就进行链接,会造成数据不一致, + 如果当前Server挂了,连接会断开,到时候直接重连就可以了 +*/ + type ServerRunningData struct { Cid int64 Address string @@ -19,11 +24,10 @@ type ServerRunningData struct { } type CanalClusterNode struct { + zkClient *zk.Conn destination string clusterAddress []string - runningServer *ServerRunningData clusterEvent <-chan zk.Event - serverEvent <-chan zk.Event } const ( @@ -33,12 +37,9 @@ const ( func NewCanalClusterNode(destination string, zkServer []string, timeout time.Duration) (canalNode *CanalClusterNode, err error) { var ( - zkClient *zk.Conn - b []byte - cluster []string - clusterEV <-chan zk.Event - serverEV <-chan zk.Event - serverInfo ServerRunningData + zkClient *zk.Conn + cluster []string + clusterEV <-chan zk.Event ) if zkClient, _, err = zk.Connect(zkServer, timeout); err != nil { @@ -50,24 +51,14 @@ func NewCanalClusterNode(destination string, zkServer []string, timeout time.Dur return } - if b, _, serverEV, err = zkClient.GetW(fmt.Sprintf(running_path, destination)); err != nil { - log.Printf("zkClient.GetW err:%v", err) - return - } - - if err = json.Unmarshal(b, &serverInfo); err != nil { - log.Printf("json.Unmarshal err:%v", err) - return - } - canalNode = &CanalClusterNode{ - destination: destination, - runningServer: &serverInfo, - clusterEvent: clusterEV, - serverEvent: serverEV, + zkClient: zkClient, + destination: destination, + clusterEvent: clusterEV, } canalNode.InitClusters(cluster) + return } @@ -79,27 +70,40 @@ func (canalNode *CanalClusterNode) InitClusters(addressList []string) { } func (canalNode *CanalClusterNode) GetNode() (addr string, port int, err error) { - server := "" - if canalNode.runningServer != nil { - server = canalNode.runningServer.Address - } - if server == "" && len(canalNode.clusterAddress) > 0 { - server = canalNode.clusterAddress[0] + serverRunningData, err := canalNode.getRunningServer() + if err != nil { + return "", 0, err } - if server != "" { - s := strings.Split(server, ":") - if len(s) == 2 { - if port, err = strconv.Atoi(s[1]); err == nil { - addr = s[0] - } + s := strings.Split(serverRunningData.Address, ":") + if len(s) == 2 && s[0] != "" { + port, err = strconv.Atoi(s[1]) + if err != nil { + return "", 0, fmt.Errorf("error canal cluster server %s", serverRunningData.Address) } + + addr = s[0] + return } else { - return "", 0, fmt.Errorf("no alive canal server for %s", canalNode.destination) + return "", 0, fmt.Errorf("error canal cluster server %s", serverRunningData.Address) } - if addr == "" { - return "", 0, fmt.Errorf("error canal cluster server %s", server) +} + +func (canalNode *CanalClusterNode) getRunningServer() (ServerRunningData, error) { + serverInfo := ServerRunningData{} + + body, _, err := canalNode.zkClient.Get(fmt.Sprintf(running_path, canalNode.destination)) + if err != nil { + log.Printf("zkClient.GetW err:%v", err) + return serverInfo, err } - return + + err = json.Unmarshal(body, &serverInfo) + if err != nil { + log.Printf("json.Unmarshal err:%v", err) + return serverInfo, err + } + + return serverInfo, nil } diff --git a/client/security_util.go b/client/security_util.go new file mode 100644 index 0000000..ece68a4 --- /dev/null +++ b/client/security_util.go @@ -0,0 +1,34 @@ +package client + +import ( + "crypto/sha1" + "encoding/hex" +) + +func Scramble411(data *[]byte,seed *[]byte) []byte { + crypt := sha1.New() + + //stage1 + crypt.Write(*data) + stage1 := crypt.Sum(nil) + + //stage2 + crypt.Reset() + crypt.Write(stage1) + stage2 := crypt.Sum(nil) + + //stage3 + crypt.Reset() + crypt.Write(*seed) + crypt.Write(stage2) + stage3 := crypt.Sum(nil) + for i := range stage3 { + stage3[i] ^= stage1[i] + } + + return stage3 +} + +func ByteSliceToHexString(data []byte) string { + return hex.EncodeToString(data) +} diff --git a/client/simple_canal_connector.go b/client/simple_canal_connector.go index c2071fa..b1016fa 100644 --- a/client/simple_canal_connector.go +++ b/client/simple_canal_connector.go @@ -20,16 +20,16 @@ import ( "bufio" "bytes" "encoding/binary" - "errors" "fmt" + pb "github.com/withlin/canal-go/protocol" "io" "net" "strconv" "sync" - pb "github.com/CanalClient/canal-go/protocol" + pbp "github.com/withlin/canal-go/protocol/packet" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" ) type SimpleCanalConnector struct { @@ -45,14 +45,17 @@ type SimpleCanalConnector struct { Filter string RollbackOnConnect bool LazyParseEntry bool + conn net.Conn + mutex sync.Mutex } -var ( - conn net.Conn - mutex sync.Mutex +const ( + versionErr string = "unsupported version at this client." + handshakeErr = "expect handshake but found other type." + packetAckErr = "unexpected packet type when ack is expected" ) -//NewSimpleCanalConnector 创建SimpleCanalConnector实例 +// NewSimpleCanalConnector 创建SimpleCanalConnector实例 func NewSimpleCanalConnector(address string, port int, username string, password string, destination string, soTimeOut int32, idleTimeOut int32) *SimpleCanalConnector { s := &SimpleCanalConnector{ Address: address, @@ -68,7 +71,7 @@ func NewSimpleCanalConnector(address string, port int, username string, password } -//Connect 连接Canal-server +// Connect 连接Canal-server func (c *SimpleCanalConnector) Connect() error { if c.Connected { return nil @@ -97,33 +100,34 @@ func (c *SimpleCanalConnector) Connect() error { } -//quitelyClose 优雅关闭 -func quitelyClose() { - if conn != nil { - conn.Close() +// quitelyClose 优雅关闭 +func (c *SimpleCanalConnector) quitelyClose() { + if c.conn != nil { + c.conn.Close() } } -//DisConnection 关闭连接 -func (c *SimpleCanalConnector) DisConnection() { +// DisConnection 关闭连接 +func (c *SimpleCanalConnector) DisConnection() error { if c.RollbackOnConnect && c.Connected == true { c.RollBack(0) } c.Connected = false - quitelyClose() + c.quitelyClose() + return nil } -//doConnect 去连接Canal-Server -func (c SimpleCanalConnector) doConnect() error { +// doConnect 去连接Canal-Server +func (c *SimpleCanalConnector) doConnect() error { address := c.Address + ":" + fmt.Sprintf("%d", c.Port) con, err := net.Dial("tcp", address) if err != nil { return err } - conn = con + c.conn = con - p := new(pb.Packet) - data, err := readNextPacket() + p := new(pbp.Packet) + data, err := c.readNextPacket() if err != nil { return err } @@ -133,58 +137,60 @@ func (c SimpleCanalConnector) doConnect() error { } if p != nil { if p.GetVersion() != 1 { - panic("unsupported version at this client.") + return fmt.Errorf(versionErr) } - if p.GetType() != pb.PacketType_HANDSHAKE { - panic("expect handshake but found other type.") + if p.GetType() != pbp.PacketType_HANDSHAKE { + return fmt.Errorf(handshakeErr) } - handshake := &pb.Handshake{} + handshake := &pbp.Handshake{} + seed := &handshake.Seeds err = proto.Unmarshal(p.GetBody(), handshake) if err != nil { return err } - pas := []byte(c.PassWord) - ca := &pb.ClientAuth{ + bytePas := []byte(c.PassWord) + pas := []byte(ByteSliceToHexString(Scramble411(&bytePas, seed))) + ca := &pbp.ClientAuth{ Username: c.UserName, Password: pas, - NetReadTimeoutPresent: &pb.ClientAuth_NetReadTimeout{NetReadTimeout: c.IdleTimeOut}, - NetWriteTimeoutPresent: &pb.ClientAuth_NetWriteTimeout{NetWriteTimeout: c.IdleTimeOut}, + NetReadTimeoutPresent: &pbp.ClientAuth_NetReadTimeout{NetReadTimeout: c.IdleTimeOut}, + NetWriteTimeoutPresent: &pbp.ClientAuth_NetWriteTimeout{NetWriteTimeout: c.IdleTimeOut}, } caByteArray, _ := proto.Marshal(ca) - packet := &pb.Packet{ - Type: pb.PacketType_CLIENTAUTHENTICATION, + packet := &pbp.Packet{ + Type: pbp.PacketType_CLIENTAUTHENTICATION, Body: caByteArray, } packArray, _ := proto.Marshal(packet) - WriteWithHeader(packArray) + c.WriteWithHeader(packArray) - pp, err := readNextPacket() + pp, err := c.readNextPacket() if err != nil { return err } - pk := &pb.Packet{} + pk := &pbp.Packet{} err = proto.Unmarshal(pp, pk) if err != nil { return err } - if pk.Type != pb.PacketType_ACK { - panic("unexpected packet type when ack is expected") + if pk.Type != pbp.PacketType_ACK { + return fmt.Errorf(packetAckErr) } - ackBody := &pb.Ack{} + ackBody := &pbp.Ack{} err = proto.Unmarshal(pk.GetBody(), ackBody) if err != nil { return err } if ackBody.GetErrorCode() > 0 { - panic(errors.New(fmt.Sprintf("something goes wrong when doing authentication:%s", ackBody.GetErrorMessage()))) + return fmt.Errorf("something goes wrong when doing authentication:%s", ackBody.GetErrorMessage()) } c.Connected = true @@ -194,7 +200,7 @@ func (c SimpleCanalConnector) doConnect() error { } -//GetWithOutAck 获取数据不Ack +// GetWithOutAck 获取数据不Ack func (c *SimpleCanalConnector) GetWithOutAck(batchSize int32, timeOut *int64, units *int32) (*pb.Message, error) { c.waitClientRunning() if !c.Running { @@ -220,26 +226,26 @@ func (c *SimpleCanalConnector) GetWithOutAck(batchSize int32, timeOut *int64, un if units == nil { units = &i } - get := new(pb.Get) - get.AutoAckPresent = &pb.Get_AutoAck{AutoAck: false} + get := new(pbp.Get) + get.AutoAckPresent = &pbp.Get_AutoAck{AutoAck: false} get.Destination = c.ClientIdentity.Destination get.ClientId = strconv.Itoa(c.ClientIdentity.ClientId) get.FetchSize = size - get.TimeoutPresent = &pb.Get_Timeout{Timeout: *time} - get.UnitPresent = &pb.Get_Unit{Unit: *units} + get.TimeoutPresent = &pbp.Get_Timeout{Timeout: *time} + get.UnitPresent = &pbp.Get_Unit{Unit: *units} getBody, err := proto.Marshal(get) if err != nil { return nil, err } - packet := new(pb.Packet) - packet.Type = pb.PacketType_GET + packet := new(pbp.Packet) + packet.Type = pbp.PacketType_GET packet.Body = getBody pa, err := proto.Marshal(packet) if err != nil { return nil, err } - WriteWithHeader(pa) + c.WriteWithHeader(pa) message, err := c.receiveMessages() if err != nil { return nil, err @@ -247,24 +253,27 @@ func (c *SimpleCanalConnector) GetWithOutAck(batchSize int32, timeOut *int64, un return message, nil } -//Get 获取数据并且Ack数据 +// Get 获取数据并且Ack数据 func (c *SimpleCanalConnector) Get(batchSize int32, timeOut *int64, units *int32) (*pb.Message, error) { message, err := c.GetWithOutAck(batchSize, timeOut, units) if err != nil { return nil, err } - c.Ack(message.Id) + err = c.Ack(message.Id) + if err != nil { + return nil, err + } return message, nil } -//UnSubscribe 取消订阅 +// UnSubscribe 取消订阅 func (c *SimpleCanalConnector) UnSubscribe() error { c.waitClientRunning() if c.Running { return nil } - us := new(pb.Unsub) + us := new(pbp.Unsub) us.Destination = c.ClientIdentity.Destination us.ClientId = strconv.Itoa(c.ClientIdentity.ClientId) @@ -273,14 +282,14 @@ func (c *SimpleCanalConnector) UnSubscribe() error { return err } - pa := new(pb.Packet) - pa.Type = pb.PacketType_UNSUBSCRIPTION + pa := new(pbp.Packet) + pa.Type = pbp.PacketType_UNSUBSCRIPTION pa.Body = unSub pack, err := proto.Marshal(pa) - WriteWithHeader(pack) + c.WriteWithHeader(pack) - p, err := readNextPacket() + p, err := c.readNextPacket() if err != nil { return err } @@ -289,81 +298,35 @@ func (c *SimpleCanalConnector) UnSubscribe() error { if err != nil { return err } - ack := new(pb.Ack) + ack := new(pbp.Ack) err = proto.Unmarshal(pa.Body, ack) if err != nil { return err } if ack.GetErrorCode() > 0 { - panic(errors.New(fmt.Sprintf("failed to unSubscribe with reason:%s", ack.GetErrorMessage()))) + errMsg := ack.GetErrorMessage() + return fmt.Errorf("failed to unSubscribe with reason:%s", errMsg) } return nil } -//receiveMessages 接收Canal-Server返回的消息体 +// receiveMessages 接收Canal-Server返回的消息体 func (c *SimpleCanalConnector) receiveMessages() (*pb.Message, error) { - data, err := readNextPacket() - if err != nil { - return nil, err - } - p := new(pb.Packet) - err = proto.Unmarshal(data, p) + data, err := c.readNextPacket() if err != nil { return nil, err } - messages := new(pb.Messages) - message := new(pb.Message) - - length := len(messages.Messages) - message.Entries = make([]pb.Entry, length) - ack := new(pb.Ack) - var items []pb.Entry - var entry pb.Entry - switch p.Type { - case pb.PacketType_MESSAGES: - if !(p.GetCompression() == pb.Compression_NONE) { - panic("compression is not supported in this connector") - } - err := proto.Unmarshal(p.Body, messages) - if err != nil { - return nil, err - } - if c.LazyParseEntry { - message.RawEntries = messages.Messages - } else { - - for _, value := range messages.Messages { - err := proto.Unmarshal(value, &entry) - if err != nil { - return nil, err - } - items = append(items, entry) - } - } - message.Entries = items - message.Id = messages.GetBatchId() - return message, nil - - case pb.PacketType_ACK: - err := proto.Unmarshal(p.Body, ack) - if err != nil { - return nil, err - } - panic(errors.New(fmt.Sprintf("something goes wrong with reason:%s", ack.GetErrorMessage()))) - default: - panic(errors.New(fmt.Sprintf("unexpected packet type:%s", p.Type))) - - } + return pb.Decode(data, c.LazyParseEntry) } -//Ack Ack Canal-server的数据(就是昨晚某些逻辑操作后删除canal-server端的数据) +// Ack Ack Canal-server的数据(就是昨晚某些逻辑操作后删除canal-server端的数据) func (c *SimpleCanalConnector) Ack(batchId int64) error { c.waitClientRunning() if !c.Running { return nil } - ca := new(pb.ClientAck) + ca := new(pbp.ClientAck) ca.Destination = c.ClientIdentity.Destination ca.ClientId = strconv.Itoa(c.ClientIdentity.ClientId) ca.BatchId = batchId @@ -372,22 +335,22 @@ func (c *SimpleCanalConnector) Ack(batchId int64) error { if err != nil { return err } - pa := new(pb.Packet) - pa.Type = pb.PacketType_CLIENTACK + pa := new(pbp.Packet) + pa.Type = pbp.PacketType_CLIENTACK pa.Body = clientAck pack, err := proto.Marshal(pa) if err != nil { return err } - WriteWithHeader(pack) + c.WriteWithHeader(pack) return nil } -//RollBack 回滚操作 +// RollBack 回滚操作 func (c *SimpleCanalConnector) RollBack(batchId int64) error { c.waitClientRunning() - cb := new(pb.ClientRollback) + cb := new(pbp.ClientRollback) cb.Destination = c.ClientIdentity.Destination cb.ClientId = strconv.Itoa(c.ClientIdentity.ClientId) cb.BatchId = batchId @@ -397,34 +360,34 @@ func (c *SimpleCanalConnector) RollBack(batchId int64) error { return err } - pa := new(pb.Packet) - pa.Type = pb.PacketType_CLIENTROLLBACK + pa := new(pbp.Packet) + pa.Type = pbp.PacketType_CLIENTROLLBACK pa.Body = clientBollBack pack, err := proto.Marshal(pa) if err != nil { return err } - WriteWithHeader(pack) + c.WriteWithHeader(pack) return nil } // readHeaderLength 读取protobuf的header字节,该字节存取了你要读的package的长度 -func readHeaderLength() int { +func (c *SimpleCanalConnector) readHeaderLength() int { buf := make([]byte, 4) - conn.Read(buf) + c.conn.Read(buf) bytesBuffer := bytes.NewBuffer(buf) var x int32 binary.Read(bytesBuffer, binary.BigEndian, &x) return int(x) } -//readNextPacket 通过长度去读取数据包 -func readNextPacket() ([]byte, error) { - mutex.Lock() +// readNextPacket 通过长度去读取数据包 +func (c *SimpleCanalConnector) readNextPacket() ([]byte, error) { + c.mutex.Lock() defer func() { - mutex.Unlock() + c.mutex.Unlock() }() - rdr := bufio.NewReader(conn) + rdr := bufio.NewReader(c.conn) data := make([]byte, 0, 4*1024) n, err := io.ReadFull(rdr, data[:4]) if err != nil { @@ -443,14 +406,14 @@ func readNextPacket() ([]byte, error) { return data, nil } -//WriteWithHeader 写数据包的header+body -func WriteWithHeader(body []byte) { - mutex.Lock() +// WriteWithHeader 写数据包的header+body +func (c *SimpleCanalConnector) WriteWithHeader(body []byte) { + c.mutex.Lock() lenth := len(body) bytes := getWriteHeaderBytes(lenth) - conn.Write(bytes) - conn.Write(body) - mutex.Unlock() + c.conn.Write(bytes) + c.conn.Write(body) + c.mutex.Unlock() } // getWriteHeaderBytes 获取要写数据的长度 @@ -461,23 +424,23 @@ func getWriteHeaderBytes(lenth int) []byte { return bytesBuffer.Bytes() } -//Subscribe 订阅 +// Subscribe 订阅 func (c *SimpleCanalConnector) Subscribe(filter string) error { c.waitClientRunning() if !c.Running { return nil } - body, _ := proto.Marshal(&pb.Sub{Destination: c.ClientIdentity.Destination, ClientId: strconv.Itoa(c.ClientIdentity.ClientId), Filter: c.Filter}) - pack := new(pb.Packet) - pack.Type = pb.PacketType_SUBSCRIPTION + body, _ := proto.Marshal(&pbp.Sub{Destination: c.ClientIdentity.Destination, ClientId: strconv.Itoa(c.ClientIdentity.ClientId), Filter: filter}) + pack := new(pbp.Packet) + pack.Type = pbp.PacketType_SUBSCRIPTION pack.Body = body packet, _ := proto.Marshal(pack) - WriteWithHeader(packet) + c.WriteWithHeader(packet) - p := new(pb.Packet) + p := new(pbp.Packet) - paBytes, err := readNextPacket() + paBytes, err := c.readNextPacket() if err != nil { return err } @@ -485,23 +448,22 @@ func (c *SimpleCanalConnector) Subscribe(filter string) error { if err != nil { return err } - ack := new(pb.Ack) + ack := new(pbp.Ack) err = proto.Unmarshal(p.Body, ack) if err != nil { return err } if ack.GetErrorCode() > 0 { - - panic(errors.New(fmt.Sprintf("failed to subscribe with reason::%s", ack.GetErrorMessage()))) + return fmt.Errorf("failed to subscribe with reason:%s", ack.GetErrorMessage()) } c.Filter = filter - return nil + return nil } -//waitClientRunning 等待客户端跑 +// waitClientRunning 等待客户端跑 func (c *SimpleCanalConnector) waitClientRunning() { c.Running = true } diff --git a/docker/canal-server-logs/.gitignore b/docker/canal-server-logs/.gitignore deleted file mode 100644 index 3e759b7..0000000 --- a/docker/canal-server-logs/.gitignore +++ /dev/null @@ -1,330 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ -**/Properties/launchSettings.json - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 13f243e..373af68 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -3,8 +3,8 @@ version: '3.1' services: mysql: - image: mysql:5.7 - container_name: mysql-5.7 + image: mysql:8.0 + container_name: mysql-8.0 ports: - "4406:3306" environment: @@ -18,7 +18,7 @@ services: canal-server: - image: canal/canal-server:v1.1.0 + image: canal/canal-server:v1.1.7 container_name: canal-server ports: - "11111:11111" diff --git a/docker/example/instance.properties b/docker/example/instance.properties index 35c04a8..4dab06c 100644 --- a/docker/example/instance.properties +++ b/docker/example/instance.properties @@ -8,8 +8,8 @@ canal.instance.gtidon=false # position info canal.instance.master.address=mysql:3306 -canal.instance.master.journal.name=mysql-bin.000001 -canal.instance.master.position=154 +canal.instance.master.journal.name= +canal.instance.master.position= canal.instance.master.timestamp= canal.instance.master.gtid= diff --git a/docker/var/lib/mysql/.gitignore b/docker/var/lib/mysql/.gitignore deleted file mode 100644 index 3e759b7..0000000 --- a/docker/var/lib/mysql/.gitignore +++ /dev/null @@ -1,330 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ -**/Properties/launchSettings.json - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ diff --git a/go.mod b/go.mod index 2a06d4a..4972ee5 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,10 @@ -module github.com/CanalClient/canal-go +module github.com/withlin/canal-go require ( - github.com/golang/protobuf v1.2.0 - github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec + github.com/go-zookeeper/zk v1.0.3 + google.golang.org/protobuf v1.33.0 ) + +require github.com/google/go-cmp v0.6.0 // indirect + +go 1.21 diff --git a/go.sum b/go.sum index 261c866..f465bfb 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,6 @@ -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec h1:6ncX5ko6B9LntYM0YBRXkiSaZMmLYeZ/NWcmeB43mMY= -github.com/samuel/go-zookeeper v0.0.0-20180130194729-c4fab1ac1bec/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E= +github.com/go-zookeeper/zk v1.0.3 h1:7M2kwOsc//9VeeFiPtf+uSJlVpU66x9Ba5+8XK7/TDg= +github.com/go-zookeeper/zk v1.0.3/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= +google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= diff --git a/protocol/CanalProtocol.pb.go b/protocol/CanalProtocol.pb.go deleted file mode 100644 index 3e60012..0000000 --- a/protocol/CanalProtocol.pb.go +++ /dev/null @@ -1,4481 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: CanalProtocol.proto - -package com_alibaba_otter_canal_protocol - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type Compression int32 - -const ( - Compression_COMPRESSIONCOMPATIBLEPROTO2 Compression = 0 - Compression_NONE Compression = 1 - Compression_ZLIB Compression = 2 - Compression_GZIP Compression = 3 - Compression_LZF Compression = 4 -) - -var Compression_name = map[int32]string{ - 0: "COMPRESSIONCOMPATIBLEPROTO2", - 1: "NONE", - 2: "ZLIB", - 3: "GZIP", - 4: "LZF", -} -var Compression_value = map[string]int32{ - "COMPRESSIONCOMPATIBLEPROTO2": 0, - "NONE": 1, - "ZLIB": 2, - "GZIP": 3, - "LZF": 4, -} - -func (x Compression) String() string { - return proto.EnumName(Compression_name, int32(x)) -} -func (Compression) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{0} -} - -type PacketType int32 - -const ( - // compatible - PacketType_PACKAGETYPECOMPATIBLEPROTO2 PacketType = 0 - PacketType_HANDSHAKE PacketType = 1 - PacketType_CLIENTAUTHENTICATION PacketType = 2 - PacketType_ACK PacketType = 3 - PacketType_SUBSCRIPTION PacketType = 4 - PacketType_UNSUBSCRIPTION PacketType = 5 - PacketType_GET PacketType = 6 - PacketType_MESSAGES PacketType = 7 - PacketType_CLIENTACK PacketType = 8 - // management part - PacketType_SHUTDOWN PacketType = 9 - // integration - PacketType_DUMP PacketType = 10 - PacketType_HEARTBEAT PacketType = 11 - PacketType_CLIENTROLLBACK PacketType = 12 -) - -var PacketType_name = map[int32]string{ - 0: "PACKAGETYPECOMPATIBLEPROTO2", - 1: "HANDSHAKE", - 2: "CLIENTAUTHENTICATION", - 3: "ACK", - 4: "SUBSCRIPTION", - 5: "UNSUBSCRIPTION", - 6: "GET", - 7: "MESSAGES", - 8: "CLIENTACK", - 9: "SHUTDOWN", - 10: "DUMP", - 11: "HEARTBEAT", - 12: "CLIENTROLLBACK", -} -var PacketType_value = map[string]int32{ - "PACKAGETYPECOMPATIBLEPROTO2": 0, - "HANDSHAKE": 1, - "CLIENTAUTHENTICATION": 2, - "ACK": 3, - "SUBSCRIPTION": 4, - "UNSUBSCRIPTION": 5, - "GET": 6, - "MESSAGES": 7, - "CLIENTACK": 8, - "SHUTDOWN": 9, - "DUMP": 10, - "HEARTBEAT": 11, - "CLIENTROLLBACK": 12, -} - -func (x PacketType) String() string { - return proto.EnumName(PacketType_name, int32(x)) -} -func (PacketType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{1} -} - -type Packet struct { - // [default = 17]; - // - // Types that are valid to be assigned to MagicNumberPresent: - // *Packet_MagicNumber - MagicNumberPresent isPacket_MagicNumberPresent `protobuf_oneof:"magic_number_present"` - // [default = 1]; - // - // Types that are valid to be assigned to VersionPresent: - // *Packet_Version - VersionPresent isPacket_VersionPresent `protobuf_oneof:"version_present"` - Type PacketType `protobuf:"varint,3,opt,name=type,proto3,enum=com.alibaba.otter.canal.protocol.PacketType" json:"type,omitempty"` - // [default = NONE]; - // - // Types that are valid to be assigned to CompressionPresent: - // *Packet_Compression - CompressionPresent isPacket_CompressionPresent `protobuf_oneof:"compression_present"` - Body []byte `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Packet) Reset() { *m = Packet{} } -func (m *Packet) String() string { return proto.CompactTextString(m) } -func (*Packet) ProtoMessage() {} -func (*Packet) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{0} -} -func (m *Packet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Packet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Packet.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Packet) XXX_Merge(src proto.Message) { - xxx_messageInfo_Packet.Merge(dst, src) -} -func (m *Packet) XXX_Size() int { - return m.Size() -} -func (m *Packet) XXX_DiscardUnknown() { - xxx_messageInfo_Packet.DiscardUnknown(m) -} - -var xxx_messageInfo_Packet proto.InternalMessageInfo - -type isPacket_MagicNumberPresent interface { - isPacket_MagicNumberPresent() - MarshalTo([]byte) (int, error) - Size() int -} -type isPacket_VersionPresent interface { - isPacket_VersionPresent() - MarshalTo([]byte) (int, error) - Size() int -} -type isPacket_CompressionPresent interface { - isPacket_CompressionPresent() - MarshalTo([]byte) (int, error) - Size() int -} - -type Packet_MagicNumber struct { - MagicNumber int32 `protobuf:"varint,1,opt,name=magic_number,json=magicNumber,proto3,oneof"` -} -type Packet_Version struct { - Version int32 `protobuf:"varint,2,opt,name=version,proto3,oneof"` -} -type Packet_Compression struct { - Compression Compression `protobuf:"varint,4,opt,name=compression,proto3,enum=com.alibaba.otter.canal.protocol.Compression,oneof"` -} - -func (*Packet_MagicNumber) isPacket_MagicNumberPresent() {} -func (*Packet_Version) isPacket_VersionPresent() {} -func (*Packet_Compression) isPacket_CompressionPresent() {} - -func (m *Packet) GetMagicNumberPresent() isPacket_MagicNumberPresent { - if m != nil { - return m.MagicNumberPresent - } - return nil -} -func (m *Packet) GetVersionPresent() isPacket_VersionPresent { - if m != nil { - return m.VersionPresent - } - return nil -} -func (m *Packet) GetCompressionPresent() isPacket_CompressionPresent { - if m != nil { - return m.CompressionPresent - } - return nil -} - -func (m *Packet) GetMagicNumber() int32 { - if x, ok := m.GetMagicNumberPresent().(*Packet_MagicNumber); ok { - return x.MagicNumber - } - return 17 -} - -func (m *Packet) GetVersion() int32 { - if x, ok := m.GetVersionPresent().(*Packet_Version); ok { - return x.Version - } - return 1 -} - -func (m *Packet) GetType() PacketType { - if m != nil { - return m.Type - } - return PacketType_PACKAGETYPECOMPATIBLEPROTO2 -} - -func (m *Packet) GetCompression() Compression { - if x, ok := m.GetCompressionPresent().(*Packet_Compression); ok { - return x.Compression - } - return Compression_NONE -} - -func (m *Packet) GetBody() []byte { - if m != nil { - return m.Body - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Packet) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Packet_OneofMarshaler, _Packet_OneofUnmarshaler, _Packet_OneofSizer, []interface{}{ - (*Packet_MagicNumber)(nil), - (*Packet_Version)(nil), - (*Packet_Compression)(nil), - } -} - -func _Packet_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Packet) - // magic_number_present - switch x := m.MagicNumberPresent.(type) { - case *Packet_MagicNumber: - _ = b.EncodeVarint(1<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.MagicNumber)) - case nil: - default: - return fmt.Errorf("Packet.MagicNumberPresent has unexpected type %T", x) - } - // version_present - switch x := m.VersionPresent.(type) { - case *Packet_Version: - _ = b.EncodeVarint(2<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.Version)) - case nil: - default: - return fmt.Errorf("Packet.VersionPresent has unexpected type %T", x) - } - // compression_present - switch x := m.CompressionPresent.(type) { - case *Packet_Compression: - _ = b.EncodeVarint(4<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.Compression)) - case nil: - default: - return fmt.Errorf("Packet.CompressionPresent has unexpected type %T", x) - } - return nil -} - -func _Packet_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Packet) - switch tag { - case 1: // magic_number_present.magic_number - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.MagicNumberPresent = &Packet_MagicNumber{int32(x)} - return true, err - case 2: // version_present.version - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.VersionPresent = &Packet_Version{int32(x)} - return true, err - case 4: // compression_present.compression - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.CompressionPresent = &Packet_Compression{Compression(x)} - return true, err - default: - return false, nil - } -} - -func _Packet_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Packet) - // magic_number_present - switch x := m.MagicNumberPresent.(type) { - case *Packet_MagicNumber: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.MagicNumber)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // version_present - switch x := m.VersionPresent.(type) { - case *Packet_Version: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Version)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // compression_present - switch x := m.CompressionPresent.(type) { - case *Packet_Compression: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Compression)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type HeartBeat struct { - SendTimestamp int64 `protobuf:"varint,1,opt,name=send_timestamp,json=sendTimestamp,proto3" json:"send_timestamp,omitempty"` - StartTimestamp int64 `protobuf:"varint,2,opt,name=start_timestamp,json=startTimestamp,proto3" json:"start_timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *HeartBeat) Reset() { *m = HeartBeat{} } -func (m *HeartBeat) String() string { return proto.CompactTextString(m) } -func (*HeartBeat) ProtoMessage() {} -func (*HeartBeat) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{1} -} -func (m *HeartBeat) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *HeartBeat) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_HeartBeat.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *HeartBeat) XXX_Merge(src proto.Message) { - xxx_messageInfo_HeartBeat.Merge(dst, src) -} -func (m *HeartBeat) XXX_Size() int { - return m.Size() -} -func (m *HeartBeat) XXX_DiscardUnknown() { - xxx_messageInfo_HeartBeat.DiscardUnknown(m) -} - -var xxx_messageInfo_HeartBeat proto.InternalMessageInfo - -func (m *HeartBeat) GetSendTimestamp() int64 { - if m != nil { - return m.SendTimestamp - } - return 0 -} - -func (m *HeartBeat) GetStartTimestamp() int64 { - if m != nil { - return m.StartTimestamp - } - return 0 -} - -type Handshake struct { - // [default = "utf8"]; - // - // Types that are valid to be assigned to CommunicationEncodingPresent: - // *Handshake_CommunicationEncoding - CommunicationEncodingPresent isHandshake_CommunicationEncodingPresent `protobuf_oneof:"communication_encoding_present"` - Seeds []byte `protobuf:"bytes,2,opt,name=seeds,proto3" json:"seeds,omitempty"` - SupportedCompressions Compression `protobuf:"varint,3,opt,name=supported_compressions,json=supportedCompressions,proto3,enum=com.alibaba.otter.canal.protocol.Compression" json:"supported_compressions,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Handshake) Reset() { *m = Handshake{} } -func (m *Handshake) String() string { return proto.CompactTextString(m) } -func (*Handshake) ProtoMessage() {} -func (*Handshake) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{2} -} -func (m *Handshake) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Handshake) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Handshake.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Handshake) XXX_Merge(src proto.Message) { - xxx_messageInfo_Handshake.Merge(dst, src) -} -func (m *Handshake) XXX_Size() int { - return m.Size() -} -func (m *Handshake) XXX_DiscardUnknown() { - xxx_messageInfo_Handshake.DiscardUnknown(m) -} - -var xxx_messageInfo_Handshake proto.InternalMessageInfo - -type isHandshake_CommunicationEncodingPresent interface { - isHandshake_CommunicationEncodingPresent() - MarshalTo([]byte) (int, error) - Size() int -} - -type Handshake_CommunicationEncoding struct { - CommunicationEncoding string `protobuf:"bytes,1,opt,name=communication_encoding,json=communicationEncoding,proto3,oneof"` -} - -func (*Handshake_CommunicationEncoding) isHandshake_CommunicationEncodingPresent() {} - -func (m *Handshake) GetCommunicationEncodingPresent() isHandshake_CommunicationEncodingPresent { - if m != nil { - return m.CommunicationEncodingPresent - } - return nil -} - -func (m *Handshake) GetCommunicationEncoding() string { - if x, ok := m.GetCommunicationEncodingPresent().(*Handshake_CommunicationEncoding); ok { - return x.CommunicationEncoding - } - return "" -} - -func (m *Handshake) GetSeeds() []byte { - if m != nil { - return m.Seeds - } - return nil -} - -func (m *Handshake) GetSupportedCompressions() Compression { - if m != nil { - return m.SupportedCompressions - } - return Compression_COMPRESSIONCOMPATIBLEPROTO2 -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Handshake) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Handshake_OneofMarshaler, _Handshake_OneofUnmarshaler, _Handshake_OneofSizer, []interface{}{ - (*Handshake_CommunicationEncoding)(nil), - } -} - -func _Handshake_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Handshake) - // communication_encoding_present - switch x := m.CommunicationEncodingPresent.(type) { - case *Handshake_CommunicationEncoding: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - _ = b.EncodeStringBytes(x.CommunicationEncoding) - case nil: - default: - return fmt.Errorf("Handshake.CommunicationEncodingPresent has unexpected type %T", x) - } - return nil -} - -func _Handshake_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Handshake) - switch tag { - case 1: // communication_encoding_present.communication_encoding - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeStringBytes() - m.CommunicationEncodingPresent = &Handshake_CommunicationEncoding{x} - return true, err - default: - return false, nil - } -} - -func _Handshake_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Handshake) - // communication_encoding_present - switch x := m.CommunicationEncodingPresent.(type) { - case *Handshake_CommunicationEncoding: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(len(x.CommunicationEncoding))) - n += len(x.CommunicationEncoding) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// client authentication -type ClientAuth struct { - Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` - Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` - // [default = 0] - // - // Types that are valid to be assigned to NetReadTimeoutPresent: - // *ClientAuth_NetReadTimeout - NetReadTimeoutPresent isClientAuth_NetReadTimeoutPresent `protobuf_oneof:"net_read_timeout_present"` - // [default = 0]; - // - // Types that are valid to be assigned to NetWriteTimeoutPresent: - // *ClientAuth_NetWriteTimeout - NetWriteTimeoutPresent isClientAuth_NetWriteTimeoutPresent `protobuf_oneof:"net_write_timeout_present"` - Destination string `protobuf:"bytes,5,opt,name=destination,proto3" json:"destination,omitempty"` - ClientId string `protobuf:"bytes,6,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - Filter string `protobuf:"bytes,7,opt,name=filter,proto3" json:"filter,omitempty"` - StartTimestamp int64 `protobuf:"varint,8,opt,name=start_timestamp,json=startTimestamp,proto3" json:"start_timestamp,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ClientAuth) Reset() { *m = ClientAuth{} } -func (m *ClientAuth) String() string { return proto.CompactTextString(m) } -func (*ClientAuth) ProtoMessage() {} -func (*ClientAuth) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{3} -} -func (m *ClientAuth) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClientAuth) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClientAuth.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *ClientAuth) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientAuth.Merge(dst, src) -} -func (m *ClientAuth) XXX_Size() int { - return m.Size() -} -func (m *ClientAuth) XXX_DiscardUnknown() { - xxx_messageInfo_ClientAuth.DiscardUnknown(m) -} - -var xxx_messageInfo_ClientAuth proto.InternalMessageInfo - -type isClientAuth_NetReadTimeoutPresent interface { - isClientAuth_NetReadTimeoutPresent() - MarshalTo([]byte) (int, error) - Size() int -} -type isClientAuth_NetWriteTimeoutPresent interface { - isClientAuth_NetWriteTimeoutPresent() - MarshalTo([]byte) (int, error) - Size() int -} - -type ClientAuth_NetReadTimeout struct { - NetReadTimeout int32 `protobuf:"varint,3,opt,name=net_read_timeout,json=netReadTimeout,proto3,oneof"` -} -type ClientAuth_NetWriteTimeout struct { - NetWriteTimeout int32 `protobuf:"varint,4,opt,name=net_write_timeout,json=netWriteTimeout,proto3,oneof"` -} - -func (*ClientAuth_NetReadTimeout) isClientAuth_NetReadTimeoutPresent() {} -func (*ClientAuth_NetWriteTimeout) isClientAuth_NetWriteTimeoutPresent() {} - -func (m *ClientAuth) GetNetReadTimeoutPresent() isClientAuth_NetReadTimeoutPresent { - if m != nil { - return m.NetReadTimeoutPresent - } - return nil -} -func (m *ClientAuth) GetNetWriteTimeoutPresent() isClientAuth_NetWriteTimeoutPresent { - if m != nil { - return m.NetWriteTimeoutPresent - } - return nil -} - -func (m *ClientAuth) GetUsername() string { - if m != nil { - return m.Username - } - return "" -} - -func (m *ClientAuth) GetPassword() []byte { - if m != nil { - return m.Password - } - return nil -} - -func (m *ClientAuth) GetNetReadTimeout() int32 { - if x, ok := m.GetNetReadTimeoutPresent().(*ClientAuth_NetReadTimeout); ok { - return x.NetReadTimeout - } - return 0 -} - -func (m *ClientAuth) GetNetWriteTimeout() int32 { - if x, ok := m.GetNetWriteTimeoutPresent().(*ClientAuth_NetWriteTimeout); ok { - return x.NetWriteTimeout - } - return 0 -} - -func (m *ClientAuth) GetDestination() string { - if m != nil { - return m.Destination - } - return "" -} - -func (m *ClientAuth) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *ClientAuth) GetFilter() string { - if m != nil { - return m.Filter - } - return "" -} - -func (m *ClientAuth) GetStartTimestamp() int64 { - if m != nil { - return m.StartTimestamp - } - return 0 -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*ClientAuth) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _ClientAuth_OneofMarshaler, _ClientAuth_OneofUnmarshaler, _ClientAuth_OneofSizer, []interface{}{ - (*ClientAuth_NetReadTimeout)(nil), - (*ClientAuth_NetWriteTimeout)(nil), - } -} - -func _ClientAuth_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*ClientAuth) - // net_read_timeout_present - switch x := m.NetReadTimeoutPresent.(type) { - case *ClientAuth_NetReadTimeout: - _ = b.EncodeVarint(3<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.NetReadTimeout)) - case nil: - default: - return fmt.Errorf("ClientAuth.NetReadTimeoutPresent has unexpected type %T", x) - } - // net_write_timeout_present - switch x := m.NetWriteTimeoutPresent.(type) { - case *ClientAuth_NetWriteTimeout: - _ = b.EncodeVarint(4<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.NetWriteTimeout)) - case nil: - default: - return fmt.Errorf("ClientAuth.NetWriteTimeoutPresent has unexpected type %T", x) - } - return nil -} - -func _ClientAuth_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*ClientAuth) - switch tag { - case 3: // net_read_timeout_present.net_read_timeout - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.NetReadTimeoutPresent = &ClientAuth_NetReadTimeout{int32(x)} - return true, err - case 4: // net_write_timeout_present.net_write_timeout - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.NetWriteTimeoutPresent = &ClientAuth_NetWriteTimeout{int32(x)} - return true, err - default: - return false, nil - } -} - -func _ClientAuth_OneofSizer(msg proto.Message) (n int) { - m := msg.(*ClientAuth) - // net_read_timeout_present - switch x := m.NetReadTimeoutPresent.(type) { - case *ClientAuth_NetReadTimeout: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.NetReadTimeout)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // net_write_timeout_present - switch x := m.NetWriteTimeoutPresent.(type) { - case *ClientAuth_NetWriteTimeout: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.NetWriteTimeout)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type Ack struct { - // [default = 0] - // - // Types that are valid to be assigned to ErrorCodePresent: - // *Ack_ErrorCode - ErrorCodePresent isAck_ErrorCodePresent `protobuf_oneof:"error_code_present"` - ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Ack) Reset() { *m = Ack{} } -func (m *Ack) String() string { return proto.CompactTextString(m) } -func (*Ack) ProtoMessage() {} -func (*Ack) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{4} -} -func (m *Ack) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Ack) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Ack.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Ack) XXX_Merge(src proto.Message) { - xxx_messageInfo_Ack.Merge(dst, src) -} -func (m *Ack) XXX_Size() int { - return m.Size() -} -func (m *Ack) XXX_DiscardUnknown() { - xxx_messageInfo_Ack.DiscardUnknown(m) -} - -var xxx_messageInfo_Ack proto.InternalMessageInfo - -type isAck_ErrorCodePresent interface { - isAck_ErrorCodePresent() - MarshalTo([]byte) (int, error) - Size() int -} - -type Ack_ErrorCode struct { - ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3,oneof"` -} - -func (*Ack_ErrorCode) isAck_ErrorCodePresent() {} - -func (m *Ack) GetErrorCodePresent() isAck_ErrorCodePresent { - if m != nil { - return m.ErrorCodePresent - } - return nil -} - -func (m *Ack) GetErrorCode() int32 { - if x, ok := m.GetErrorCodePresent().(*Ack_ErrorCode); ok { - return x.ErrorCode - } - return 0 -} - -func (m *Ack) GetErrorMessage() string { - if m != nil { - return m.ErrorMessage - } - return "" -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Ack) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Ack_OneofMarshaler, _Ack_OneofUnmarshaler, _Ack_OneofSizer, []interface{}{ - (*Ack_ErrorCode)(nil), - } -} - -func _Ack_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Ack) - // error_code_present - switch x := m.ErrorCodePresent.(type) { - case *Ack_ErrorCode: - _ = b.EncodeVarint(1<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.ErrorCode)) - case nil: - default: - return fmt.Errorf("Ack.ErrorCodePresent has unexpected type %T", x) - } - return nil -} - -func _Ack_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Ack) - switch tag { - case 1: // error_code_present.error_code - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.ErrorCodePresent = &Ack_ErrorCode{int32(x)} - return true, err - default: - return false, nil - } -} - -func _Ack_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Ack) - // error_code_present - switch x := m.ErrorCodePresent.(type) { - case *Ack_ErrorCode: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.ErrorCode)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type ClientAck struct { - Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` - ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - BatchId int64 `protobuf:"varint,3,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ClientAck) Reset() { *m = ClientAck{} } -func (m *ClientAck) String() string { return proto.CompactTextString(m) } -func (*ClientAck) ProtoMessage() {} -func (*ClientAck) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{5} -} -func (m *ClientAck) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClientAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClientAck.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *ClientAck) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientAck.Merge(dst, src) -} -func (m *ClientAck) XXX_Size() int { - return m.Size() -} -func (m *ClientAck) XXX_DiscardUnknown() { - xxx_messageInfo_ClientAck.DiscardUnknown(m) -} - -var xxx_messageInfo_ClientAck proto.InternalMessageInfo - -func (m *ClientAck) GetDestination() string { - if m != nil { - return m.Destination - } - return "" -} - -func (m *ClientAck) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *ClientAck) GetBatchId() int64 { - if m != nil { - return m.BatchId - } - return 0 -} - -// subscription -type Sub struct { - Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` - ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - Filter string `protobuf:"bytes,7,opt,name=filter,proto3" json:"filter,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Sub) Reset() { *m = Sub{} } -func (m *Sub) String() string { return proto.CompactTextString(m) } -func (*Sub) ProtoMessage() {} -func (*Sub) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{6} -} -func (m *Sub) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Sub) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Sub.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Sub) XXX_Merge(src proto.Message) { - xxx_messageInfo_Sub.Merge(dst, src) -} -func (m *Sub) XXX_Size() int { - return m.Size() -} -func (m *Sub) XXX_DiscardUnknown() { - xxx_messageInfo_Sub.DiscardUnknown(m) -} - -var xxx_messageInfo_Sub proto.InternalMessageInfo - -func (m *Sub) GetDestination() string { - if m != nil { - return m.Destination - } - return "" -} - -func (m *Sub) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *Sub) GetFilter() string { - if m != nil { - return m.Filter - } - return "" -} - -// Unsubscription -type Unsub struct { - Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` - ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - Filter string `protobuf:"bytes,7,opt,name=filter,proto3" json:"filter,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Unsub) Reset() { *m = Unsub{} } -func (m *Unsub) String() string { return proto.CompactTextString(m) } -func (*Unsub) ProtoMessage() {} -func (*Unsub) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{7} -} -func (m *Unsub) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Unsub) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Unsub.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Unsub) XXX_Merge(src proto.Message) { - xxx_messageInfo_Unsub.Merge(dst, src) -} -func (m *Unsub) XXX_Size() int { - return m.Size() -} -func (m *Unsub) XXX_DiscardUnknown() { - xxx_messageInfo_Unsub.DiscardUnknown(m) -} - -var xxx_messageInfo_Unsub proto.InternalMessageInfo - -func (m *Unsub) GetDestination() string { - if m != nil { - return m.Destination - } - return "" -} - -func (m *Unsub) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *Unsub) GetFilter() string { - if m != nil { - return m.Filter - } - return "" -} - -// PullRequest -type Get struct { - Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` - ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - FetchSize int32 `protobuf:"varint,3,opt,name=fetch_size,json=fetchSize,proto3" json:"fetch_size,omitempty"` - // [default = -1] - // - // Types that are valid to be assigned to TimeoutPresent: - // *Get_Timeout - TimeoutPresent isGet_TimeoutPresent `protobuf_oneof:"timeout_present"` - // [default = 2] - // - // Types that are valid to be assigned to UnitPresent: - // *Get_Unit - UnitPresent isGet_UnitPresent `protobuf_oneof:"unit_present"` - // [default = false] - // - // Types that are valid to be assigned to AutoAckPresent: - // *Get_AutoAck - AutoAckPresent isGet_AutoAckPresent `protobuf_oneof:"auto_ack_present"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Get) Reset() { *m = Get{} } -func (m *Get) String() string { return proto.CompactTextString(m) } -func (*Get) ProtoMessage() {} -func (*Get) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{8} -} -func (m *Get) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Get) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Get.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Get) XXX_Merge(src proto.Message) { - xxx_messageInfo_Get.Merge(dst, src) -} -func (m *Get) XXX_Size() int { - return m.Size() -} -func (m *Get) XXX_DiscardUnknown() { - xxx_messageInfo_Get.DiscardUnknown(m) -} - -var xxx_messageInfo_Get proto.InternalMessageInfo - -type isGet_TimeoutPresent interface { - isGet_TimeoutPresent() - MarshalTo([]byte) (int, error) - Size() int -} -type isGet_UnitPresent interface { - isGet_UnitPresent() - MarshalTo([]byte) (int, error) - Size() int -} -type isGet_AutoAckPresent interface { - isGet_AutoAckPresent() - MarshalTo([]byte) (int, error) - Size() int -} - -type Get_Timeout struct { - Timeout int64 `protobuf:"varint,4,opt,name=timeout,proto3,oneof"` -} -type Get_Unit struct { - Unit int32 `protobuf:"varint,5,opt,name=unit,proto3,oneof"` -} -type Get_AutoAck struct { - AutoAck bool `protobuf:"varint,6,opt,name=auto_ack,json=autoAck,proto3,oneof"` -} - -func (*Get_Timeout) isGet_TimeoutPresent() {} -func (*Get_Unit) isGet_UnitPresent() {} -func (*Get_AutoAck) isGet_AutoAckPresent() {} - -func (m *Get) GetTimeoutPresent() isGet_TimeoutPresent { - if m != nil { - return m.TimeoutPresent - } - return nil -} -func (m *Get) GetUnitPresent() isGet_UnitPresent { - if m != nil { - return m.UnitPresent - } - return nil -} -func (m *Get) GetAutoAckPresent() isGet_AutoAckPresent { - if m != nil { - return m.AutoAckPresent - } - return nil -} - -func (m *Get) GetDestination() string { - if m != nil { - return m.Destination - } - return "" -} - -func (m *Get) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *Get) GetFetchSize() int32 { - if m != nil { - return m.FetchSize - } - return 0 -} - -func (m *Get) GetTimeout() int64 { - if x, ok := m.GetTimeoutPresent().(*Get_Timeout); ok { - return x.Timeout - } - return -1 -} - -func (m *Get) GetUnit() int32 { - if x, ok := m.GetUnitPresent().(*Get_Unit); ok { - return x.Unit - } - return 2 -} - -func (m *Get) GetAutoAck() bool { - if x, ok := m.GetAutoAckPresent().(*Get_AutoAck); ok { - return x.AutoAck - } - return false -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Get) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Get_OneofMarshaler, _Get_OneofUnmarshaler, _Get_OneofSizer, []interface{}{ - (*Get_Timeout)(nil), - (*Get_Unit)(nil), - (*Get_AutoAck)(nil), - } -} - -func _Get_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Get) - // timeout_present - switch x := m.TimeoutPresent.(type) { - case *Get_Timeout: - _ = b.EncodeVarint(4<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.Timeout)) - case nil: - default: - return fmt.Errorf("Get.TimeoutPresent has unexpected type %T", x) - } - // unit_present - switch x := m.UnitPresent.(type) { - case *Get_Unit: - _ = b.EncodeVarint(5<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.Unit)) - case nil: - default: - return fmt.Errorf("Get.UnitPresent has unexpected type %T", x) - } - // auto_ack_present - switch x := m.AutoAckPresent.(type) { - case *Get_AutoAck: - t := uint64(0) - if x.AutoAck { - t = 1 - } - _ = b.EncodeVarint(6<<3 | proto.WireVarint) - _ = b.EncodeVarint(t) - case nil: - default: - return fmt.Errorf("Get.AutoAckPresent has unexpected type %T", x) - } - return nil -} - -func _Get_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Get) - switch tag { - case 4: // timeout_present.timeout - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.TimeoutPresent = &Get_Timeout{int64(x)} - return true, err - case 5: // unit_present.unit - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.UnitPresent = &Get_Unit{int32(x)} - return true, err - case 6: // auto_ack_present.auto_ack - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.AutoAckPresent = &Get_AutoAck{x != 0} - return true, err - default: - return false, nil - } -} - -func _Get_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Get) - // timeout_present - switch x := m.TimeoutPresent.(type) { - case *Get_Timeout: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Timeout)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // unit_present - switch x := m.UnitPresent.(type) { - case *Get_Unit: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Unit)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // auto_ack_present - switch x := m.AutoAckPresent.(type) { - case *Get_AutoAck: - n += 1 // tag and wire - n += 1 - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// -type Messages struct { - BatchId int64 `protobuf:"varint,1,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` - Messages [][]byte `protobuf:"bytes,2,rep,name=messages" json:"messages,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Messages) Reset() { *m = Messages{} } -func (m *Messages) String() string { return proto.CompactTextString(m) } -func (*Messages) ProtoMessage() {} -func (*Messages) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{9} -} -func (m *Messages) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Messages) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Messages.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Messages) XXX_Merge(src proto.Message) { - xxx_messageInfo_Messages.Merge(dst, src) -} -func (m *Messages) XXX_Size() int { - return m.Size() -} -func (m *Messages) XXX_DiscardUnknown() { - xxx_messageInfo_Messages.DiscardUnknown(m) -} - -var xxx_messageInfo_Messages proto.InternalMessageInfo - -func (m *Messages) GetBatchId() int64 { - if m != nil { - return m.BatchId - } - return 0 -} - -func (m *Messages) GetMessages() [][]byte { - if m != nil { - return m.Messages - } - return nil -} - -// TBD when new packets are required -type Dump struct { - Journal string `protobuf:"bytes,1,opt,name=journal,proto3" json:"journal,omitempty"` - Position int64 `protobuf:"varint,2,opt,name=position,proto3" json:"position,omitempty"` - // [default = 0] - // - // Types that are valid to be assigned to TimestampPresent: - // *Dump_Timestamp - TimestampPresent isDump_TimestampPresent `protobuf_oneof:"timestamp_present"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Dump) Reset() { *m = Dump{} } -func (m *Dump) String() string { return proto.CompactTextString(m) } -func (*Dump) ProtoMessage() {} -func (*Dump) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{10} -} -func (m *Dump) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Dump) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Dump.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Dump) XXX_Merge(src proto.Message) { - xxx_messageInfo_Dump.Merge(dst, src) -} -func (m *Dump) XXX_Size() int { - return m.Size() -} -func (m *Dump) XXX_DiscardUnknown() { - xxx_messageInfo_Dump.DiscardUnknown(m) -} - -var xxx_messageInfo_Dump proto.InternalMessageInfo - -type isDump_TimestampPresent interface { - isDump_TimestampPresent() - MarshalTo([]byte) (int, error) - Size() int -} - -type Dump_Timestamp struct { - Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3,oneof"` -} - -func (*Dump_Timestamp) isDump_TimestampPresent() {} - -func (m *Dump) GetTimestampPresent() isDump_TimestampPresent { - if m != nil { - return m.TimestampPresent - } - return nil -} - -func (m *Dump) GetJournal() string { - if m != nil { - return m.Journal - } - return "" -} - -func (m *Dump) GetPosition() int64 { - if m != nil { - return m.Position - } - return 0 -} - -func (m *Dump) GetTimestamp() int64 { - if x, ok := m.GetTimestampPresent().(*Dump_Timestamp); ok { - return x.Timestamp - } - return 0 -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Dump) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Dump_OneofMarshaler, _Dump_OneofUnmarshaler, _Dump_OneofSizer, []interface{}{ - (*Dump_Timestamp)(nil), - } -} - -func _Dump_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Dump) - // timestamp_present - switch x := m.TimestampPresent.(type) { - case *Dump_Timestamp: - _ = b.EncodeVarint(3<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.Timestamp)) - case nil: - default: - return fmt.Errorf("Dump.TimestampPresent has unexpected type %T", x) - } - return nil -} - -func _Dump_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Dump) - switch tag { - case 3: // timestamp_present.timestamp - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.TimestampPresent = &Dump_Timestamp{int64(x)} - return true, err - default: - return false, nil - } -} - -func _Dump_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Dump) - // timestamp_present - switch x := m.TimestampPresent.(type) { - case *Dump_Timestamp: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Timestamp)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type ClientRollback struct { - Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` - ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` - BatchId int64 `protobuf:"varint,3,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *ClientRollback) Reset() { *m = ClientRollback{} } -func (m *ClientRollback) String() string { return proto.CompactTextString(m) } -func (*ClientRollback) ProtoMessage() {} -func (*ClientRollback) Descriptor() ([]byte, []int) { - return fileDescriptor_CanalProtocol_79f46d6f01bc36e7, []int{11} -} -func (m *ClientRollback) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ClientRollback) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClientRollback.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *ClientRollback) XXX_Merge(src proto.Message) { - xxx_messageInfo_ClientRollback.Merge(dst, src) -} -func (m *ClientRollback) XXX_Size() int { - return m.Size() -} -func (m *ClientRollback) XXX_DiscardUnknown() { - xxx_messageInfo_ClientRollback.DiscardUnknown(m) -} - -var xxx_messageInfo_ClientRollback proto.InternalMessageInfo - -func (m *ClientRollback) GetDestination() string { - if m != nil { - return m.Destination - } - return "" -} - -func (m *ClientRollback) GetClientId() string { - if m != nil { - return m.ClientId - } - return "" -} - -func (m *ClientRollback) GetBatchId() int64 { - if m != nil { - return m.BatchId - } - return 0 -} - -func init() { - proto.RegisterType((*Packet)(nil), "com.alibaba.otter.canal.protocol.Packet") - proto.RegisterType((*HeartBeat)(nil), "com.alibaba.otter.canal.protocol.HeartBeat") - proto.RegisterType((*Handshake)(nil), "com.alibaba.otter.canal.protocol.Handshake") - proto.RegisterType((*ClientAuth)(nil), "com.alibaba.otter.canal.protocol.ClientAuth") - proto.RegisterType((*Ack)(nil), "com.alibaba.otter.canal.protocol.Ack") - proto.RegisterType((*ClientAck)(nil), "com.alibaba.otter.canal.protocol.ClientAck") - proto.RegisterType((*Sub)(nil), "com.alibaba.otter.canal.protocol.Sub") - proto.RegisterType((*Unsub)(nil), "com.alibaba.otter.canal.protocol.Unsub") - proto.RegisterType((*Get)(nil), "com.alibaba.otter.canal.protocol.Get") - proto.RegisterType((*Messages)(nil), "com.alibaba.otter.canal.protocol.Messages") - proto.RegisterType((*Dump)(nil), "com.alibaba.otter.canal.protocol.Dump") - proto.RegisterType((*ClientRollback)(nil), "com.alibaba.otter.canal.protocol.ClientRollback") - proto.RegisterEnum("com.alibaba.otter.canal.protocol.Compression", Compression_name, Compression_value) - proto.RegisterEnum("com.alibaba.otter.canal.protocol.PacketType", PacketType_name, PacketType_value) -} -func (m *Packet) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Packet) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.MagicNumberPresent != nil { - nn1, err := m.MagicNumberPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn1 - } - if m.VersionPresent != nil { - nn2, err := m.VersionPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn2 - } - if m.Type != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.Type)) - } - if m.CompressionPresent != nil { - nn3, err := m.CompressionPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn3 - } - if len(m.Body) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Body))) - i += copy(dAtA[i:], m.Body) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Packet_MagicNumber) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x8 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.MagicNumber)) - return i, nil -} -func (m *Packet_Version) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x10 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.Version)) - return i, nil -} -func (m *Packet_Compression) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x20 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.Compression)) - return i, nil -} -func (m *HeartBeat) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *HeartBeat) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.SendTimestamp != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.SendTimestamp)) - } - if m.StartTimestamp != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.StartTimestamp)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Handshake) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Handshake) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.CommunicationEncodingPresent != nil { - nn4, err := m.CommunicationEncodingPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn4 - } - if len(m.Seeds) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Seeds))) - i += copy(dAtA[i:], m.Seeds) - } - if m.SupportedCompressions != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.SupportedCompressions)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Handshake_CommunicationEncoding) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0xa - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.CommunicationEncoding))) - i += copy(dAtA[i:], m.CommunicationEncoding) - return i, nil -} -func (m *ClientAuth) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClientAuth) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Username) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Username))) - i += copy(dAtA[i:], m.Username) - } - if len(m.Password) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Password))) - i += copy(dAtA[i:], m.Password) - } - if m.NetReadTimeoutPresent != nil { - nn5, err := m.NetReadTimeoutPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn5 - } - if m.NetWriteTimeoutPresent != nil { - nn6, err := m.NetWriteTimeoutPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn6 - } - if len(m.Destination) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Destination))) - i += copy(dAtA[i:], m.Destination) - } - if len(m.ClientId) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.ClientId))) - i += copy(dAtA[i:], m.ClientId) - } - if len(m.Filter) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Filter))) - i += copy(dAtA[i:], m.Filter) - } - if m.StartTimestamp != 0 { - dAtA[i] = 0x40 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.StartTimestamp)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ClientAuth_NetReadTimeout) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x18 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.NetReadTimeout)) - return i, nil -} -func (m *ClientAuth_NetWriteTimeout) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x20 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.NetWriteTimeout)) - return i, nil -} -func (m *Ack) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Ack) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.ErrorCodePresent != nil { - nn7, err := m.ErrorCodePresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn7 - } - if len(m.ErrorMessage) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.ErrorMessage))) - i += copy(dAtA[i:], m.ErrorMessage) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Ack_ErrorCode) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x8 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.ErrorCode)) - return i, nil -} -func (m *ClientAck) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClientAck) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Destination) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Destination))) - i += copy(dAtA[i:], m.Destination) - } - if len(m.ClientId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.ClientId))) - i += copy(dAtA[i:], m.ClientId) - } - if m.BatchId != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.BatchId)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Sub) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Sub) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Destination) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Destination))) - i += copy(dAtA[i:], m.Destination) - } - if len(m.ClientId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.ClientId))) - i += copy(dAtA[i:], m.ClientId) - } - if len(m.Filter) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Filter))) - i += copy(dAtA[i:], m.Filter) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Unsub) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Unsub) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Destination) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Destination))) - i += copy(dAtA[i:], m.Destination) - } - if len(m.ClientId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.ClientId))) - i += copy(dAtA[i:], m.ClientId) - } - if len(m.Filter) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Filter))) - i += copy(dAtA[i:], m.Filter) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Get) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Get) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Destination) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Destination))) - i += copy(dAtA[i:], m.Destination) - } - if len(m.ClientId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.ClientId))) - i += copy(dAtA[i:], m.ClientId) - } - if m.FetchSize != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.FetchSize)) - } - if m.TimeoutPresent != nil { - nn8, err := m.TimeoutPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn8 - } - if m.UnitPresent != nil { - nn9, err := m.UnitPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn9 - } - if m.AutoAckPresent != nil { - nn10, err := m.AutoAckPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn10 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Get_Timeout) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x20 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.Timeout)) - return i, nil -} -func (m *Get_Unit) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x28 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.Unit)) - return i, nil -} -func (m *Get_AutoAck) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x30 - i++ - if m.AutoAck { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - return i, nil -} -func (m *Messages) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Messages) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.BatchId != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.BatchId)) - } - if len(m.Messages) > 0 { - for _, b := range m.Messages { - dAtA[i] = 0x12 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Dump) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Dump) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Journal) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Journal))) - i += copy(dAtA[i:], m.Journal) - } - if m.Position != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.Position)) - } - if m.TimestampPresent != nil { - nn11, err := m.TimestampPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn11 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Dump_Timestamp) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x18 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.Timestamp)) - return i, nil -} -func (m *ClientRollback) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ClientRollback) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Destination) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.Destination))) - i += copy(dAtA[i:], m.Destination) - } - if len(m.ClientId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(len(m.ClientId))) - i += copy(dAtA[i:], m.ClientId) - } - if m.BatchId != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintCanalProtocol(dAtA, i, uint64(m.BatchId)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintCanalProtocol(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Packet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MagicNumberPresent != nil { - n += m.MagicNumberPresent.Size() - } - if m.VersionPresent != nil { - n += m.VersionPresent.Size() - } - if m.Type != 0 { - n += 1 + sovCanalProtocol(uint64(m.Type)) - } - if m.CompressionPresent != nil { - n += m.CompressionPresent.Size() - } - l = len(m.Body) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Packet_MagicNumber) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCanalProtocol(uint64(m.MagicNumber)) - return n -} -func (m *Packet_Version) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCanalProtocol(uint64(m.Version)) - return n -} -func (m *Packet_Compression) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCanalProtocol(uint64(m.Compression)) - return n -} -func (m *HeartBeat) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.SendTimestamp != 0 { - n += 1 + sovCanalProtocol(uint64(m.SendTimestamp)) - } - if m.StartTimestamp != 0 { - n += 1 + sovCanalProtocol(uint64(m.StartTimestamp)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Handshake) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.CommunicationEncodingPresent != nil { - n += m.CommunicationEncodingPresent.Size() - } - l = len(m.Seeds) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.SupportedCompressions != 0 { - n += 1 + sovCanalProtocol(uint64(m.SupportedCompressions)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Handshake_CommunicationEncoding) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.CommunicationEncoding) - n += 1 + l + sovCanalProtocol(uint64(l)) - return n -} -func (m *ClientAuth) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Username) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - l = len(m.Password) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.NetReadTimeoutPresent != nil { - n += m.NetReadTimeoutPresent.Size() - } - if m.NetWriteTimeoutPresent != nil { - n += m.NetWriteTimeoutPresent.Size() - } - l = len(m.Destination) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - l = len(m.Filter) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.StartTimestamp != 0 { - n += 1 + sovCanalProtocol(uint64(m.StartTimestamp)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ClientAuth_NetReadTimeout) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCanalProtocol(uint64(m.NetReadTimeout)) - return n -} -func (m *ClientAuth_NetWriteTimeout) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCanalProtocol(uint64(m.NetWriteTimeout)) - return n -} -func (m *Ack) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ErrorCodePresent != nil { - n += m.ErrorCodePresent.Size() - } - l = len(m.ErrorMessage) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Ack_ErrorCode) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCanalProtocol(uint64(m.ErrorCode)) - return n -} -func (m *ClientAck) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Destination) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.BatchId != 0 { - n += 1 + sovCanalProtocol(uint64(m.BatchId)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Sub) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Destination) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - l = len(m.Filter) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Unsub) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Destination) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - l = len(m.Filter) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Get) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Destination) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.FetchSize != 0 { - n += 1 + sovCanalProtocol(uint64(m.FetchSize)) - } - if m.TimeoutPresent != nil { - n += m.TimeoutPresent.Size() - } - if m.UnitPresent != nil { - n += m.UnitPresent.Size() - } - if m.AutoAckPresent != nil { - n += m.AutoAckPresent.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Get_Timeout) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCanalProtocol(uint64(m.Timeout)) - return n -} -func (m *Get_Unit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCanalProtocol(uint64(m.Unit)) - return n -} -func (m *Get_AutoAck) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 2 - return n -} -func (m *Messages) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.BatchId != 0 { - n += 1 + sovCanalProtocol(uint64(m.BatchId)) - } - if len(m.Messages) > 0 { - for _, b := range m.Messages { - l = len(b) - n += 1 + l + sovCanalProtocol(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Dump) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Journal) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.Position != 0 { - n += 1 + sovCanalProtocol(uint64(m.Position)) - } - if m.TimestampPresent != nil { - n += m.TimestampPresent.Size() - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Dump_Timestamp) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovCanalProtocol(uint64(m.Timestamp)) - return n -} -func (m *ClientRollback) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Destination) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - l = len(m.ClientId) - if l > 0 { - n += 1 + l + sovCanalProtocol(uint64(l)) - } - if m.BatchId != 0 { - n += 1 + sovCanalProtocol(uint64(m.BatchId)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovCanalProtocol(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozCanalProtocol(x uint64) (n int) { - return sovCanalProtocol(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Packet) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Packet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Packet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MagicNumber", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.MagicNumberPresent = &Packet_MagicNumber{v} - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.VersionPresent = &Packet_Version{v} - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= (PacketType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Compression", wireType) - } - var v Compression - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (Compression(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.CompressionPresent = &Packet_Compression{v} - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Body = append(m.Body[:0], dAtA[iNdEx:postIndex]...) - if m.Body == nil { - m.Body = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *HeartBeat) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HeartBeat: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HeartBeat: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SendTimestamp", wireType) - } - m.SendTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SendTimestamp |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTimestamp", wireType) - } - m.StartTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartTimestamp |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Handshake) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Handshake: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Handshake: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CommunicationEncoding", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CommunicationEncodingPresent = &Handshake_CommunicationEncoding{string(dAtA[iNdEx:postIndex])} - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Seeds", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Seeds = append(m.Seeds[:0], dAtA[iNdEx:postIndex]...) - if m.Seeds == nil { - m.Seeds = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SupportedCompressions", wireType) - } - m.SupportedCompressions = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SupportedCompressions |= (Compression(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClientAuth) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClientAuth: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClientAuth: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Username", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Username = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Password", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Password = append(m.Password[:0], dAtA[iNdEx:postIndex]...) - if m.Password == nil { - m.Password = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NetReadTimeout", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.NetReadTimeoutPresent = &ClientAuth_NetReadTimeout{v} - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NetWriteTimeout", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.NetWriteTimeoutPresent = &ClientAuth_NetWriteTimeout{v} - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Destination = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTimestamp", wireType) - } - m.StartTimestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartTimestamp |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Ack) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Ack: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Ack: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ErrorCode", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.ErrorCodePresent = &Ack_ErrorCode{v} - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ErrorMessage", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ErrorMessage = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClientAck) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClientAck: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClientAck: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Destination = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchId", wireType) - } - m.BatchId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchId |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Sub) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Sub: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Sub: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Destination = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Unsub) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Unsub: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Unsub: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Destination = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Filter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Filter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Get) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Get: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Get: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Destination = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field FetchSize", wireType) - } - m.FetchSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.FetchSize |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.TimeoutPresent = &Get_Timeout{v} - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Unit", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.UnitPresent = &Get_Unit{v} - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AutoAck", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.AutoAckPresent = &Get_AutoAck{b} - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Messages) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Messages: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Messages: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchId", wireType) - } - m.BatchId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchId |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Messages = append(m.Messages, make([]byte, postIndex-iNdEx)) - copy(m.Messages[len(m.Messages)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Dump) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Dump: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Dump: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Journal", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Journal = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Position", wireType) - } - m.Position = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Position |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.TimestampPresent = &Dump_Timestamp{v} - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ClientRollback) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ClientRollback: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClientRollback: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Destination", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Destination = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ClientId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthCanalProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ClientId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BatchId", wireType) - } - m.BatchId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BatchId |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipCanalProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthCanalProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipCanalProtocol(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthCanalProtocol - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowCanalProtocol - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipCanalProtocol(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthCanalProtocol = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCanalProtocol = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("CanalProtocol.proto", fileDescriptor_CanalProtocol_79f46d6f01bc36e7) } - -var fileDescriptor_CanalProtocol_79f46d6f01bc36e7 = []byte{ - // 1038 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x5f, 0x6f, 0xe3, 0x44, - 0x10, 0xaf, 0xe3, 0xa4, 0x89, 0x27, 0x69, 0xea, 0x6e, 0xff, 0x28, 0xd7, 0x8a, 0x5c, 0x94, 0x13, - 0xa2, 0xaa, 0x8e, 0x3c, 0x1c, 0x0f, 0xbc, 0x62, 0xa7, 0xa6, 0x8e, 0x9a, 0x26, 0x61, 0xe3, 0xe8, - 0x44, 0x41, 0x44, 0x1b, 0x7b, 0xaf, 0xf5, 0x25, 0xf6, 0x06, 0x7b, 0xcd, 0xa9, 0xf7, 0x49, 0xf8, - 0x20, 0x7c, 0x08, 0x1e, 0x79, 0xe3, 0x15, 0x15, 0x09, 0x89, 0x6f, 0x81, 0x76, 0xed, 0xb8, 0x69, - 0x29, 0xaa, 0xd0, 0xe9, 0xde, 0x76, 0x7e, 0x33, 0x3b, 0xb3, 0xf3, 0x9b, 0xdf, 0xae, 0x0d, 0xbb, - 0x5d, 0x12, 0x92, 0xc5, 0x28, 0x62, 0x9c, 0xb9, 0x6c, 0xd1, 0x59, 0x8a, 0x05, 0x6a, 0xb9, 0x2c, - 0xe8, 0x90, 0x85, 0x3f, 0x23, 0x33, 0xd2, 0x61, 0x9c, 0xd3, 0xa8, 0xe3, 0x8a, 0xb0, 0xd4, 0xed, - 0xb2, 0x45, 0xfb, 0x97, 0x02, 0x6c, 0x8e, 0x88, 0x3b, 0xa7, 0x1c, 0xbd, 0x80, 0x5a, 0x40, 0xae, - 0x7c, 0x77, 0x1a, 0x26, 0xc1, 0x8c, 0x46, 0x0d, 0xa5, 0xa5, 0x1c, 0x97, 0xec, 0x0d, 0x5c, 0x95, - 0xe8, 0x40, 0x82, 0xe8, 0x10, 0xca, 0x3f, 0xd1, 0x28, 0xf6, 0x59, 0xd8, 0x28, 0x48, 0xbf, 0x82, - 0x57, 0x00, 0xfa, 0x0a, 0x8a, 0xfc, 0x66, 0x49, 0x1b, 0x6a, 0x4b, 0x39, 0xae, 0xbf, 0x7a, 0xd9, - 0x79, 0xaa, 0x78, 0x27, 0x2d, 0xec, 0xdc, 0x2c, 0x29, 0x96, 0x3b, 0xd1, 0x37, 0x50, 0x75, 0x59, - 0xb0, 0x8c, 0x68, 0x2c, 0x2b, 0x14, 0x65, 0xa2, 0xcf, 0x9f, 0x4e, 0xd4, 0xbd, 0xdb, 0x64, 0x17, - 0xf0, 0x7a, 0x0e, 0x84, 0xa0, 0x38, 0x63, 0xde, 0x4d, 0xa3, 0xd4, 0x52, 0x8e, 0x6b, 0x58, 0xae, - 0xcd, 0x03, 0xd8, 0x5b, 0xef, 0x74, 0x2a, 0x82, 0x69, 0xc8, 0xcd, 0x1d, 0xd8, 0xce, 0x7a, 0xc9, - 0xa1, 0x7d, 0xd8, 0x5d, 0xcb, 0xb6, 0x82, 0xdb, 0xdf, 0x81, 0x66, 0x53, 0x12, 0x71, 0x93, 0x12, - 0x8e, 0x3e, 0x85, 0x7a, 0x4c, 0x43, 0x6f, 0xca, 0xfd, 0x80, 0xc6, 0x9c, 0x04, 0x4b, 0x49, 0x9d, - 0x8a, 0xb7, 0x04, 0xea, 0xac, 0x40, 0xf4, 0x19, 0x6c, 0xc7, 0x9c, 0x44, 0x7c, 0x2d, 0xae, 0x20, - 0xe3, 0xea, 0x12, 0xce, 0x03, 0xdb, 0xb7, 0x0a, 0x68, 0x36, 0x09, 0xbd, 0xf8, 0x9a, 0xcc, 0x29, - 0xfa, 0x12, 0x0e, 0x5c, 0x16, 0x04, 0x49, 0xe8, 0xbb, 0x84, 0x8b, 0x33, 0xd0, 0xd0, 0x65, 0x9e, - 0x1f, 0x5e, 0xc9, 0x2a, 0x9a, 0xbd, 0x81, 0xf7, 0xef, 0xf9, 0xad, 0xcc, 0x8d, 0xf6, 0xa0, 0x14, - 0x53, 0xea, 0xc5, 0xb2, 0x4a, 0x0d, 0xa7, 0x06, 0xf2, 0xe0, 0x20, 0x4e, 0x96, 0x4b, 0x16, 0x71, - 0xea, 0x4d, 0xd7, 0x5a, 0x8b, 0xb3, 0xb1, 0xfd, 0x3f, 0xb6, 0xf1, 0x7e, 0x9e, 0x6c, 0x0d, 0x8d, - 0xcd, 0x16, 0x34, 0x1f, 0x3f, 0x74, 0xce, 0xe0, 0xef, 0x05, 0x80, 0xee, 0xc2, 0xa7, 0x21, 0x37, - 0x12, 0x7e, 0x8d, 0x0e, 0xa1, 0x92, 0xc4, 0x34, 0x0a, 0x49, 0x40, 0xd3, 0xbe, 0x70, 0x6e, 0x0b, - 0xdf, 0x92, 0xc4, 0xf1, 0x3b, 0x16, 0x79, 0x59, 0x2f, 0xb9, 0x8d, 0x4e, 0x40, 0x0f, 0x29, 0x9f, - 0x46, 0x94, 0xa4, 0xfc, 0xb3, 0x84, 0xcb, 0x46, 0x84, 0x70, 0xeb, 0x21, 0xe5, 0x98, 0x12, 0x39, - 0x02, 0x96, 0x70, 0xf4, 0x12, 0x76, 0x44, 0xec, 0xbb, 0xc8, 0xe7, 0x34, 0x0f, 0x2e, 0x66, 0x2a, - 0xde, 0x0e, 0x29, 0x7f, 0x2d, 0x3c, 0xab, 0xe8, 0x16, 0x54, 0x3d, 0x1a, 0x73, 0x3f, 0x94, 0x0d, - 0x48, 0xfd, 0x68, 0x78, 0x1d, 0x42, 0x47, 0xa0, 0xb9, 0xb2, 0x83, 0xa9, 0xef, 0x35, 0x36, 0xd3, - 0x43, 0xa7, 0x40, 0xcf, 0x43, 0x07, 0xb0, 0xf9, 0xc6, 0x5f, 0x70, 0x1a, 0x35, 0xca, 0xd2, 0x93, - 0x59, 0x8f, 0xa9, 0xa0, 0xf2, 0x98, 0x0a, 0xcc, 0x43, 0x68, 0x3c, 0xec, 0x2c, 0x57, 0xe5, 0x11, - 0x3c, 0xfb, 0x57, 0x27, 0x39, 0xb3, 0x04, 0x54, 0xc3, 0x9d, 0xa3, 0xe7, 0x00, 0x34, 0x8a, 0x58, - 0x34, 0x75, 0x99, 0x47, 0xf3, 0xcb, 0xac, 0x49, 0xac, 0xcb, 0x3c, 0x8a, 0x5e, 0xc0, 0x56, 0x1a, - 0x10, 0xd0, 0x38, 0x26, 0x57, 0x54, 0x72, 0xab, 0xe1, 0x9a, 0x04, 0x2f, 0x52, 0xcc, 0xdc, 0x03, - 0x74, 0x97, 0x25, 0x2f, 0x41, 0x41, 0xcb, 0x66, 0xe7, 0xce, 0x1f, 0x12, 0xa5, 0x3c, 0x41, 0x54, - 0xe1, 0x01, 0x51, 0xcf, 0xa0, 0x32, 0x23, 0xdc, 0xbd, 0x16, 0x3e, 0x55, 0x32, 0x51, 0x96, 0x76, - 0xcf, 0x6b, 0x7f, 0x0f, 0xea, 0x38, 0x99, 0x7d, 0x68, 0x81, 0xff, 0x98, 0x44, 0xfb, 0x07, 0x28, - 0x4d, 0xc2, 0xf8, 0xe3, 0xe5, 0xff, 0x5b, 0x01, 0xf5, 0x8c, 0xf2, 0x0f, 0x4d, 0xff, 0x09, 0xc0, - 0x1b, 0x2a, 0xf8, 0x89, 0xfd, 0xf7, 0xe9, 0xdb, 0x5a, 0xc2, 0x9a, 0x44, 0xc6, 0xfe, 0x7b, 0x71, - 0x39, 0xca, 0xeb, 0x52, 0x56, 0xed, 0x0d, 0xbc, 0x02, 0xd0, 0x1e, 0x14, 0x93, 0xd0, 0xe7, 0x52, - 0xbb, 0x42, 0xe3, 0xd2, 0x42, 0x47, 0x50, 0x21, 0x09, 0x67, 0x53, 0xe2, 0xce, 0xa5, 0x6a, 0x2b, - 0x76, 0x01, 0x97, 0x05, 0x62, 0xb8, 0x73, 0xf1, 0x04, 0x3e, 0x14, 0x5b, 0x1d, 0x6a, 0x62, 0x5f, - 0x6e, 0x23, 0xd0, 0x57, 0xfb, 0x73, 0x41, 0x18, 0x50, 0xc9, 0x14, 0x13, 0xdf, 0x1b, 0xa8, 0x72, - 0x6f, 0xa0, 0xe2, 0x26, 0x67, 0x62, 0x13, 0xaf, 0x92, 0x2a, 0x6e, 0xf2, 0xca, 0x6e, 0xff, 0x08, - 0xc5, 0xd3, 0x24, 0x58, 0xa2, 0x06, 0x94, 0xdf, 0xb2, 0x24, 0x0a, 0xc9, 0x22, 0xa3, 0x6a, 0x65, - 0xca, 0x77, 0x80, 0xc5, 0x3e, 0x5f, 0x7d, 0x7c, 0x54, 0x9c, 0xdb, 0xa8, 0x09, 0xda, 0xdd, 0x85, - 0x52, 0x33, 0x22, 0xee, 0x20, 0x73, 0x17, 0x76, 0x72, 0x23, 0x3f, 0xf5, 0x5b, 0xa8, 0xa7, 0x32, - 0xc6, 0x6c, 0xb1, 0x98, 0x91, 0x8f, 0xa9, 0xe5, 0x93, 0x09, 0x54, 0xd7, 0x5e, 0x48, 0xf4, 0x1c, - 0x8e, 0xba, 0xc3, 0x8b, 0x11, 0xb6, 0xc6, 0xe3, 0xde, 0x70, 0x20, 0x96, 0x86, 0xd3, 0x33, 0xfb, - 0xd6, 0x08, 0x0f, 0x9d, 0xe1, 0x2b, 0x7d, 0x03, 0x55, 0xa0, 0x38, 0x18, 0x0e, 0x2c, 0x5d, 0x11, - 0xab, 0xcb, 0x7e, 0xcf, 0xd4, 0x0b, 0x62, 0x75, 0x76, 0xd9, 0x1b, 0xe9, 0x2a, 0x2a, 0x83, 0xda, - 0xbf, 0xfc, 0x5a, 0x2f, 0x9e, 0xfc, 0xa5, 0x00, 0xdc, 0x7d, 0x46, 0x45, 0xda, 0x91, 0xd1, 0x3d, - 0x37, 0xce, 0x2c, 0xe7, 0xdb, 0x91, 0xf5, 0x48, 0xda, 0x2d, 0xd0, 0x6c, 0x63, 0x70, 0x3a, 0xb6, - 0x8d, 0x73, 0x91, 0xbb, 0x01, 0x7b, 0xdd, 0x7e, 0xcf, 0x1a, 0x38, 0xc6, 0xc4, 0xb1, 0xad, 0x81, - 0xd3, 0xeb, 0x1a, 0x4e, 0x6f, 0x38, 0xd0, 0x0b, 0xa2, 0x82, 0xd1, 0x3d, 0xd7, 0x55, 0xa4, 0x43, - 0x6d, 0x3c, 0x31, 0xc7, 0x5d, 0xdc, 0x1b, 0x49, 0x57, 0x11, 0x21, 0xa8, 0x4f, 0x06, 0xf7, 0xb0, - 0x92, 0x08, 0x3f, 0xb3, 0x1c, 0x7d, 0x13, 0xd5, 0xa0, 0x72, 0x61, 0x8d, 0xc7, 0xc6, 0x99, 0x35, - 0xd6, 0xcb, 0xa2, 0x5c, 0x96, 0xbf, 0x7b, 0xae, 0x57, 0x84, 0x73, 0x6c, 0x4f, 0x9c, 0xd3, 0xe1, - 0xeb, 0x81, 0xae, 0x89, 0x76, 0x4e, 0x27, 0x17, 0x23, 0x1d, 0xe4, 0xa9, 0x2c, 0x03, 0x3b, 0xa6, - 0x65, 0x38, 0x7a, 0x55, 0x14, 0x48, 0x77, 0xe1, 0x61, 0xbf, 0x6f, 0x8a, 0xad, 0x35, 0xd3, 0xf8, - 0xf5, 0xb6, 0xa9, 0xfc, 0x76, 0xdb, 0x54, 0xfe, 0xb8, 0x6d, 0x2a, 0x3f, 0xff, 0xd9, 0xdc, 0x80, - 0x27, 0x7f, 0x6e, 0xcc, 0x6a, 0xfa, 0x4f, 0x24, 0xe9, 0xb1, 0x95, 0xd9, 0xa6, 0x74, 0x7c, 0xf1, - 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x97, 0x69, 0xe7, 0x75, 0x2b, 0x09, 0x00, 0x00, -} diff --git a/protocol/EntryProtocol.pb.go b/protocol/EntryProtocol.pb.go deleted file mode 100644 index edad093..0000000 --- a/protocol/EntryProtocol.pb.go +++ /dev/null @@ -1,3967 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: EntryProtocol.proto - -package com_alibaba_otter_canal_protocol - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -// *打散后的事件类型,主要用于标识事务的开始,变更数据,结束* -type EntryType int32 - -const ( - EntryType_ENTRYTYPECOMPATIBLEPROTO2 EntryType = 0 - EntryType_TRANSACTIONBEGIN EntryType = 1 - EntryType_ROWDATA EntryType = 2 - EntryType_TRANSACTIONEND EntryType = 3 - // * 心跳类型,内部使用,外部暂不可见,可忽略 * - EntryType_HEARTBEAT EntryType = 4 - EntryType_GTIDLOG EntryType = 5 -) - -var EntryType_name = map[int32]string{ - 0: "ENTRYTYPECOMPATIBLEPROTO2", - 1: "TRANSACTIONBEGIN", - 2: "ROWDATA", - 3: "TRANSACTIONEND", - 4: "HEARTBEAT", - 5: "GTIDLOG", -} -var EntryType_value = map[string]int32{ - "ENTRYTYPECOMPATIBLEPROTO2": 0, - "TRANSACTIONBEGIN": 1, - "ROWDATA": 2, - "TRANSACTIONEND": 3, - "HEARTBEAT": 4, - "GTIDLOG": 5, -} - -func (x EntryType) String() string { - return proto.EnumName(EntryType_name, int32(x)) -} -func (EntryType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{0} -} - -// * 事件类型 * -type EventType int32 - -const ( - EventType_EVENTTYPECOMPATIBLEPROTO2 EventType = 0 - EventType_INSERT EventType = 1 - EventType_UPDATE EventType = 2 - EventType_DELETE EventType = 3 - EventType_CREATE EventType = 4 - EventType_ALTER EventType = 5 - EventType_ERASE EventType = 6 - EventType_QUERY EventType = 7 - EventType_TRUNCATE EventType = 8 - EventType_RENAME EventType = 9 - // *CREATE INDEX* - EventType_CINDEX EventType = 10 - EventType_DINDEX EventType = 11 - EventType_GTID EventType = 12 - // * XA * - EventType_XACOMMIT EventType = 13 - EventType_XAROLLBACK EventType = 14 - // * MASTER HEARTBEAT * - EventType_MHEARTBEAT EventType = 15 -) - -var EventType_name = map[int32]string{ - 0: "EVENTTYPECOMPATIBLEPROTO2", - 1: "INSERT", - 2: "UPDATE", - 3: "DELETE", - 4: "CREATE", - 5: "ALTER", - 6: "ERASE", - 7: "QUERY", - 8: "TRUNCATE", - 9: "RENAME", - 10: "CINDEX", - 11: "DINDEX", - 12: "GTID", - 13: "XACOMMIT", - 14: "XAROLLBACK", - 15: "MHEARTBEAT", -} -var EventType_value = map[string]int32{ - "EVENTTYPECOMPATIBLEPROTO2": 0, - "INSERT": 1, - "UPDATE": 2, - "DELETE": 3, - "CREATE": 4, - "ALTER": 5, - "ERASE": 6, - "QUERY": 7, - "TRUNCATE": 8, - "RENAME": 9, - "CINDEX": 10, - "DINDEX": 11, - "GTID": 12, - "XACOMMIT": 13, - "XAROLLBACK": 14, - "MHEARTBEAT": 15, -} - -func (x EventType) String() string { - return proto.EnumName(EventType_name, int32(x)) -} -func (EventType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{1} -} - -// *数据库类型* -type Type int32 - -const ( - Type_TYPECOMPATIBLEPROTO2 Type = 0 - Type_ORACLE Type = 1 - Type_MYSQL Type = 2 - Type_PGSQL Type = 3 -) - -var Type_name = map[int32]string{ - 0: "TYPECOMPATIBLEPROTO2", - 1: "ORACLE", - 2: "MYSQL", - 3: "PGSQL", -} -var Type_value = map[string]int32{ - "TYPECOMPATIBLEPROTO2": 0, - "ORACLE": 1, - "MYSQL": 2, - "PGSQL": 3, -} - -func (x Type) String() string { - return proto.EnumName(Type_name, int32(x)) -} -func (Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{2} -} - -// *************************************************************** -// message model -// 如果要在Enum中新增类型,确保以前的类型的下标值不变. -// ************************************************************** -type Entry struct { - // *协议头部信息* - Header *Header `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - // /**打散后的事件类型**/ [default = ROWDATA] - // - // Types that are valid to be assigned to EntryTypePresent: - // *Entry_EntryType - EntryTypePresent isEntry_EntryTypePresent `protobuf_oneof:"entryType_present"` - // *传输的二进制数组* - StoreValue []byte `protobuf:"bytes,3,opt,name=storeValue,proto3" json:"storeValue,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Entry) Reset() { *m = Entry{} } -func (m *Entry) String() string { return proto.CompactTextString(m) } -func (*Entry) ProtoMessage() {} -func (*Entry) Descriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{0} -} -func (m *Entry) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Entry.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Entry) XXX_Merge(src proto.Message) { - xxx_messageInfo_Entry.Merge(dst, src) -} -func (m *Entry) XXX_Size() int { - return m.Size() -} -func (m *Entry) XXX_DiscardUnknown() { - xxx_messageInfo_Entry.DiscardUnknown(m) -} - -var xxx_messageInfo_Entry proto.InternalMessageInfo - -type isEntry_EntryTypePresent interface { - isEntry_EntryTypePresent() - MarshalTo([]byte) (int, error) - Size() int -} - -type Entry_EntryType struct { - EntryType EntryType `protobuf:"varint,2,opt,name=entryType,proto3,enum=com.alibaba.otter.canal.protocol.EntryType,oneof"` -} - -func (*Entry_EntryType) isEntry_EntryTypePresent() {} - -func (m *Entry) GetEntryTypePresent() isEntry_EntryTypePresent { - if m != nil { - return m.EntryTypePresent - } - return nil -} - -func (m *Entry) GetHeader() *Header { - if m != nil { - return m.Header - } - return nil -} - -func (m *Entry) GetEntryType() EntryType { - if x, ok := m.GetEntryTypePresent().(*Entry_EntryType); ok { - return x.EntryType - } - return EntryType_ROWDATA -} - -func (m *Entry) GetStoreValue() []byte { - if m != nil { - return m.StoreValue - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Entry) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Entry_OneofMarshaler, _Entry_OneofUnmarshaler, _Entry_OneofSizer, []interface{}{ - (*Entry_EntryType)(nil), - } -} - -func _Entry_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Entry) - // entryType_present - switch x := m.EntryTypePresent.(type) { - case *Entry_EntryType: - _ = b.EncodeVarint(2<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.EntryType)) - case nil: - default: - return fmt.Errorf("Entry.EntryTypePresent has unexpected type %T", x) - } - return nil -} - -func _Entry_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Entry) - switch tag { - case 2: // entryType_present.entryType - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.EntryTypePresent = &Entry_EntryType{EntryType(x)} - return true, err - default: - return false, nil - } -} - -func _Entry_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Entry) - // entryType_present - switch x := m.EntryTypePresent.(type) { - case *Entry_EntryType: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.EntryType)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// *message Header* -type Header struct { - // [default = 1] - // - // Types that are valid to be assigned to VersionPresent: - // *Header_Version - VersionPresent isHeader_VersionPresent `protobuf_oneof:"version_present"` - // *binlog/redolog 文件名* - LogfileName string `protobuf:"bytes,2,opt,name=logfileName,proto3" json:"logfileName,omitempty"` - // *binlog/redolog 文件的偏移位置* - LogfileOffset int64 `protobuf:"varint,3,opt,name=logfileOffset,proto3" json:"logfileOffset,omitempty"` - // *服务端serverId* - ServerId int64 `protobuf:"varint,4,opt,name=serverId,proto3" json:"serverId,omitempty"` - // * 变更数据的编码 * - ServerenCode string `protobuf:"bytes,5,opt,name=serverenCode,proto3" json:"serverenCode,omitempty"` - // *变更数据的执行时间 * - ExecuteTime int64 `protobuf:"varint,6,opt,name=executeTime,proto3" json:"executeTime,omitempty"` - // [default = MYSQL] - // - // Types that are valid to be assigned to SourceTypePresent: - // *Header_SourceType - SourceTypePresent isHeader_SourceTypePresent `protobuf_oneof:"sourceType_present"` - // * 变更数据的schemaname* - SchemaName string `protobuf:"bytes,8,opt,name=schemaName,proto3" json:"schemaName,omitempty"` - // *变更数据的tablename* - TableName string `protobuf:"bytes,9,opt,name=tableName,proto3" json:"tableName,omitempty"` - // *每个event的长度* - EventLength int64 `protobuf:"varint,10,opt,name=eventLength,proto3" json:"eventLength,omitempty"` - // [default = UPDATE] - // - // Types that are valid to be assigned to EventTypePresent: - // *Header_EventType - EventTypePresent isHeader_EventTypePresent `protobuf_oneof:"eventType_present"` - // *预留扩展* - Props []*Pair `protobuf:"bytes,12,rep,name=props" json:"props,omitempty"` - // *当前事务的gitd* - Gtid string `protobuf:"bytes,13,opt,name=gtid,proto3" json:"gtid,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Header) Reset() { *m = Header{} } -func (m *Header) String() string { return proto.CompactTextString(m) } -func (*Header) ProtoMessage() {} -func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{1} -} -func (m *Header) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Header.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_Header.Merge(dst, src) -} -func (m *Header) XXX_Size() int { - return m.Size() -} -func (m *Header) XXX_DiscardUnknown() { - xxx_messageInfo_Header.DiscardUnknown(m) -} - -var xxx_messageInfo_Header proto.InternalMessageInfo - -type isHeader_VersionPresent interface { - isHeader_VersionPresent() - MarshalTo([]byte) (int, error) - Size() int -} -type isHeader_SourceTypePresent interface { - isHeader_SourceTypePresent() - MarshalTo([]byte) (int, error) - Size() int -} -type isHeader_EventTypePresent interface { - isHeader_EventTypePresent() - MarshalTo([]byte) (int, error) - Size() int -} - -type Header_Version struct { - Version int32 `protobuf:"varint,1,opt,name=version,proto3,oneof"` -} -type Header_SourceType struct { - SourceType Type `protobuf:"varint,7,opt,name=sourceType,proto3,enum=com.alibaba.otter.canal.protocol.Type,oneof"` -} -type Header_EventType struct { - EventType EventType `protobuf:"varint,11,opt,name=eventType,proto3,enum=com.alibaba.otter.canal.protocol.EventType,oneof"` -} - -func (*Header_Version) isHeader_VersionPresent() {} -func (*Header_SourceType) isHeader_SourceTypePresent() {} -func (*Header_EventType) isHeader_EventTypePresent() {} - -func (m *Header) GetVersionPresent() isHeader_VersionPresent { - if m != nil { - return m.VersionPresent - } - return nil -} -func (m *Header) GetSourceTypePresent() isHeader_SourceTypePresent { - if m != nil { - return m.SourceTypePresent - } - return nil -} -func (m *Header) GetEventTypePresent() isHeader_EventTypePresent { - if m != nil { - return m.EventTypePresent - } - return nil -} - -func (m *Header) GetVersion() int32 { - if x, ok := m.GetVersionPresent().(*Header_Version); ok { - return x.Version - } - return 1 -} - -func (m *Header) GetLogfileName() string { - if m != nil { - return m.LogfileName - } - return "" -} - -func (m *Header) GetLogfileOffset() int64 { - if m != nil { - return m.LogfileOffset - } - return 0 -} - -func (m *Header) GetServerId() int64 { - if m != nil { - return m.ServerId - } - return 0 -} - -func (m *Header) GetServerenCode() string { - if m != nil { - return m.ServerenCode - } - return "" -} - -func (m *Header) GetExecuteTime() int64 { - if m != nil { - return m.ExecuteTime - } - return 0 -} - -func (m *Header) GetSourceType() Type { - if x, ok := m.GetSourceTypePresent().(*Header_SourceType); ok { - return x.SourceType - } - return Type_MYSQL -} - -func (m *Header) GetSchemaName() string { - if m != nil { - return m.SchemaName - } - return "" -} - -func (m *Header) GetTableName() string { - if m != nil { - return m.TableName - } - return "" -} - -func (m *Header) GetEventLength() int64 { - if m != nil { - return m.EventLength - } - return 0 -} - -func (m *Header) GetEventType() EventType { - if x, ok := m.GetEventTypePresent().(*Header_EventType); ok { - return x.EventType - } - return EventType_UPDATE -} - -func (m *Header) GetProps() []*Pair { - if m != nil { - return m.Props - } - return nil -} - -func (m *Header) GetGtid() string { - if m != nil { - return m.Gtid - } - return "" -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Header) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Header_OneofMarshaler, _Header_OneofUnmarshaler, _Header_OneofSizer, []interface{}{ - (*Header_Version)(nil), - (*Header_SourceType)(nil), - (*Header_EventType)(nil), - } -} - -func _Header_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Header) - // version_present - switch x := m.VersionPresent.(type) { - case *Header_Version: - _ = b.EncodeVarint(1<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.Version)) - case nil: - default: - return fmt.Errorf("Header.VersionPresent has unexpected type %T", x) - } - // sourceType_present - switch x := m.SourceTypePresent.(type) { - case *Header_SourceType: - _ = b.EncodeVarint(7<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.SourceType)) - case nil: - default: - return fmt.Errorf("Header.SourceTypePresent has unexpected type %T", x) - } - // eventType_present - switch x := m.EventTypePresent.(type) { - case *Header_EventType: - _ = b.EncodeVarint(11<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.EventType)) - case nil: - default: - return fmt.Errorf("Header.EventTypePresent has unexpected type %T", x) - } - return nil -} - -func _Header_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Header) - switch tag { - case 1: // version_present.version - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.VersionPresent = &Header_Version{int32(x)} - return true, err - case 7: // sourceType_present.sourceType - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.SourceTypePresent = &Header_SourceType{Type(x)} - return true, err - case 11: // eventType_present.eventType - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.EventTypePresent = &Header_EventType{EventType(x)} - return true, err - default: - return false, nil - } -} - -func _Header_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Header) - // version_present - switch x := m.VersionPresent.(type) { - case *Header_Version: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.Version)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // sourceType_present - switch x := m.SourceTypePresent.(type) { - case *Header_SourceType: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.SourceType)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // eventType_present - switch x := m.EventTypePresent.(type) { - case *Header_EventType: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.EventType)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// *每个字段的数据结构* -type Column struct { - // *字段下标* - Index int32 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` - // *字段java中类型* - SqlType int32 `protobuf:"varint,2,opt,name=sqlType,proto3" json:"sqlType,omitempty"` - // *字段名称(忽略大小写),在mysql中是没有的* - Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` - // *是否是主键* - IsKey bool `protobuf:"varint,4,opt,name=isKey,proto3" json:"isKey,omitempty"` - // *如果EventType=UPDATE,用于标识这个字段值是否有修改* - Updated bool `protobuf:"varint,5,opt,name=updated,proto3" json:"updated,omitempty"` - // [default = false] - // - // Types that are valid to be assigned to IsNullPresent: - // *Column_IsNull - IsNullPresent isColumn_IsNullPresent `protobuf_oneof:"isNull_present"` - // *预留扩展* - Props []*Pair `protobuf:"bytes,7,rep,name=props" json:"props,omitempty"` - // * 字段值,timestamp,Datetime是一个时间格式的文本 * - Value string `protobuf:"bytes,8,opt,name=value,proto3" json:"value,omitempty"` - // * 对应数据对象原始长度 * - Length int32 `protobuf:"varint,9,opt,name=length,proto3" json:"length,omitempty"` - // *字段mysql类型* - MysqlType string `protobuf:"bytes,10,opt,name=mysqlType,proto3" json:"mysqlType,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Column) Reset() { *m = Column{} } -func (m *Column) String() string { return proto.CompactTextString(m) } -func (*Column) ProtoMessage() {} -func (*Column) Descriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{2} -} -func (m *Column) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Column) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Column.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Column) XXX_Merge(src proto.Message) { - xxx_messageInfo_Column.Merge(dst, src) -} -func (m *Column) XXX_Size() int { - return m.Size() -} -func (m *Column) XXX_DiscardUnknown() { - xxx_messageInfo_Column.DiscardUnknown(m) -} - -var xxx_messageInfo_Column proto.InternalMessageInfo - -type isColumn_IsNullPresent interface { - isColumn_IsNullPresent() - MarshalTo([]byte) (int, error) - Size() int -} - -type Column_IsNull struct { - IsNull bool `protobuf:"varint,6,opt,name=isNull,proto3,oneof"` -} - -func (*Column_IsNull) isColumn_IsNullPresent() {} - -func (m *Column) GetIsNullPresent() isColumn_IsNullPresent { - if m != nil { - return m.IsNullPresent - } - return nil -} - -func (m *Column) GetIndex() int32 { - if m != nil { - return m.Index - } - return 0 -} - -func (m *Column) GetSqlType() int32 { - if m != nil { - return m.SqlType - } - return 0 -} - -func (m *Column) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *Column) GetIsKey() bool { - if m != nil { - return m.IsKey - } - return false -} - -func (m *Column) GetUpdated() bool { - if m != nil { - return m.Updated - } - return false -} - -func (m *Column) GetIsNull() bool { - if x, ok := m.GetIsNullPresent().(*Column_IsNull); ok { - return x.IsNull - } - return false -} - -func (m *Column) GetProps() []*Pair { - if m != nil { - return m.Props - } - return nil -} - -func (m *Column) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -func (m *Column) GetLength() int32 { - if m != nil { - return m.Length - } - return 0 -} - -func (m *Column) GetMysqlType() string { - if m != nil { - return m.MysqlType - } - return "" -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Column) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Column_OneofMarshaler, _Column_OneofUnmarshaler, _Column_OneofSizer, []interface{}{ - (*Column_IsNull)(nil), - } -} - -func _Column_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Column) - // isNull_present - switch x := m.IsNullPresent.(type) { - case *Column_IsNull: - t := uint64(0) - if x.IsNull { - t = 1 - } - _ = b.EncodeVarint(6<<3 | proto.WireVarint) - _ = b.EncodeVarint(t) - case nil: - default: - return fmt.Errorf("Column.IsNullPresent has unexpected type %T", x) - } - return nil -} - -func _Column_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Column) - switch tag { - case 6: // isNull_present.isNull - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.IsNullPresent = &Column_IsNull{x != 0} - return true, err - default: - return false, nil - } -} - -func _Column_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Column) - // isNull_present - switch x := m.IsNullPresent.(type) { - case *Column_IsNull: - n += 1 // tag and wire - n += 1 - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type RowData struct { - // * 字段信息,增量数据(修改前,删除前) * - BeforeColumns []*Column `protobuf:"bytes,1,rep,name=beforeColumns" json:"beforeColumns,omitempty"` - // * 字段信息,增量数据(修改后,新增后) * - AfterColumns []*Column `protobuf:"bytes,2,rep,name=afterColumns" json:"afterColumns,omitempty"` - // *预留扩展* - Props []*Pair `protobuf:"bytes,3,rep,name=props" json:"props,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RowData) Reset() { *m = RowData{} } -func (m *RowData) String() string { return proto.CompactTextString(m) } -func (*RowData) ProtoMessage() {} -func (*RowData) Descriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{3} -} -func (m *RowData) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RowData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RowData.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *RowData) XXX_Merge(src proto.Message) { - xxx_messageInfo_RowData.Merge(dst, src) -} -func (m *RowData) XXX_Size() int { - return m.Size() -} -func (m *RowData) XXX_DiscardUnknown() { - xxx_messageInfo_RowData.DiscardUnknown(m) -} - -var xxx_messageInfo_RowData proto.InternalMessageInfo - -func (m *RowData) GetBeforeColumns() []*Column { - if m != nil { - return m.BeforeColumns - } - return nil -} - -func (m *RowData) GetAfterColumns() []*Column { - if m != nil { - return m.AfterColumns - } - return nil -} - -func (m *RowData) GetProps() []*Pair { - if m != nil { - return m.Props - } - return nil -} - -// *message row 每行变更数据的数据结构* -type RowChange struct { - // *tableId,由数据库产生* - TableId int64 `protobuf:"varint,1,opt,name=tableId,proto3" json:"tableId,omitempty"` - // [default = UPDATE] - // - // Types that are valid to be assigned to EventTypePresent: - // *RowChange_EventType - EventTypePresent isRowChange_EventTypePresent `protobuf_oneof:"eventType_present"` - // [default = false] - // - // Types that are valid to be assigned to IsDdlPresent: - // *RowChange_IsDdl - IsDdlPresent isRowChange_IsDdlPresent `protobuf_oneof:"isDdl_present"` - // * ddl/query的sql语句 * - Sql string `protobuf:"bytes,11,opt,name=sql,proto3" json:"sql,omitempty"` - // * 一次数据库变更可能存在多行 * - RowDatas []*RowData `protobuf:"bytes,12,rep,name=rowDatas" json:"rowDatas,omitempty"` - // *预留扩展* - Props []*Pair `protobuf:"bytes,13,rep,name=props" json:"props,omitempty"` - // * ddl/query的schemaName,会存在跨库ddl,需要保留执行ddl的当前schemaName * - DdlSchemaName string `protobuf:"bytes,14,opt,name=ddlSchemaName,proto3" json:"ddlSchemaName,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *RowChange) Reset() { *m = RowChange{} } -func (m *RowChange) String() string { return proto.CompactTextString(m) } -func (*RowChange) ProtoMessage() {} -func (*RowChange) Descriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{4} -} -func (m *RowChange) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *RowChange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RowChange.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *RowChange) XXX_Merge(src proto.Message) { - xxx_messageInfo_RowChange.Merge(dst, src) -} -func (m *RowChange) XXX_Size() int { - return m.Size() -} -func (m *RowChange) XXX_DiscardUnknown() { - xxx_messageInfo_RowChange.DiscardUnknown(m) -} - -var xxx_messageInfo_RowChange proto.InternalMessageInfo - -type isRowChange_EventTypePresent interface { - isRowChange_EventTypePresent() - MarshalTo([]byte) (int, error) - Size() int -} -type isRowChange_IsDdlPresent interface { - isRowChange_IsDdlPresent() - MarshalTo([]byte) (int, error) - Size() int -} - -type RowChange_EventType struct { - EventType EventType `protobuf:"varint,2,opt,name=eventType,proto3,enum=com.alibaba.otter.canal.protocol.EventType,oneof"` -} -type RowChange_IsDdl struct { - IsDdl bool `protobuf:"varint,10,opt,name=isDdl,proto3,oneof"` -} - -func (*RowChange_EventType) isRowChange_EventTypePresent() {} -func (*RowChange_IsDdl) isRowChange_IsDdlPresent() {} - -func (m *RowChange) GetEventTypePresent() isRowChange_EventTypePresent { - if m != nil { - return m.EventTypePresent - } - return nil -} -func (m *RowChange) GetIsDdlPresent() isRowChange_IsDdlPresent { - if m != nil { - return m.IsDdlPresent - } - return nil -} - -func (m *RowChange) GetTableId() int64 { - if m != nil { - return m.TableId - } - return 0 -} - -func (m *RowChange) GetEventType() EventType { - if x, ok := m.GetEventTypePresent().(*RowChange_EventType); ok { - return x.EventType - } - return EventType_UPDATE -} - -func (m *RowChange) GetIsDdl() bool { - if x, ok := m.GetIsDdlPresent().(*RowChange_IsDdl); ok { - return x.IsDdl - } - return false -} - -func (m *RowChange) GetSql() string { - if m != nil { - return m.Sql - } - return "" -} - -func (m *RowChange) GetRowDatas() []*RowData { - if m != nil { - return m.RowDatas - } - return nil -} - -func (m *RowChange) GetProps() []*Pair { - if m != nil { - return m.Props - } - return nil -} - -func (m *RowChange) GetDdlSchemaName() string { - if m != nil { - return m.DdlSchemaName - } - return "" -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*RowChange) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _RowChange_OneofMarshaler, _RowChange_OneofUnmarshaler, _RowChange_OneofSizer, []interface{}{ - (*RowChange_EventType)(nil), - (*RowChange_IsDdl)(nil), - } -} - -func _RowChange_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*RowChange) - // eventType_present - switch x := m.EventTypePresent.(type) { - case *RowChange_EventType: - _ = b.EncodeVarint(2<<3 | proto.WireVarint) - _ = b.EncodeVarint(uint64(x.EventType)) - case nil: - default: - return fmt.Errorf("RowChange.EventTypePresent has unexpected type %T", x) - } - // isDdl_present - switch x := m.IsDdlPresent.(type) { - case *RowChange_IsDdl: - t := uint64(0) - if x.IsDdl { - t = 1 - } - _ = b.EncodeVarint(10<<3 | proto.WireVarint) - _ = b.EncodeVarint(t) - case nil: - default: - return fmt.Errorf("RowChange.IsDdlPresent has unexpected type %T", x) - } - return nil -} - -func _RowChange_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*RowChange) - switch tag { - case 2: // eventType_present.eventType - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.EventTypePresent = &RowChange_EventType{EventType(x)} - return true, err - case 10: // isDdl_present.isDdl - if wire != proto.WireVarint { - return true, proto.ErrInternalBadWireType - } - x, err := b.DecodeVarint() - m.IsDdlPresent = &RowChange_IsDdl{x != 0} - return true, err - default: - return false, nil - } -} - -func _RowChange_OneofSizer(msg proto.Message) (n int) { - m := msg.(*RowChange) - // eventType_present - switch x := m.EventTypePresent.(type) { - case *RowChange_EventType: - n += 1 // tag and wire - n += proto.SizeVarint(uint64(x.EventType)) - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - // isDdl_present - switch x := m.IsDdlPresent.(type) { - case *RowChange_IsDdl: - n += 1 // tag and wire - n += 1 - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -// *开始事务的一些信息* -type TransactionBegin struct { - // *已废弃,请使用header里的executeTime* - ExecuteTime int64 `protobuf:"varint,1,opt,name=executeTime,proto3" json:"executeTime,omitempty"` - // *已废弃,Begin里不提供事务id* - TransactionId string `protobuf:"bytes,2,opt,name=transactionId,proto3" json:"transactionId,omitempty"` - // *预留扩展* - Props []*Pair `protobuf:"bytes,3,rep,name=props" json:"props,omitempty"` - // *执行的thread Id* - ThreadId int64 `protobuf:"varint,4,opt,name=threadId,proto3" json:"threadId,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TransactionBegin) Reset() { *m = TransactionBegin{} } -func (m *TransactionBegin) String() string { return proto.CompactTextString(m) } -func (*TransactionBegin) ProtoMessage() {} -func (*TransactionBegin) Descriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{5} -} -func (m *TransactionBegin) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TransactionBegin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TransactionBegin.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *TransactionBegin) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransactionBegin.Merge(dst, src) -} -func (m *TransactionBegin) XXX_Size() int { - return m.Size() -} -func (m *TransactionBegin) XXX_DiscardUnknown() { - xxx_messageInfo_TransactionBegin.DiscardUnknown(m) -} - -var xxx_messageInfo_TransactionBegin proto.InternalMessageInfo - -func (m *TransactionBegin) GetExecuteTime() int64 { - if m != nil { - return m.ExecuteTime - } - return 0 -} - -func (m *TransactionBegin) GetTransactionId() string { - if m != nil { - return m.TransactionId - } - return "" -} - -func (m *TransactionBegin) GetProps() []*Pair { - if m != nil { - return m.Props - } - return nil -} - -func (m *TransactionBegin) GetThreadId() int64 { - if m != nil { - return m.ThreadId - } - return 0 -} - -// *结束事务的一些信息* -type TransactionEnd struct { - // *已废弃,请使用header里的executeTime* - ExecuteTime int64 `protobuf:"varint,1,opt,name=executeTime,proto3" json:"executeTime,omitempty"` - // *事务号* - TransactionId string `protobuf:"bytes,2,opt,name=transactionId,proto3" json:"transactionId,omitempty"` - // *预留扩展* - Props []*Pair `protobuf:"bytes,3,rep,name=props" json:"props,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *TransactionEnd) Reset() { *m = TransactionEnd{} } -func (m *TransactionEnd) String() string { return proto.CompactTextString(m) } -func (*TransactionEnd) ProtoMessage() {} -func (*TransactionEnd) Descriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{6} -} -func (m *TransactionEnd) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TransactionEnd) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TransactionEnd.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *TransactionEnd) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransactionEnd.Merge(dst, src) -} -func (m *TransactionEnd) XXX_Size() int { - return m.Size() -} -func (m *TransactionEnd) XXX_DiscardUnknown() { - xxx_messageInfo_TransactionEnd.DiscardUnknown(m) -} - -var xxx_messageInfo_TransactionEnd proto.InternalMessageInfo - -func (m *TransactionEnd) GetExecuteTime() int64 { - if m != nil { - return m.ExecuteTime - } - return 0 -} - -func (m *TransactionEnd) GetTransactionId() string { - if m != nil { - return m.TransactionId - } - return "" -} - -func (m *TransactionEnd) GetProps() []*Pair { - if m != nil { - return m.Props - } - return nil -} - -// *预留扩展* -type Pair struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` -} - -func (m *Pair) Reset() { *m = Pair{} } -func (m *Pair) String() string { return proto.CompactTextString(m) } -func (*Pair) ProtoMessage() {} -func (*Pair) Descriptor() ([]byte, []int) { - return fileDescriptor_EntryProtocol_7c77ea7eaea22aeb, []int{7} -} -func (m *Pair) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Pair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Pair.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (dst *Pair) XXX_Merge(src proto.Message) { - xxx_messageInfo_Pair.Merge(dst, src) -} -func (m *Pair) XXX_Size() int { - return m.Size() -} -func (m *Pair) XXX_DiscardUnknown() { - xxx_messageInfo_Pair.DiscardUnknown(m) -} - -var xxx_messageInfo_Pair proto.InternalMessageInfo - -func (m *Pair) GetKey() string { - if m != nil { - return m.Key - } - return "" -} - -func (m *Pair) GetValue() string { - if m != nil { - return m.Value - } - return "" -} - -func init() { - proto.RegisterType((*Entry)(nil), "com.alibaba.otter.canal.protocol.Entry") - proto.RegisterType((*Header)(nil), "com.alibaba.otter.canal.protocol.Header") - proto.RegisterType((*Column)(nil), "com.alibaba.otter.canal.protocol.Column") - proto.RegisterType((*RowData)(nil), "com.alibaba.otter.canal.protocol.RowData") - proto.RegisterType((*RowChange)(nil), "com.alibaba.otter.canal.protocol.RowChange") - proto.RegisterType((*TransactionBegin)(nil), "com.alibaba.otter.canal.protocol.TransactionBegin") - proto.RegisterType((*TransactionEnd)(nil), "com.alibaba.otter.canal.protocol.TransactionEnd") - proto.RegisterType((*Pair)(nil), "com.alibaba.otter.canal.protocol.Pair") - proto.RegisterEnum("com.alibaba.otter.canal.protocol.EntryType", EntryType_name, EntryType_value) - proto.RegisterEnum("com.alibaba.otter.canal.protocol.EventType", EventType_name, EventType_value) - proto.RegisterEnum("com.alibaba.otter.canal.protocol.Type", Type_name, Type_value) -} -func (m *Entry) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Entry) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.Header.Size())) - n1, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.EntryTypePresent != nil { - nn2, err := m.EntryTypePresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn2 - } - if len(m.StoreValue) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.StoreValue))) - i += copy(dAtA[i:], m.StoreValue) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Entry_EntryType) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x10 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.EntryType)) - return i, nil -} -func (m *Header) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Header) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.VersionPresent != nil { - nn3, err := m.VersionPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn3 - } - if len(m.LogfileName) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.LogfileName))) - i += copy(dAtA[i:], m.LogfileName) - } - if m.LogfileOffset != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.LogfileOffset)) - } - if m.ServerId != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.ServerId)) - } - if len(m.ServerenCode) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.ServerenCode))) - i += copy(dAtA[i:], m.ServerenCode) - } - if m.ExecuteTime != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.ExecuteTime)) - } - if m.SourceTypePresent != nil { - nn4, err := m.SourceTypePresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn4 - } - if len(m.SchemaName) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.SchemaName))) - i += copy(dAtA[i:], m.SchemaName) - } - if len(m.TableName) > 0 { - dAtA[i] = 0x4a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.TableName))) - i += copy(dAtA[i:], m.TableName) - } - if m.EventLength != 0 { - dAtA[i] = 0x50 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.EventLength)) - } - if m.EventTypePresent != nil { - nn5, err := m.EventTypePresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn5 - } - if len(m.Props) > 0 { - for _, msg := range m.Props { - dAtA[i] = 0x62 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Gtid) > 0 { - dAtA[i] = 0x6a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.Gtid))) - i += copy(dAtA[i:], m.Gtid) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Header_Version) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x8 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.Version)) - return i, nil -} -func (m *Header_SourceType) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x38 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.SourceType)) - return i, nil -} -func (m *Header_EventType) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x58 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.EventType)) - return i, nil -} -func (m *Column) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Column) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Index != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.Index)) - } - if m.SqlType != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.SqlType)) - } - if len(m.Name) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if m.IsKey { - dAtA[i] = 0x20 - i++ - if m.IsKey { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if m.Updated { - dAtA[i] = 0x28 - i++ - if m.Updated { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if m.IsNullPresent != nil { - nn6, err := m.IsNullPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn6 - } - if len(m.Props) > 0 { - for _, msg := range m.Props { - dAtA[i] = 0x3a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Value) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if m.Length != 0 { - dAtA[i] = 0x48 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.Length)) - } - if len(m.MysqlType) > 0 { - dAtA[i] = 0x52 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.MysqlType))) - i += copy(dAtA[i:], m.MysqlType) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Column_IsNull) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x30 - i++ - if m.IsNull { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - return i, nil -} -func (m *RowData) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RowData) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.BeforeColumns) > 0 { - for _, msg := range m.BeforeColumns { - dAtA[i] = 0xa - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.AfterColumns) > 0 { - for _, msg := range m.AfterColumns { - dAtA[i] = 0x12 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Props) > 0 { - for _, msg := range m.Props { - dAtA[i] = 0x1a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RowChange) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *RowChange) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.TableId != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.TableId)) - } - if m.EventTypePresent != nil { - nn7, err := m.EventTypePresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn7 - } - if m.IsDdlPresent != nil { - nn8, err := m.IsDdlPresent.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn8 - } - if len(m.Sql) > 0 { - dAtA[i] = 0x5a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.Sql))) - i += copy(dAtA[i:], m.Sql) - } - if len(m.RowDatas) > 0 { - for _, msg := range m.RowDatas { - dAtA[i] = 0x62 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Props) > 0 { - for _, msg := range m.Props { - dAtA[i] = 0x6a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.DdlSchemaName) > 0 { - dAtA[i] = 0x72 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.DdlSchemaName))) - i += copy(dAtA[i:], m.DdlSchemaName) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *RowChange_EventType) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x10 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.EventType)) - return i, nil -} -func (m *RowChange_IsDdl) MarshalTo(dAtA []byte) (int, error) { - i := 0 - dAtA[i] = 0x50 - i++ - if m.IsDdl { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - return i, nil -} -func (m *TransactionBegin) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TransactionBegin) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.ExecuteTime != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.ExecuteTime)) - } - if len(m.TransactionId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.TransactionId))) - i += copy(dAtA[i:], m.TransactionId) - } - if len(m.Props) > 0 { - for _, msg := range m.Props { - dAtA[i] = 0x1a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.ThreadId != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.ThreadId)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *TransactionEnd) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TransactionEnd) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.ExecuteTime != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(m.ExecuteTime)) - } - if len(m.TransactionId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.TransactionId))) - i += copy(dAtA[i:], m.TransactionId) - } - if len(m.Props) > 0 { - for _, msg := range m.Props { - dAtA[i] = 0x1a - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *Pair) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Pair) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintEntryProtocol(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintEntryProtocol(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *Entry) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.EntryTypePresent != nil { - n += m.EntryTypePresent.Size() - } - l = len(m.StoreValue) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Entry_EntryType) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovEntryProtocol(uint64(m.EntryType)) - return n -} -func (m *Header) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.VersionPresent != nil { - n += m.VersionPresent.Size() - } - l = len(m.LogfileName) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.LogfileOffset != 0 { - n += 1 + sovEntryProtocol(uint64(m.LogfileOffset)) - } - if m.ServerId != 0 { - n += 1 + sovEntryProtocol(uint64(m.ServerId)) - } - l = len(m.ServerenCode) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.ExecuteTime != 0 { - n += 1 + sovEntryProtocol(uint64(m.ExecuteTime)) - } - if m.SourceTypePresent != nil { - n += m.SourceTypePresent.Size() - } - l = len(m.SchemaName) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - l = len(m.TableName) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.EventLength != 0 { - n += 1 + sovEntryProtocol(uint64(m.EventLength)) - } - if m.EventTypePresent != nil { - n += m.EventTypePresent.Size() - } - if len(m.Props) > 0 { - for _, e := range m.Props { - l = e.Size() - n += 1 + l + sovEntryProtocol(uint64(l)) - } - } - l = len(m.Gtid) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Header_Version) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovEntryProtocol(uint64(m.Version)) - return n -} -func (m *Header_SourceType) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovEntryProtocol(uint64(m.SourceType)) - return n -} -func (m *Header_EventType) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovEntryProtocol(uint64(m.EventType)) - return n -} -func (m *Column) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Index != 0 { - n += 1 + sovEntryProtocol(uint64(m.Index)) - } - if m.SqlType != 0 { - n += 1 + sovEntryProtocol(uint64(m.SqlType)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.IsKey { - n += 2 - } - if m.Updated { - n += 2 - } - if m.IsNullPresent != nil { - n += m.IsNullPresent.Size() - } - if len(m.Props) > 0 { - for _, e := range m.Props { - l = e.Size() - n += 1 + l + sovEntryProtocol(uint64(l)) - } - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.Length != 0 { - n += 1 + sovEntryProtocol(uint64(m.Length)) - } - l = len(m.MysqlType) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Column_IsNull) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 2 - return n -} -func (m *RowData) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.BeforeColumns) > 0 { - for _, e := range m.BeforeColumns { - l = e.Size() - n += 1 + l + sovEntryProtocol(uint64(l)) - } - } - if len(m.AfterColumns) > 0 { - for _, e := range m.AfterColumns { - l = e.Size() - n += 1 + l + sovEntryProtocol(uint64(l)) - } - } - if len(m.Props) > 0 { - for _, e := range m.Props { - l = e.Size() - n += 1 + l + sovEntryProtocol(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RowChange) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.TableId != 0 { - n += 1 + sovEntryProtocol(uint64(m.TableId)) - } - if m.EventTypePresent != nil { - n += m.EventTypePresent.Size() - } - if m.IsDdlPresent != nil { - n += m.IsDdlPresent.Size() - } - l = len(m.Sql) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if len(m.RowDatas) > 0 { - for _, e := range m.RowDatas { - l = e.Size() - n += 1 + l + sovEntryProtocol(uint64(l)) - } - } - if len(m.Props) > 0 { - for _, e := range m.Props { - l = e.Size() - n += 1 + l + sovEntryProtocol(uint64(l)) - } - } - l = len(m.DdlSchemaName) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *RowChange_EventType) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 1 + sovEntryProtocol(uint64(m.EventType)) - return n -} -func (m *RowChange_IsDdl) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - n += 2 - return n -} -func (m *TransactionBegin) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ExecuteTime != 0 { - n += 1 + sovEntryProtocol(uint64(m.ExecuteTime)) - } - l = len(m.TransactionId) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if len(m.Props) > 0 { - for _, e := range m.Props { - l = e.Size() - n += 1 + l + sovEntryProtocol(uint64(l)) - } - } - if m.ThreadId != 0 { - n += 1 + sovEntryProtocol(uint64(m.ThreadId)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *TransactionEnd) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ExecuteTime != 0 { - n += 1 + sovEntryProtocol(uint64(m.ExecuteTime)) - } - l = len(m.TransactionId) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if len(m.Props) > 0 { - for _, e := range m.Props { - l = e.Size() - n += 1 + l + sovEntryProtocol(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *Pair) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Key) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - l = len(m.Value) - if l > 0 { - n += 1 + l + sovEntryProtocol(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovEntryProtocol(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozEntryProtocol(x uint64) (n int) { - return sovEntryProtocol(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Entry) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Entry: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Entry: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &Header{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EntryType", wireType) - } - var v EntryType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (EntryType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.EntryTypePresent = &Entry_EntryType{v} - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StoreValue", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StoreValue = append(m.StoreValue[:0], dAtA[iNdEx:postIndex]...) - if m.StoreValue == nil { - m.StoreValue = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEntryProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEntryProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Header) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Header: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.VersionPresent = &Header_Version{v} - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LogfileName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LogfileName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LogfileOffset", wireType) - } - m.LogfileOffset = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LogfileOffset |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ServerId", wireType) - } - m.ServerId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ServerId |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServerenCode", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServerenCode = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExecuteTime", wireType) - } - m.ExecuteTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExecuteTime |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SourceType", wireType) - } - var v Type - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (Type(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.SourceTypePresent = &Header_SourceType{v} - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SchemaName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SchemaName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TableName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TableName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EventLength", wireType) - } - m.EventLength = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EventLength |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EventType", wireType) - } - var v EventType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (EventType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.EventTypePresent = &Header_EventType{v} - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Props", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Props = append(m.Props, &Pair{}) - if err := m.Props[len(m.Props)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Gtid", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Gtid = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEntryProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEntryProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Column) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Column: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Column: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Index |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SqlType", wireType) - } - m.SqlType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SqlType |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsKey", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.IsKey = bool(v != 0) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Updated", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Updated = bool(v != 0) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsNull", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.IsNullPresent = &Column_IsNull{b} - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Props", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Props = append(m.Props, &Pair{}) - if err := m.Props[len(m.Props)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Length", wireType) - } - m.Length = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Length |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MysqlType", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MysqlType = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEntryProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEntryProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RowData) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RowData: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RowData: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BeforeColumns", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BeforeColumns = append(m.BeforeColumns, &Column{}) - if err := m.BeforeColumns[len(m.BeforeColumns)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AfterColumns", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AfterColumns = append(m.AfterColumns, &Column{}) - if err := m.AfterColumns[len(m.AfterColumns)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Props", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Props = append(m.Props, &Pair{}) - if err := m.Props[len(m.Props)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEntryProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEntryProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RowChange) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: RowChange: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RowChange: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TableId", wireType) - } - m.TableId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TableId |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EventType", wireType) - } - var v EventType - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (EventType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.EventTypePresent = &RowChange_EventType{v} - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsDdl", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.IsDdlPresent = &RowChange_IsDdl{b} - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sql", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sql = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RowDatas", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RowDatas = append(m.RowDatas, &RowData{}) - if err := m.RowDatas[len(m.RowDatas)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Props", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Props = append(m.Props, &Pair{}) - if err := m.Props[len(m.Props)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DdlSchemaName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DdlSchemaName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEntryProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEntryProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TransactionBegin) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TransactionBegin: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TransactionBegin: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExecuteTime", wireType) - } - m.ExecuteTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExecuteTime |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransactionId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Props", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Props = append(m.Props, &Pair{}) - if err := m.Props[len(m.Props)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ThreadId", wireType) - } - m.ThreadId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ThreadId |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipEntryProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEntryProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TransactionEnd) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TransactionEnd: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TransactionEnd: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ExecuteTime", wireType) - } - m.ExecuteTime = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ExecuteTime |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransactionId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Props", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Props = append(m.Props, &Pair{}) - if err := m.Props[len(m.Props)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEntryProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEntryProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Pair) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Pair: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Pair: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthEntryProtocol - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipEntryProtocol(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthEntryProtocol - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipEntryProtocol(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthEntryProtocol - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowEntryProtocol - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipEntryProtocol(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthEntryProtocol = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowEntryProtocol = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("EntryProtocol.proto", fileDescriptor_EntryProtocol_7c77ea7eaea22aeb) } - -var fileDescriptor_EntryProtocol_7c77ea7eaea22aeb = []byte{ - // 1071 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x16, 0xf5, 0xcf, 0xd1, 0x8f, 0x37, 0x1b, 0x23, 0x60, 0x83, 0xd6, 0x10, 0x04, 0xa3, 0x70, - 0x5d, 0x40, 0x07, 0xf7, 0xda, 0x43, 0x48, 0x6a, 0x61, 0x09, 0x96, 0x28, 0x65, 0xbd, 0x4e, 0xed, - 0x53, 0x41, 0x8b, 0x6b, 0x5b, 0x28, 0x45, 0x2a, 0x24, 0xe5, 0xc4, 0x87, 0xbe, 0x46, 0xd1, 0xe7, - 0x28, 0xfa, 0x10, 0x05, 0x7a, 0xe9, 0xa5, 0xf7, 0xc2, 0x45, 0x8e, 0x7d, 0x87, 0x62, 0x97, 0x7f, - 0x52, 0xdb, 0x40, 0x8e, 0x7b, 0xc9, 0x6d, 0x66, 0xb4, 0xdf, 0xec, 0x37, 0x33, 0xdf, 0x2c, 0x05, - 0x4f, 0x89, 0x17, 0x05, 0x77, 0xd3, 0xc0, 0x8f, 0xfc, 0x99, 0xef, 0xf6, 0x96, 0xc2, 0xc0, 0x9d, - 0x99, 0xbf, 0xe8, 0xd9, 0xee, 0xfc, 0xd2, 0xbe, 0xb4, 0x7b, 0x7e, 0x14, 0xf1, 0xa0, 0x37, 0xb3, - 0x3d, 0x3b, 0xf9, 0x79, 0xe6, 0xbb, 0xdd, 0x5f, 0x15, 0xa8, 0x48, 0x24, 0x7e, 0x01, 0xd5, 0x1b, - 0x6e, 0x3b, 0x3c, 0xd0, 0x94, 0x8e, 0x72, 0xd0, 0x38, 0x3a, 0xe8, 0x6d, 0x03, 0xf7, 0x06, 0xf2, - 0x3c, 0x4d, 0x70, 0xf8, 0x04, 0x54, 0x2e, 0x52, 0xb1, 0xbb, 0x25, 0xd7, 0x8a, 0x1d, 0xe5, 0xa0, - 0x7d, 0xf4, 0xe5, 0xf6, 0x24, 0x24, 0x85, 0x0c, 0x0a, 0x34, 0xc7, 0xe3, 0x3d, 0x80, 0x30, 0xf2, - 0x03, 0xfe, 0xca, 0x76, 0x57, 0x5c, 0x2b, 0x75, 0x94, 0x83, 0x26, 0x5d, 0x8b, 0x18, 0x4f, 0xe1, - 0x49, 0x76, 0xf8, 0xdb, 0x65, 0xc0, 0x43, 0xee, 0x45, 0xdd, 0xdf, 0xcb, 0x50, 0x8d, 0x49, 0xe1, - 0xe7, 0x50, 0xbb, 0xe5, 0x41, 0x38, 0xf7, 0x3d, 0x59, 0x4f, 0x65, 0x50, 0xa0, 0x69, 0x00, 0x77, - 0xa0, 0xe1, 0xfa, 0xd7, 0x57, 0x73, 0x97, 0x5b, 0xf6, 0x22, 0xa6, 0xaa, 0xd2, 0xf5, 0x10, 0xde, - 0x87, 0x56, 0xe2, 0x4e, 0xae, 0xae, 0x42, 0x1e, 0x49, 0x02, 0x25, 0xba, 0x19, 0xc4, 0xcf, 0xa1, - 0x1e, 0xf2, 0xe0, 0x96, 0x07, 0x43, 0x47, 0x2b, 0xcb, 0x03, 0x99, 0x8f, 0xbb, 0xd0, 0x8c, 0x6d, - 0xee, 0x99, 0xbe, 0xc3, 0xb5, 0x8a, 0xbc, 0x64, 0x23, 0x26, 0x78, 0xf0, 0xb7, 0x7c, 0xb6, 0x8a, - 0x38, 0x9b, 0x2f, 0xb8, 0x56, 0x95, 0x29, 0xd6, 0x43, 0x78, 0x00, 0x10, 0xfa, 0xab, 0x60, 0xc6, - 0x65, 0x4f, 0x6b, 0xb2, 0xa7, 0x9f, 0x6f, 0xef, 0xa9, 0x6c, 0xa7, 0x42, 0xd7, 0xb0, 0xb2, 0x9f, - 0xb3, 0x1b, 0xbe, 0xb0, 0x65, 0xc9, 0x75, 0xc9, 0x66, 0x2d, 0x82, 0x3f, 0x05, 0x35, 0xb2, 0x2f, - 0x93, 0x8e, 0xa8, 0xf2, 0xe7, 0x3c, 0x20, 0x99, 0xde, 0x72, 0x2f, 0x1a, 0x71, 0xef, 0x3a, 0xba, - 0xd1, 0x20, 0x61, 0x9a, 0x87, 0xe4, 0xf0, 0x85, 0x2b, 0x89, 0x36, 0x1e, 0x3c, 0xfc, 0x14, 0x32, - 0x28, 0xd2, 0x1c, 0x8f, 0xbf, 0x86, 0xca, 0x32, 0xf0, 0x97, 0xa1, 0xd6, 0xec, 0x94, 0x0e, 0x1a, - 0x0f, 0xa9, 0x78, 0x6a, 0xcf, 0x03, 0x1a, 0x83, 0x30, 0x86, 0xf2, 0x75, 0x34, 0x77, 0xb4, 0x96, - 0xac, 0x42, 0xda, 0xc6, 0x13, 0xd8, 0x49, 0xa6, 0x9f, 0x8a, 0xc5, 0xd8, 0x05, 0x9c, 0xf7, 0x27, - 0x8b, 0x0a, 0x5d, 0xa5, 0x3c, 0x32, 0x5d, 0xfd, 0x54, 0x84, 0xaa, 0xe9, 0xbb, 0xab, 0x85, 0x87, - 0x77, 0xa1, 0x32, 0xf7, 0x1c, 0xfe, 0x36, 0x56, 0x15, 0x8d, 0x1d, 0xac, 0x41, 0x2d, 0x7c, 0xed, - 0x66, 0xc2, 0xaf, 0xd0, 0xd4, 0x15, 0x64, 0x3c, 0xd1, 0xd2, 0x52, 0x4c, 0x46, 0xd8, 0x32, 0x47, - 0x78, 0xc2, 0xef, 0xa4, 0x68, 0xea, 0x34, 0x76, 0x44, 0x8e, 0xd5, 0xd2, 0xb1, 0x23, 0xee, 0x48, - 0xb1, 0xd4, 0x69, 0xea, 0x62, 0x0d, 0xaa, 0xf3, 0xd0, 0x5a, 0xb9, 0xae, 0x94, 0x48, 0x7d, 0x50, - 0xa0, 0x89, 0x9f, 0x37, 0xaa, 0xf6, 0x98, 0x46, 0xed, 0x42, 0xe5, 0x56, 0xae, 0x57, 0x2c, 0x87, - 0xd8, 0xc1, 0xcf, 0xa0, 0xea, 0xc6, 0x63, 0x56, 0x65, 0x29, 0x89, 0x27, 0x14, 0xb2, 0xb8, 0x4b, - 0xab, 0x84, 0x58, 0x21, 0x59, 0xc0, 0x40, 0xd0, 0x8e, 0x39, 0x65, 0x4d, 0x7b, 0xa7, 0x40, 0x8d, - 0xfa, 0x6f, 0xfa, 0x76, 0x64, 0x63, 0x0b, 0x5a, 0x97, 0xfc, 0xca, 0x0f, 0x78, 0xdc, 0xc5, 0x50, - 0x53, 0x24, 0xdf, 0x07, 0xbc, 0x31, 0x31, 0x80, 0x6e, 0xc2, 0xf1, 0x08, 0x9a, 0xf6, 0x55, 0xc4, - 0x83, 0x34, 0x5d, 0xf1, 0x03, 0xd3, 0x6d, 0xa0, 0xf3, 0x2e, 0x96, 0x1e, 0xd1, 0xc5, 0xee, 0x5f, - 0x45, 0x50, 0xa9, 0xff, 0xc6, 0xbc, 0xb1, 0xbd, 0x6b, 0x2e, 0xa6, 0x28, 0xd7, 0x66, 0xe8, 0x48, - 0x85, 0x94, 0x68, 0xea, 0x6e, 0x6e, 0x48, 0xf1, 0xc3, 0x37, 0xa4, 0xb0, 0xbe, 0x21, 0xcf, 0x84, - 0x84, 0xfa, 0x8e, 0x2b, 0x07, 0x51, 0x1f, 0x28, 0x34, 0x76, 0x31, 0x82, 0x52, 0xf8, 0xda, 0x95, - 0x0b, 0xa8, 0x52, 0x61, 0x62, 0x02, 0xf5, 0x20, 0x9e, 0x42, 0xba, 0x4e, 0x5f, 0x6c, 0xbf, 0x35, - 0x99, 0x1b, 0xcd, 0xa0, 0x79, 0x8f, 0x5a, 0x8f, 0x51, 0xda, 0x3e, 0xb4, 0x1c, 0xc7, 0x3d, 0xcd, - 0x1f, 0xa0, 0xb6, 0x24, 0xb8, 0x19, 0xfc, 0xcf, 0xdd, 0x33, 0x76, 0xa0, 0x25, 0x4b, 0xcb, 0x74, - 0xf5, 0xb3, 0x02, 0x88, 0x05, 0xb6, 0x17, 0xda, 0xb3, 0x68, 0xee, 0x7b, 0x06, 0xbf, 0x9e, 0x7b, - 0xff, 0x7c, 0x4a, 0x95, 0x7f, 0x3f, 0xa5, 0xfb, 0xd0, 0x8a, 0x72, 0xd4, 0xd0, 0x49, 0x9e, 0xfd, - 0xcd, 0xe0, 0xff, 0x93, 0x82, 0xf8, 0x20, 0x44, 0x37, 0x01, 0xb7, 0x9d, 0xfc, 0x83, 0x90, 0xfa, - 0xdd, 0x1f, 0x14, 0x68, 0xaf, 0xd1, 0x26, 0x9e, 0xf3, 0x71, 0x90, 0xee, 0xf6, 0xa0, 0x2c, 0x5c, - 0x21, 0x9d, 0xef, 0xf8, 0x9d, 0x64, 0xa1, 0x52, 0x61, 0xe6, 0xef, 0x43, 0x71, 0xed, 0x7d, 0x38, - 0xfc, 0x1e, 0xd4, 0xec, 0x9b, 0x8d, 0x3f, 0x83, 0x4f, 0x88, 0xc5, 0xe8, 0x05, 0xbb, 0x98, 0x12, - 0x73, 0x32, 0x9e, 0xea, 0x6c, 0x68, 0x8c, 0xc8, 0x94, 0x4e, 0xd8, 0xe4, 0x08, 0x15, 0xf0, 0x2e, - 0x20, 0x46, 0x75, 0xeb, 0x54, 0x37, 0xd9, 0x70, 0x62, 0x19, 0xe4, 0x78, 0x68, 0x21, 0x05, 0x37, - 0xa0, 0x46, 0x27, 0xdf, 0xf4, 0x75, 0xa6, 0xa3, 0x22, 0xc6, 0xd0, 0x5e, 0x3b, 0x42, 0xac, 0x3e, - 0x2a, 0xe1, 0x16, 0xa8, 0x03, 0xa2, 0x53, 0x66, 0x10, 0x9d, 0xa1, 0xb2, 0x38, 0x7f, 0xcc, 0x86, - 0xfd, 0xd1, 0xe4, 0x18, 0x55, 0x0e, 0xdf, 0x29, 0xa0, 0x66, 0x4b, 0x21, 0xef, 0x7f, 0x45, 0x2c, - 0xf6, 0x9e, 0xfb, 0x01, 0xaa, 0x43, 0xeb, 0x94, 0x50, 0x86, 0x14, 0x61, 0x9f, 0x4d, 0xfb, 0x3a, - 0x23, 0xa8, 0x28, 0xec, 0x3e, 0x19, 0x11, 0x46, 0x50, 0x49, 0xd8, 0x26, 0x25, 0x22, 0x5e, 0xc6, - 0x2a, 0x54, 0xf4, 0x11, 0x23, 0x14, 0x55, 0x84, 0x49, 0xa8, 0x7e, 0x4a, 0x50, 0x55, 0x98, 0x2f, - 0xcf, 0x08, 0xbd, 0x40, 0x35, 0xdc, 0x84, 0x3a, 0xa3, 0x67, 0x96, 0x29, 0x8e, 0xd7, 0x05, 0x94, - 0x12, 0x4b, 0x1f, 0x13, 0xa4, 0xca, 0x34, 0x43, 0xab, 0x4f, 0xce, 0x11, 0xc8, 0xf4, 0xb1, 0xdd, - 0xc0, 0x75, 0x28, 0x0b, 0xf2, 0xa8, 0x29, 0xb0, 0xe7, 0xba, 0x39, 0x19, 0x8f, 0x87, 0x0c, 0xb5, - 0x70, 0x1b, 0xe0, 0x5c, 0xa7, 0x93, 0xd1, 0xc8, 0xd0, 0xcd, 0x13, 0xd4, 0x16, 0xfe, 0x38, 0x2f, - 0x7a, 0xe7, 0xd0, 0x80, 0xb2, 0xac, 0x50, 0x83, 0xdd, 0xf7, 0x17, 0x37, 0xa1, 0xba, 0x39, 0x22, - 0x48, 0x11, 0x14, 0xc7, 0x17, 0xa7, 0x2f, 0x47, 0xa8, 0x28, 0xcc, 0xe9, 0xb1, 0x30, 0x4b, 0xc6, - 0x8b, 0x5f, 0xee, 0xf7, 0x94, 0xdf, 0xee, 0xf7, 0x94, 0x3f, 0xee, 0xf7, 0x94, 0x1f, 0xff, 0xdc, - 0x2b, 0xc0, 0xd6, 0x7f, 0x84, 0x06, 0x98, 0xc2, 0x97, 0x13, 0x1e, 0x28, 0x97, 0x55, 0x19, 0xff, - 0xea, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x2a, 0xd4, 0xa2, 0x5f, 0x0a, 0x00, 0x00, -} diff --git a/protocol/Message.go b/protocol/Message.go deleted file mode 100644 index a9530e4..0000000 --- a/protocol/Message.go +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com_alibaba_otter_canal_protocol - -type Message struct { - Id int64 - Entries []Entry - Raw bool - RawEntries interface{} -} - -func NewMessage(id int64) *Message { - message := &Message{Id: id, Entries: nil, Raw: false, RawEntries: nil} - return message -} diff --git a/protocol/client_identity.go b/protocol/client_identity.go index 6a17928..a6efb9b 100644 --- a/protocol/client_identity.go +++ b/protocol/client_identity.go @@ -14,7 +14,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com_alibaba_otter_canal_protocol +package protocol type ClientIdentity struct { Destination string diff --git a/protocol/doc.go b/protocol/doc.go index 669ece0..076d157 100644 --- a/protocol/doc.go +++ b/protocol/doc.go @@ -14,4 +14,4 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com_alibaba_otter_canal_protocol +package protocol diff --git a/protocol/entry/entry_protocol.pb.go b/protocol/entry/entry_protocol.pb.go new file mode 100644 index 0000000..5b8c460 --- /dev/null +++ b/protocol/entry/entry_protocol.pb.go @@ -0,0 +1,1457 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.24.4 +// source: entry_protocol.proto + +package entry + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// *打散后的事件类型,主要用于标识事务的开始,变更数据,结束* +type EntryType int32 + +const ( + EntryType_ENTRYTYPECOMPATIBLEPROTO2 EntryType = 0 + EntryType_TRANSACTIONBEGIN EntryType = 1 + EntryType_ROWDATA EntryType = 2 + EntryType_TRANSACTIONEND EntryType = 3 + // * 心跳类型,内部使用,外部暂不可见,可忽略 * + EntryType_HEARTBEAT EntryType = 4 + EntryType_GTIDLOG EntryType = 5 +) + +// Enum value maps for EntryType. +var ( + EntryType_name = map[int32]string{ + 0: "ENTRYTYPECOMPATIBLEPROTO2", + 1: "TRANSACTIONBEGIN", + 2: "ROWDATA", + 3: "TRANSACTIONEND", + 4: "HEARTBEAT", + 5: "GTIDLOG", + } + EntryType_value = map[string]int32{ + "ENTRYTYPECOMPATIBLEPROTO2": 0, + "TRANSACTIONBEGIN": 1, + "ROWDATA": 2, + "TRANSACTIONEND": 3, + "HEARTBEAT": 4, + "GTIDLOG": 5, + } +) + +func (x EntryType) Enum() *EntryType { + p := new(EntryType) + *p = x + return p +} + +func (x EntryType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (EntryType) Descriptor() protoreflect.EnumDescriptor { + return file_entry_protocol_proto_enumTypes[0].Descriptor() +} + +func (EntryType) Type() protoreflect.EnumType { + return &file_entry_protocol_proto_enumTypes[0] +} + +func (x EntryType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use EntryType.Descriptor instead. +func (EntryType) EnumDescriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{0} +} + +// * 事件类型 * +type EventType int32 + +const ( + EventType_EVENTTYPECOMPATIBLEPROTO2 EventType = 0 + EventType_INSERT EventType = 1 + EventType_UPDATE EventType = 2 + EventType_DELETE EventType = 3 + EventType_CREATE EventType = 4 + EventType_ALTER EventType = 5 + EventType_ERASE EventType = 6 + EventType_QUERY EventType = 7 + EventType_TRUNCATE EventType = 8 + EventType_RENAME EventType = 9 + // *CREATE INDEX* + EventType_CINDEX EventType = 10 + EventType_DINDEX EventType = 11 + EventType_GTID EventType = 12 + // * XA * + EventType_XACOMMIT EventType = 13 + EventType_XAROLLBACK EventType = 14 + // * MASTER HEARTBEAT * + EventType_MHEARTBEAT EventType = 15 +) + +// Enum value maps for EventType. +var ( + EventType_name = map[int32]string{ + 0: "EVENTTYPECOMPATIBLEPROTO2", + 1: "INSERT", + 2: "UPDATE", + 3: "DELETE", + 4: "CREATE", + 5: "ALTER", + 6: "ERASE", + 7: "QUERY", + 8: "TRUNCATE", + 9: "RENAME", + 10: "CINDEX", + 11: "DINDEX", + 12: "GTID", + 13: "XACOMMIT", + 14: "XAROLLBACK", + 15: "MHEARTBEAT", + } + EventType_value = map[string]int32{ + "EVENTTYPECOMPATIBLEPROTO2": 0, + "INSERT": 1, + "UPDATE": 2, + "DELETE": 3, + "CREATE": 4, + "ALTER": 5, + "ERASE": 6, + "QUERY": 7, + "TRUNCATE": 8, + "RENAME": 9, + "CINDEX": 10, + "DINDEX": 11, + "GTID": 12, + "XACOMMIT": 13, + "XAROLLBACK": 14, + "MHEARTBEAT": 15, + } +) + +func (x EventType) Enum() *EventType { + p := new(EventType) + *p = x + return p +} + +func (x EventType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (EventType) Descriptor() protoreflect.EnumDescriptor { + return file_entry_protocol_proto_enumTypes[1].Descriptor() +} + +func (EventType) Type() protoreflect.EnumType { + return &file_entry_protocol_proto_enumTypes[1] +} + +func (x EventType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use EventType.Descriptor instead. +func (EventType) EnumDescriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{1} +} + +// *数据库类型* +type Type int32 + +const ( + Type_TYPECOMPATIBLEPROTO2 Type = 0 + Type_ORACLE Type = 1 + Type_MYSQL Type = 2 + Type_PGSQL Type = 3 +) + +// Enum value maps for Type. +var ( + Type_name = map[int32]string{ + 0: "TYPECOMPATIBLEPROTO2", + 1: "ORACLE", + 2: "MYSQL", + 3: "PGSQL", + } + Type_value = map[string]int32{ + "TYPECOMPATIBLEPROTO2": 0, + "ORACLE": 1, + "MYSQL": 2, + "PGSQL": 3, + } +) + +func (x Type) Enum() *Type { + p := new(Type) + *p = x + return p +} + +func (x Type) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Type) Descriptor() protoreflect.EnumDescriptor { + return file_entry_protocol_proto_enumTypes[2].Descriptor() +} + +func (Type) Type() protoreflect.EnumType { + return &file_entry_protocol_proto_enumTypes[2] +} + +func (x Type) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Type.Descriptor instead. +func (Type) EnumDescriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{2} +} + +// *************************************************************** +// message model +// 如果要在Enum中新增类型,确保以前的类型的下标值不变. +// ************************************************************** +type Entry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // *协议头部信息* + Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + // /**打散后的事件类型**/ [default = ROWDATA] + // + // Types that are assignable to EntryTypePresent: + // + // *Entry_EntryType + EntryTypePresent isEntry_EntryTypePresent `protobuf_oneof:"entryType_present"` + // *传输的二进制数组* + StoreValue []byte `protobuf:"bytes,3,opt,name=storeValue,proto3" json:"storeValue,omitempty"` +} + +func (x *Entry) Reset() { + *x = Entry{} + if protoimpl.UnsafeEnabled { + mi := &file_entry_protocol_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Entry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Entry) ProtoMessage() {} + +func (x *Entry) ProtoReflect() protoreflect.Message { + mi := &file_entry_protocol_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Entry.ProtoReflect.Descriptor instead. +func (*Entry) Descriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{0} +} + +func (x *Entry) GetHeader() *Header { + if x != nil { + return x.Header + } + return nil +} + +func (m *Entry) GetEntryTypePresent() isEntry_EntryTypePresent { + if m != nil { + return m.EntryTypePresent + } + return nil +} + +func (x *Entry) GetEntryType() EntryType { + if x, ok := x.GetEntryTypePresent().(*Entry_EntryType); ok { + return x.EntryType + } + return EntryType_ENTRYTYPECOMPATIBLEPROTO2 +} + +func (x *Entry) GetStoreValue() []byte { + if x != nil { + return x.StoreValue + } + return nil +} + +type isEntry_EntryTypePresent interface { + isEntry_EntryTypePresent() +} + +type Entry_EntryType struct { + EntryType EntryType `protobuf:"varint,2,opt,name=entryType,proto3,enum=com.alibaba.otter.canal.protocol.EntryType,oneof"` +} + +func (*Entry_EntryType) isEntry_EntryTypePresent() {} + +// *message Header* +type Header struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // [default = 1] + // + // Types that are assignable to VersionPresent: + // + // *Header_Version + VersionPresent isHeader_VersionPresent `protobuf_oneof:"version_present"` + // *binlog/redolog 文件名* + LogfileName string `protobuf:"bytes,2,opt,name=logfileName,proto3" json:"logfileName,omitempty"` + // *binlog/redolog 文件的偏移位置* + LogfileOffset int64 `protobuf:"varint,3,opt,name=logfileOffset,proto3" json:"logfileOffset,omitempty"` + // *服务端serverId* + ServerId int64 `protobuf:"varint,4,opt,name=serverId,proto3" json:"serverId,omitempty"` + // * 变更数据的编码 * + ServerenCode string `protobuf:"bytes,5,opt,name=serverenCode,proto3" json:"serverenCode,omitempty"` + // *变更数据的执行时间 * + ExecuteTime int64 `protobuf:"varint,6,opt,name=executeTime,proto3" json:"executeTime,omitempty"` + // [default = MYSQL] + // + // Types that are assignable to SourceTypePresent: + // + // *Header_SourceType + SourceTypePresent isHeader_SourceTypePresent `protobuf_oneof:"sourceType_present"` + // * 变更数据的schemaname* + SchemaName string `protobuf:"bytes,8,opt,name=schemaName,proto3" json:"schemaName,omitempty"` + // *变更数据的tablename* + TableName string `protobuf:"bytes,9,opt,name=tableName,proto3" json:"tableName,omitempty"` + // *每个event的长度* + EventLength int64 `protobuf:"varint,10,opt,name=eventLength,proto3" json:"eventLength,omitempty"` + // [default = UPDATE] + // + // Types that are assignable to EventTypePresent: + // + // *Header_EventType + EventTypePresent isHeader_EventTypePresent `protobuf_oneof:"eventType_present"` + // *预留扩展* + Props []*Pair `protobuf:"bytes,12,rep,name=props,proto3" json:"props,omitempty"` + // *当前事务的gitd* + Gtid string `protobuf:"bytes,13,opt,name=gtid,proto3" json:"gtid,omitempty"` +} + +func (x *Header) Reset() { + *x = Header{} + if protoimpl.UnsafeEnabled { + mi := &file_entry_protocol_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Header) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Header) ProtoMessage() {} + +func (x *Header) ProtoReflect() protoreflect.Message { + mi := &file_entry_protocol_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Header.ProtoReflect.Descriptor instead. +func (*Header) Descriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{1} +} + +func (m *Header) GetVersionPresent() isHeader_VersionPresent { + if m != nil { + return m.VersionPresent + } + return nil +} + +func (x *Header) GetVersion() int32 { + if x, ok := x.GetVersionPresent().(*Header_Version); ok { + return x.Version + } + return 0 +} + +func (x *Header) GetLogfileName() string { + if x != nil { + return x.LogfileName + } + return "" +} + +func (x *Header) GetLogfileOffset() int64 { + if x != nil { + return x.LogfileOffset + } + return 0 +} + +func (x *Header) GetServerId() int64 { + if x != nil { + return x.ServerId + } + return 0 +} + +func (x *Header) GetServerenCode() string { + if x != nil { + return x.ServerenCode + } + return "" +} + +func (x *Header) GetExecuteTime() int64 { + if x != nil { + return x.ExecuteTime + } + return 0 +} + +func (m *Header) GetSourceTypePresent() isHeader_SourceTypePresent { + if m != nil { + return m.SourceTypePresent + } + return nil +} + +func (x *Header) GetSourceType() Type { + if x, ok := x.GetSourceTypePresent().(*Header_SourceType); ok { + return x.SourceType + } + return Type_TYPECOMPATIBLEPROTO2 +} + +func (x *Header) GetSchemaName() string { + if x != nil { + return x.SchemaName + } + return "" +} + +func (x *Header) GetTableName() string { + if x != nil { + return x.TableName + } + return "" +} + +func (x *Header) GetEventLength() int64 { + if x != nil { + return x.EventLength + } + return 0 +} + +func (m *Header) GetEventTypePresent() isHeader_EventTypePresent { + if m != nil { + return m.EventTypePresent + } + return nil +} + +func (x *Header) GetEventType() EventType { + if x, ok := x.GetEventTypePresent().(*Header_EventType); ok { + return x.EventType + } + return EventType_EVENTTYPECOMPATIBLEPROTO2 +} + +func (x *Header) GetProps() []*Pair { + if x != nil { + return x.Props + } + return nil +} + +func (x *Header) GetGtid() string { + if x != nil { + return x.Gtid + } + return "" +} + +type isHeader_VersionPresent interface { + isHeader_VersionPresent() +} + +type Header_Version struct { + Version int32 `protobuf:"varint,1,opt,name=version,proto3,oneof"` +} + +func (*Header_Version) isHeader_VersionPresent() {} + +type isHeader_SourceTypePresent interface { + isHeader_SourceTypePresent() +} + +type Header_SourceType struct { + SourceType Type `protobuf:"varint,7,opt,name=sourceType,proto3,enum=com.alibaba.otter.canal.protocol.Type,oneof"` +} + +func (*Header_SourceType) isHeader_SourceTypePresent() {} + +type isHeader_EventTypePresent interface { + isHeader_EventTypePresent() +} + +type Header_EventType struct { + EventType EventType `protobuf:"varint,11,opt,name=eventType,proto3,enum=com.alibaba.otter.canal.protocol.EventType,oneof"` +} + +func (*Header_EventType) isHeader_EventTypePresent() {} + +// *每个字段的数据结构* +type Column struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // *字段下标* + Index int32 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` + // *字段java中类型* + SqlType int32 `protobuf:"varint,2,opt,name=sqlType,proto3" json:"sqlType,omitempty"` + // *字段名称(忽略大小写),在mysql中是没有的* + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + // *是否是主键* + IsKey bool `protobuf:"varint,4,opt,name=isKey,proto3" json:"isKey,omitempty"` + // *如果EventType=UPDATE,用于标识这个字段值是否有修改* + Updated bool `protobuf:"varint,5,opt,name=updated,proto3" json:"updated,omitempty"` + // [default = false] + // + // Types that are assignable to IsNullPresent: + // + // *Column_IsNull + IsNullPresent isColumn_IsNullPresent `protobuf_oneof:"isNull_present"` + // *预留扩展* + Props []*Pair `protobuf:"bytes,7,rep,name=props,proto3" json:"props,omitempty"` + // * 字段值,timestamp,Datetime是一个时间格式的文本 * + Value string `protobuf:"bytes,8,opt,name=value,proto3" json:"value,omitempty"` + // * 对应数据对象原始长度 * + Length int32 `protobuf:"varint,9,opt,name=length,proto3" json:"length,omitempty"` + // *字段mysql类型* + MysqlType string `protobuf:"bytes,10,opt,name=mysqlType,proto3" json:"mysqlType,omitempty"` +} + +func (x *Column) Reset() { + *x = Column{} + if protoimpl.UnsafeEnabled { + mi := &file_entry_protocol_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Column) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Column) ProtoMessage() {} + +func (x *Column) ProtoReflect() protoreflect.Message { + mi := &file_entry_protocol_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Column.ProtoReflect.Descriptor instead. +func (*Column) Descriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{2} +} + +func (x *Column) GetIndex() int32 { + if x != nil { + return x.Index + } + return 0 +} + +func (x *Column) GetSqlType() int32 { + if x != nil { + return x.SqlType + } + return 0 +} + +func (x *Column) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Column) GetIsKey() bool { + if x != nil { + return x.IsKey + } + return false +} + +func (x *Column) GetUpdated() bool { + if x != nil { + return x.Updated + } + return false +} + +func (m *Column) GetIsNullPresent() isColumn_IsNullPresent { + if m != nil { + return m.IsNullPresent + } + return nil +} + +func (x *Column) GetIsNull() bool { + if x, ok := x.GetIsNullPresent().(*Column_IsNull); ok { + return x.IsNull + } + return false +} + +func (x *Column) GetProps() []*Pair { + if x != nil { + return x.Props + } + return nil +} + +func (x *Column) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +func (x *Column) GetLength() int32 { + if x != nil { + return x.Length + } + return 0 +} + +func (x *Column) GetMysqlType() string { + if x != nil { + return x.MysqlType + } + return "" +} + +type isColumn_IsNullPresent interface { + isColumn_IsNullPresent() +} + +type Column_IsNull struct { + IsNull bool `protobuf:"varint,6,opt,name=isNull,proto3,oneof"` +} + +func (*Column_IsNull) isColumn_IsNullPresent() {} + +type RowData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // * 字段信息,增量数据(修改前,删除前) * + BeforeColumns []*Column `protobuf:"bytes,1,rep,name=beforeColumns,proto3" json:"beforeColumns,omitempty"` + // * 字段信息,增量数据(修改后,新增后) * + AfterColumns []*Column `protobuf:"bytes,2,rep,name=afterColumns,proto3" json:"afterColumns,omitempty"` + // *预留扩展* + Props []*Pair `protobuf:"bytes,3,rep,name=props,proto3" json:"props,omitempty"` +} + +func (x *RowData) Reset() { + *x = RowData{} + if protoimpl.UnsafeEnabled { + mi := &file_entry_protocol_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RowData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RowData) ProtoMessage() {} + +func (x *RowData) ProtoReflect() protoreflect.Message { + mi := &file_entry_protocol_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RowData.ProtoReflect.Descriptor instead. +func (*RowData) Descriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{3} +} + +func (x *RowData) GetBeforeColumns() []*Column { + if x != nil { + return x.BeforeColumns + } + return nil +} + +func (x *RowData) GetAfterColumns() []*Column { + if x != nil { + return x.AfterColumns + } + return nil +} + +func (x *RowData) GetProps() []*Pair { + if x != nil { + return x.Props + } + return nil +} + +// *message row 每行变更数据的数据结构* +type RowChange struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // *tableId,由数据库产生* + TableId int64 `protobuf:"varint,1,opt,name=tableId,proto3" json:"tableId,omitempty"` + // [default = UPDATE] + // + // Types that are assignable to EventTypePresent: + // + // *RowChange_EventType + EventTypePresent isRowChange_EventTypePresent `protobuf_oneof:"eventType_present"` + // [default = false] + // + // Types that are assignable to IsDdlPresent: + // + // *RowChange_IsDdl + IsDdlPresent isRowChange_IsDdlPresent `protobuf_oneof:"isDdl_present"` + // * ddl/query的sql语句 * + Sql string `protobuf:"bytes,11,opt,name=sql,proto3" json:"sql,omitempty"` + // * 一次数据库变更可能存在多行 * + RowDatas []*RowData `protobuf:"bytes,12,rep,name=rowDatas,proto3" json:"rowDatas,omitempty"` + // *预留扩展* + Props []*Pair `protobuf:"bytes,13,rep,name=props,proto3" json:"props,omitempty"` + // * ddl/query的schemaName,会存在跨库ddl,需要保留执行ddl的当前schemaName * + DdlSchemaName string `protobuf:"bytes,14,opt,name=ddlSchemaName,proto3" json:"ddlSchemaName,omitempty"` +} + +func (x *RowChange) Reset() { + *x = RowChange{} + if protoimpl.UnsafeEnabled { + mi := &file_entry_protocol_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RowChange) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RowChange) ProtoMessage() {} + +func (x *RowChange) ProtoReflect() protoreflect.Message { + mi := &file_entry_protocol_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RowChange.ProtoReflect.Descriptor instead. +func (*RowChange) Descriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{4} +} + +func (x *RowChange) GetTableId() int64 { + if x != nil { + return x.TableId + } + return 0 +} + +func (m *RowChange) GetEventTypePresent() isRowChange_EventTypePresent { + if m != nil { + return m.EventTypePresent + } + return nil +} + +func (x *RowChange) GetEventType() EventType { + if x, ok := x.GetEventTypePresent().(*RowChange_EventType); ok { + return x.EventType + } + return EventType_EVENTTYPECOMPATIBLEPROTO2 +} + +func (m *RowChange) GetIsDdlPresent() isRowChange_IsDdlPresent { + if m != nil { + return m.IsDdlPresent + } + return nil +} + +func (x *RowChange) GetIsDdl() bool { + if x, ok := x.GetIsDdlPresent().(*RowChange_IsDdl); ok { + return x.IsDdl + } + return false +} + +func (x *RowChange) GetSql() string { + if x != nil { + return x.Sql + } + return "" +} + +func (x *RowChange) GetRowDatas() []*RowData { + if x != nil { + return x.RowDatas + } + return nil +} + +func (x *RowChange) GetProps() []*Pair { + if x != nil { + return x.Props + } + return nil +} + +func (x *RowChange) GetDdlSchemaName() string { + if x != nil { + return x.DdlSchemaName + } + return "" +} + +type isRowChange_EventTypePresent interface { + isRowChange_EventTypePresent() +} + +type RowChange_EventType struct { + EventType EventType `protobuf:"varint,2,opt,name=eventType,proto3,enum=com.alibaba.otter.canal.protocol.EventType,oneof"` +} + +func (*RowChange_EventType) isRowChange_EventTypePresent() {} + +type isRowChange_IsDdlPresent interface { + isRowChange_IsDdlPresent() +} + +type RowChange_IsDdl struct { + IsDdl bool `protobuf:"varint,10,opt,name=isDdl,proto3,oneof"` +} + +func (*RowChange_IsDdl) isRowChange_IsDdlPresent() {} + +// *开始事务的一些信息* +type TransactionBegin struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // *已废弃,请使用header里的executeTime* + ExecuteTime int64 `protobuf:"varint,1,opt,name=executeTime,proto3" json:"executeTime,omitempty"` + // *已废弃,Begin里不提供事务id* + TransactionId string `protobuf:"bytes,2,opt,name=transactionId,proto3" json:"transactionId,omitempty"` + // *预留扩展* + Props []*Pair `protobuf:"bytes,3,rep,name=props,proto3" json:"props,omitempty"` + // *执行的thread Id* + ThreadId int64 `protobuf:"varint,4,opt,name=threadId,proto3" json:"threadId,omitempty"` +} + +func (x *TransactionBegin) Reset() { + *x = TransactionBegin{} + if protoimpl.UnsafeEnabled { + mi := &file_entry_protocol_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransactionBegin) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransactionBegin) ProtoMessage() {} + +func (x *TransactionBegin) ProtoReflect() protoreflect.Message { + mi := &file_entry_protocol_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransactionBegin.ProtoReflect.Descriptor instead. +func (*TransactionBegin) Descriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{5} +} + +func (x *TransactionBegin) GetExecuteTime() int64 { + if x != nil { + return x.ExecuteTime + } + return 0 +} + +func (x *TransactionBegin) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +func (x *TransactionBegin) GetProps() []*Pair { + if x != nil { + return x.Props + } + return nil +} + +func (x *TransactionBegin) GetThreadId() int64 { + if x != nil { + return x.ThreadId + } + return 0 +} + +// *结束事务的一些信息* +type TransactionEnd struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // *已废弃,请使用header里的executeTime* + ExecuteTime int64 `protobuf:"varint,1,opt,name=executeTime,proto3" json:"executeTime,omitempty"` + // *事务号* + TransactionId string `protobuf:"bytes,2,opt,name=transactionId,proto3" json:"transactionId,omitempty"` + // *预留扩展* + Props []*Pair `protobuf:"bytes,3,rep,name=props,proto3" json:"props,omitempty"` +} + +func (x *TransactionEnd) Reset() { + *x = TransactionEnd{} + if protoimpl.UnsafeEnabled { + mi := &file_entry_protocol_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransactionEnd) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransactionEnd) ProtoMessage() {} + +func (x *TransactionEnd) ProtoReflect() protoreflect.Message { + mi := &file_entry_protocol_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransactionEnd.ProtoReflect.Descriptor instead. +func (*TransactionEnd) Descriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{6} +} + +func (x *TransactionEnd) GetExecuteTime() int64 { + if x != nil { + return x.ExecuteTime + } + return 0 +} + +func (x *TransactionEnd) GetTransactionId() string { + if x != nil { + return x.TransactionId + } + return "" +} + +func (x *TransactionEnd) GetProps() []*Pair { + if x != nil { + return x.Props + } + return nil +} + +// *预留扩展* +type Pair struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` +} + +func (x *Pair) Reset() { + *x = Pair{} + if protoimpl.UnsafeEnabled { + mi := &file_entry_protocol_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Pair) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Pair) ProtoMessage() {} + +func (x *Pair) ProtoReflect() protoreflect.Message { + mi := &file_entry_protocol_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Pair.ProtoReflect.Descriptor instead. +func (*Pair) Descriptor() ([]byte, []int) { + return file_entry_protocol_proto_rawDescGZIP(), []int{7} +} + +func (x *Pair) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Pair) GetValue() string { + if x != nil { + return x.Value + } + return "" +} + +var File_entry_protocol_proto protoreflect.FileDescriptor + +var file_entry_protocol_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x20, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, + 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x22, 0xcb, 0x01, 0x0a, 0x05, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x12, 0x40, 0x0a, 0x06, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, + 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x06, 0x68, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x12, 0x4b, 0x0a, 0x09, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, + 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, + 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x54, 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x09, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x56, 0x61, 0x6c, 0x75, + 0x65, 0x42, 0x13, 0x0a, 0x11, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x70, + 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x22, 0xd5, 0x04, 0x0a, 0x06, 0x48, 0x65, 0x61, 0x64, 0x65, + 0x72, 0x12, 0x1a, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x48, 0x00, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x0a, + 0x0b, 0x6c, 0x6f, 0x67, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0b, 0x6c, 0x6f, 0x67, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x24, 0x0a, 0x0d, 0x6c, 0x6f, 0x67, 0x66, 0x69, 0x6c, 0x65, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x6c, 0x6f, 0x67, 0x66, 0x69, 0x6c, 0x65, 0x4f, + 0x66, 0x66, 0x73, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, + 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x49, + 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x65, 0x6e, 0x43, 0x6f, 0x64, + 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x65, + 0x6e, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, + 0x54, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x65, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x48, 0x0a, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x63, 0x6f, + 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, + 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x54, + 0x79, 0x70, 0x65, 0x48, 0x01, 0x52, 0x0a, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4e, 0x61, 0x6d, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4e, 0x61, 0x6d, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x09, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x20, 0x0a, 0x0b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, + 0x68, 0x12, 0x4b, 0x0a, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, 0x61, + 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x48, 0x02, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x3c, + 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x70, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, + 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, + 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x70, 0x73, 0x12, 0x12, 0x0a, 0x04, + 0x67, 0x74, 0x69, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x67, 0x74, 0x69, 0x64, + 0x42, 0x11, 0x0a, 0x0f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x65, 0x73, + 0x65, 0x6e, 0x74, 0x42, 0x14, 0x0a, 0x12, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x42, 0x13, 0x0a, 0x11, 0x65, 0x76, 0x65, + 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x22, 0xb2, + 0x02, 0x0a, 0x06, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, + 0x18, 0x0a, 0x07, 0x73, 0x71, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x07, 0x73, 0x71, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x69, 0x73, 0x4b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x69, 0x73, + 0x4b, 0x65, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, + 0x06, 0x69, 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, + 0x06, 0x69, 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x12, 0x3c, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x70, 0x73, + 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, + 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, + 0x70, 0x72, 0x6f, 0x70, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, + 0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x65, 0x6e, + 0x67, 0x74, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x79, 0x73, 0x71, 0x6c, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x79, 0x73, 0x71, 0x6c, 0x54, 0x79, 0x70, + 0x65, 0x42, 0x10, 0x0a, 0x0e, 0x69, 0x73, 0x4e, 0x75, 0x6c, 0x6c, 0x5f, 0x70, 0x72, 0x65, 0x73, + 0x65, 0x6e, 0x74, 0x22, 0xe5, 0x01, 0x0a, 0x07, 0x52, 0x6f, 0x77, 0x44, 0x61, 0x74, 0x61, 0x12, + 0x4e, 0x0a, 0x0d, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, + 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, + 0x52, 0x0d, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, + 0x4c, 0x0a, 0x0c, 0x61, 0x66, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x18, + 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, + 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x52, + 0x0c, 0x61, 0x66, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6c, 0x75, 0x6d, 0x6e, 0x73, 0x12, 0x3c, 0x0a, + 0x05, 0x70, 0x72, 0x6f, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, + 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, + 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x70, 0x73, 0x22, 0xed, 0x02, 0x0a, 0x09, + 0x52, 0x6f, 0x77, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x49, 0x64, 0x12, 0x4b, 0x0a, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, + 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x48, 0x00, 0x52, 0x09, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x16, 0x0a, 0x05, 0x69, 0x73, 0x44, 0x64, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x48, + 0x01, 0x52, 0x05, 0x69, 0x73, 0x44, 0x64, 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x71, 0x6c, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x71, 0x6c, 0x12, 0x45, 0x0a, 0x08, 0x72, 0x6f, + 0x77, 0x44, 0x61, 0x74, 0x61, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, + 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, + 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x52, 0x6f, 0x77, 0x44, 0x61, 0x74, 0x61, 0x52, 0x08, 0x72, 0x6f, 0x77, 0x44, 0x61, 0x74, 0x61, + 0x73, 0x12, 0x3c, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x70, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, + 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x63, 0x6f, 0x6c, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x70, 0x73, 0x12, + 0x24, 0x0a, 0x0d, 0x64, 0x64, 0x6c, 0x53, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x4e, 0x61, 0x6d, 0x65, + 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x64, 0x64, 0x6c, 0x53, 0x63, 0x68, 0x65, 0x6d, + 0x61, 0x4e, 0x61, 0x6d, 0x65, 0x42, 0x13, 0x0a, 0x11, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, + 0x70, 0x65, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x42, 0x0f, 0x0a, 0x0d, 0x69, 0x73, + 0x44, 0x64, 0x6c, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x22, 0xb4, 0x01, 0x0a, 0x10, + 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x65, 0x67, 0x69, 0x6e, + 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x54, 0x69, + 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3c, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x70, + 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, + 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x50, 0x61, 0x69, 0x72, 0x52, + 0x05, 0x70, 0x72, 0x6f, 0x70, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, + 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, + 0x49, 0x64, 0x22, 0x96, 0x01, 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x45, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, + 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x65, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x3c, 0x0a, + 0x05, 0x70, 0x72, 0x6f, 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x63, + 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, + 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, + 0x50, 0x61, 0x69, 0x72, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x70, 0x73, 0x22, 0x2e, 0x0a, 0x04, 0x50, + 0x61, 0x69, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x2a, 0x7d, 0x0a, 0x09, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x45, 0x4e, 0x54, 0x52, + 0x59, 0x54, 0x59, 0x50, 0x45, 0x43, 0x4f, 0x4d, 0x50, 0x41, 0x54, 0x49, 0x42, 0x4c, 0x45, 0x50, + 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x52, 0x41, 0x4e, 0x53, + 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x0b, 0x0a, + 0x07, 0x52, 0x4f, 0x57, 0x44, 0x41, 0x54, 0x41, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x54, 0x52, + 0x41, 0x4e, 0x53, 0x41, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x45, 0x4e, 0x44, 0x10, 0x03, 0x12, 0x0d, + 0x0a, 0x09, 0x48, 0x45, 0x41, 0x52, 0x54, 0x42, 0x45, 0x41, 0x54, 0x10, 0x04, 0x12, 0x0b, 0x0a, + 0x07, 0x47, 0x54, 0x49, 0x44, 0x4c, 0x4f, 0x47, 0x10, 0x05, 0x2a, 0xe5, 0x01, 0x0a, 0x09, 0x45, + 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x45, 0x56, 0x45, 0x4e, + 0x54, 0x54, 0x59, 0x50, 0x45, 0x43, 0x4f, 0x4d, 0x50, 0x41, 0x54, 0x49, 0x42, 0x4c, 0x45, 0x50, + 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x49, 0x4e, 0x53, 0x45, 0x52, + 0x54, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x02, 0x12, + 0x0a, 0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x43, + 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x04, 0x12, 0x09, 0x0a, 0x05, 0x41, 0x4c, 0x54, 0x45, 0x52, + 0x10, 0x05, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x41, 0x53, 0x45, 0x10, 0x06, 0x12, 0x09, 0x0a, + 0x05, 0x51, 0x55, 0x45, 0x52, 0x59, 0x10, 0x07, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x52, 0x55, 0x4e, + 0x43, 0x41, 0x54, 0x45, 0x10, 0x08, 0x12, 0x0a, 0x0a, 0x06, 0x52, 0x45, 0x4e, 0x41, 0x4d, 0x45, + 0x10, 0x09, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x49, 0x4e, 0x44, 0x45, 0x58, 0x10, 0x0a, 0x12, 0x0a, + 0x0a, 0x06, 0x44, 0x49, 0x4e, 0x44, 0x45, 0x58, 0x10, 0x0b, 0x12, 0x08, 0x0a, 0x04, 0x47, 0x54, + 0x49, 0x44, 0x10, 0x0c, 0x12, 0x0c, 0x0a, 0x08, 0x58, 0x41, 0x43, 0x4f, 0x4d, 0x4d, 0x49, 0x54, + 0x10, 0x0d, 0x12, 0x0e, 0x0a, 0x0a, 0x58, 0x41, 0x52, 0x4f, 0x4c, 0x4c, 0x42, 0x41, 0x43, 0x4b, + 0x10, 0x0e, 0x12, 0x0e, 0x0a, 0x0a, 0x4d, 0x48, 0x45, 0x41, 0x52, 0x54, 0x42, 0x45, 0x41, 0x54, + 0x10, 0x0f, 0x2a, 0x42, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x14, 0x54, 0x59, + 0x50, 0x45, 0x43, 0x4f, 0x4d, 0x50, 0x41, 0x54, 0x49, 0x42, 0x4c, 0x45, 0x50, 0x52, 0x4f, 0x54, + 0x4f, 0x32, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x52, 0x41, 0x43, 0x4c, 0x45, 0x10, 0x01, + 0x12, 0x09, 0x0a, 0x05, 0x4d, 0x59, 0x53, 0x51, 0x4c, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x50, + 0x47, 0x53, 0x51, 0x4c, 0x10, 0x03, 0x42, 0x3a, 0x0a, 0x20, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, + 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, + 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x42, 0x0a, 0x43, 0x61, 0x6e, 0x61, + 0x6c, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x48, 0x01, 0x5a, 0x08, 0x2e, 0x2f, 0x3b, 0x65, 0x6e, 0x74, + 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_entry_protocol_proto_rawDescOnce sync.Once + file_entry_protocol_proto_rawDescData = file_entry_protocol_proto_rawDesc +) + +func file_entry_protocol_proto_rawDescGZIP() []byte { + file_entry_protocol_proto_rawDescOnce.Do(func() { + file_entry_protocol_proto_rawDescData = protoimpl.X.CompressGZIP(file_entry_protocol_proto_rawDescData) + }) + return file_entry_protocol_proto_rawDescData +} + +var file_entry_protocol_proto_enumTypes = make([]protoimpl.EnumInfo, 3) +var file_entry_protocol_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_entry_protocol_proto_goTypes = []interface{}{ + (EntryType)(0), // 0: com.alibaba.otter.canal.protocol.EntryType + (EventType)(0), // 1: com.alibaba.otter.canal.protocol.EventType + (Type)(0), // 2: com.alibaba.otter.canal.protocol.Type + (*Entry)(nil), // 3: com.alibaba.otter.canal.protocol.Entry + (*Header)(nil), // 4: com.alibaba.otter.canal.protocol.Header + (*Column)(nil), // 5: com.alibaba.otter.canal.protocol.Column + (*RowData)(nil), // 6: com.alibaba.otter.canal.protocol.RowData + (*RowChange)(nil), // 7: com.alibaba.otter.canal.protocol.RowChange + (*TransactionBegin)(nil), // 8: com.alibaba.otter.canal.protocol.TransactionBegin + (*TransactionEnd)(nil), // 9: com.alibaba.otter.canal.protocol.TransactionEnd + (*Pair)(nil), // 10: com.alibaba.otter.canal.protocol.Pair +} +var file_entry_protocol_proto_depIdxs = []int32{ + 4, // 0: com.alibaba.otter.canal.protocol.Entry.header:type_name -> com.alibaba.otter.canal.protocol.Header + 0, // 1: com.alibaba.otter.canal.protocol.Entry.entryType:type_name -> com.alibaba.otter.canal.protocol.EntryType + 2, // 2: com.alibaba.otter.canal.protocol.Header.sourceType:type_name -> com.alibaba.otter.canal.protocol.Type + 1, // 3: com.alibaba.otter.canal.protocol.Header.eventType:type_name -> com.alibaba.otter.canal.protocol.EventType + 10, // 4: com.alibaba.otter.canal.protocol.Header.props:type_name -> com.alibaba.otter.canal.protocol.Pair + 10, // 5: com.alibaba.otter.canal.protocol.Column.props:type_name -> com.alibaba.otter.canal.protocol.Pair + 5, // 6: com.alibaba.otter.canal.protocol.RowData.beforeColumns:type_name -> com.alibaba.otter.canal.protocol.Column + 5, // 7: com.alibaba.otter.canal.protocol.RowData.afterColumns:type_name -> com.alibaba.otter.canal.protocol.Column + 10, // 8: com.alibaba.otter.canal.protocol.RowData.props:type_name -> com.alibaba.otter.canal.protocol.Pair + 1, // 9: com.alibaba.otter.canal.protocol.RowChange.eventType:type_name -> com.alibaba.otter.canal.protocol.EventType + 6, // 10: com.alibaba.otter.canal.protocol.RowChange.rowDatas:type_name -> com.alibaba.otter.canal.protocol.RowData + 10, // 11: com.alibaba.otter.canal.protocol.RowChange.props:type_name -> com.alibaba.otter.canal.protocol.Pair + 10, // 12: com.alibaba.otter.canal.protocol.TransactionBegin.props:type_name -> com.alibaba.otter.canal.protocol.Pair + 10, // 13: com.alibaba.otter.canal.protocol.TransactionEnd.props:type_name -> com.alibaba.otter.canal.protocol.Pair + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name +} + +func init() { file_entry_protocol_proto_init() } +func file_entry_protocol_proto_init() { + if File_entry_protocol_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_entry_protocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Entry); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entry_protocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Header); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entry_protocol_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Column); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entry_protocol_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RowData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entry_protocol_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RowChange); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entry_protocol_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransactionBegin); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entry_protocol_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransactionEnd); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_entry_protocol_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Pair); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_entry_protocol_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Entry_EntryType)(nil), + } + file_entry_protocol_proto_msgTypes[1].OneofWrappers = []interface{}{ + (*Header_Version)(nil), + (*Header_SourceType)(nil), + (*Header_EventType)(nil), + } + file_entry_protocol_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*Column_IsNull)(nil), + } + file_entry_protocol_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*RowChange_EventType)(nil), + (*RowChange_IsDdl)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_entry_protocol_proto_rawDesc, + NumEnums: 3, + NumMessages: 8, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_entry_protocol_proto_goTypes, + DependencyIndexes: file_entry_protocol_proto_depIdxs, + EnumInfos: file_entry_protocol_proto_enumTypes, + MessageInfos: file_entry_protocol_proto_msgTypes, + }.Build() + File_entry_protocol_proto = out.File + file_entry_protocol_proto_rawDesc = nil + file_entry_protocol_proto_goTypes = nil + file_entry_protocol_proto_depIdxs = nil +} diff --git a/protocol/EntryProtocol.proto b/protocol/entry/entry_protocol.proto similarity index 56% rename from protocol/EntryProtocol.proto rename to protocol/entry/entry_protocol.proto index 63da73c..a3df31b 100644 --- a/protocol/EntryProtocol.proto +++ b/protocol/entry/entry_protocol.proto @@ -1,223 +1,231 @@ syntax = "proto3"; -package com.alibaba.otter.canal.protocol; +package com.alibaba.otter.canal.protocol.entry; option java_package = "com.alibaba.otter.canal.protocol"; option java_outer_classname = "CanalEntry"; option optimize_for = SPEED; +option go_package = "./;entry"; /**************************************************************** * message model *如果要在Enum中新增类型,确保以前的类型的下标值不变. ****************************************************************/ message Entry { /**协议头部信息**/ - Header header = 1; + Header header = 1; ///**打散后的事件类型**/ [default = ROWDATA] - oneof entryType_present { - EntryType entryType = 2; + oneof entryType_present{ + EntryType entryType = 2; } /**传输的二进制数组**/ - bytes storeValue = 3; + bytes storeValue = 3; } /**message Header**/ message Header { - /**协议的版本号**/ //[default = 1] + /**协议的版本号**/ //[default = 1] oneof version_present { - int32 version = 1; + int32 version = 1; } + /**binlog/redolog 文件名**/ - string logfileName = 2; + string logfileName = 2; /**binlog/redolog 文件的偏移位置**/ - int64 logfileOffset = 3; + int64 logfileOffset = 3; /**服务端serverId**/ - int64 serverId = 4; + int64 serverId = 4; /** 变更数据的编码 **/ - string serverenCode = 5; + string serverenCode = 5; /**变更数据的执行时间 **/ - int64 executeTime = 6; + int64 executeTime = 6; /** 变更数据的来源**/ //[default = MYSQL] oneof sourceType_present { - Type sourceType = 7; + Type sourceType = 7; } + /** 变更数据的schemaname**/ - string schemaName = 8; + string schemaName = 8; /**变更数据的tablename**/ - string tableName = 9; + string tableName = 9; /**每个event的长度**/ - int64 eventLength = 10; + int64 eventLength = 10; - /**数据变更类型**/ // [default = UPDATE] + /**数据变更类型**/ // [default = UPDATE] oneof eventType_present { - EventType eventType = 11; + EventType eventType = 11; } + /**预留扩展**/ - repeated Pair props = 12; + repeated Pair props = 12; /**当前事务的gitd**/ - string gtid = 13; + string gtid = 13; } /**每个字段的数据结构**/ message Column { /**字段下标**/ - int32 index = 1; + int32 index = 1; /**字段java中类型**/ - int32 sqlType = 2; + int32 sqlType = 2; /**字段名称(忽略大小写),在mysql中是没有的**/ - string name = 3; + string name = 3; /**是否是主键**/ - bool isKey = 4; + bool isKey = 4; /**如果EventType=UPDATE,用于标识这个字段值是否有修改**/ - bool updated = 5; + bool updated = 5; /** 标识是否为空 **/ //[default = false] oneof isNull_present { - bool isNull = 6; + bool isNull = 6; } + /**预留扩展**/ - repeated Pair props = 7; + repeated Pair props = 7; /** 字段值,timestamp,Datetime是一个时间格式的文本 **/ - string value = 8; + string value = 8; /** 对应数据对象原始长度 **/ - int32 length = 9; + int32 length = 9; /**字段mysql类型**/ - string mysqlType = 10; + string mysqlType = 10; } message RowData { /** 字段信息,增量数据(修改前,删除前) **/ - repeated Column beforeColumns = 1; + repeated Column beforeColumns = 1; /** 字段信息,增量数据(修改后,新增后) **/ - repeated Column afterColumns = 2; + repeated Column afterColumns = 2; /**预留扩展**/ - repeated Pair props = 3; + repeated Pair props = 3; } /**message row 每行变更数据的数据结构**/ message RowChange { /**tableId,由数据库产生**/ - int64 tableId = 1; + int64 tableId = 1; + /**数据变更类型**/ //[default = UPDATE] oneof eventType_present { - EventType eventType = 2; + EventType eventType = 2; } + /** 标识是否是ddl语句 **/ // [default = false] oneof isDdl_present { - bool isDdl = 10; + bool isDdl = 10; } + /** ddl/query的sql语句 **/ - string sql = 11; + string sql = 11; /** 一次数据库变更可能存在多行 **/ - repeated RowData rowDatas = 12; + repeated RowData rowDatas = 12; /**预留扩展**/ - repeated Pair props = 13; + repeated Pair props = 13; /** ddl/query的schemaName,会存在跨库ddl,需要保留执行ddl的当前schemaName **/ - string ddlSchemaName = 14; + string ddlSchemaName = 14; } /**开始事务的一些信息**/ -message TransactionBegin { +message TransactionBegin{ /**已废弃,请使用header里的executeTime**/ - int64 executeTime = 1; + int64 executeTime = 1; /**已废弃,Begin里不提供事务id**/ - string transactionId = 2; + string transactionId = 2; /**预留扩展**/ - repeated Pair props = 3; + repeated Pair props = 3; /**执行的thread Id**/ - int64 threadId = 4; + int64 threadId = 4; } /**结束事务的一些信息**/ -message TransactionEnd { +message TransactionEnd{ /**已废弃,请使用header里的executeTime**/ - int64 executeTime = 1; + int64 executeTime = 1; /**事务号**/ - string transactionId = 2; + string transactionId = 2; /**预留扩展**/ - repeated Pair props = 3; + repeated Pair props = 3; } /**预留扩展**/ -message Pair { - string key = 1; - string value = 2; +message Pair{ + string key = 1; + string value = 2; } /**打散后的事件类型,主要用于标识事务的开始,变更数据,结束**/ -enum EntryType { +enum EntryType{ ENTRYTYPECOMPATIBLEPROTO2 = 0; - TRANSACTIONBEGIN = 1; - ROWDATA = 2; - TRANSACTIONEND = 3; + TRANSACTIONBEGIN = 1; + ROWDATA = 2; + TRANSACTIONEND = 3; /** 心跳类型,内部使用,外部暂不可见,可忽略 **/ - HEARTBEAT = 4; - GTIDLOG = 5; + HEARTBEAT = 4; + GTIDLOG = 5; } /** 事件类型 **/ enum EventType { EVENTTYPECOMPATIBLEPROTO2 = 0; - INSERT = 1; - UPDATE = 2; - DELETE = 3; - CREATE = 4; - ALTER = 5; - ERASE = 6; - QUERY = 7; - TRUNCATE = 8; - RENAME = 9; + INSERT = 1; + UPDATE = 2; + DELETE = 3; + CREATE = 4; + ALTER = 5; + ERASE = 6; + QUERY = 7; + TRUNCATE = 8; + RENAME = 9; /**CREATE INDEX**/ - CINDEX = 10; - DINDEX = 11; - GTID = 12; + CINDEX = 10; + DINDEX = 11; + GTID = 12; /** XA **/ - XACOMMIT = 13; - XAROLLBACK = 14; + XACOMMIT = 13; + XAROLLBACK = 14; /** MASTER HEARTBEAT **/ - MHEARTBEAT = 15; + MHEARTBEAT = 15; } /**数据库类型**/ enum Type { TYPECOMPATIBLEPROTO2 = 0; - ORACLE = 1; - MYSQL = 2; - PGSQL = 3; + ORACLE = 1; + MYSQL = 2; + PGSQL = 3; } diff --git a/protocol/message.go b/protocol/message.go new file mode 100644 index 0000000..a5ea067 --- /dev/null +++ b/protocol/message.go @@ -0,0 +1,88 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package protocol + +import ( + "errors" + "fmt" + pbe "github.com/withlin/canal-go/protocol/entry" + pbp "github.com/withlin/canal-go/protocol/packet" + proto "google.golang.org/protobuf/proto" +) + +type Message struct { + Id int64 + Entries []pbe.Entry + Raw bool + RawEntries interface{} +} + +func NewMessage(id int64) *Message { + message := &Message{Id: id, Entries: nil, Raw: false, RawEntries: nil} + return message +} + +func Decode(data []byte, lazyParseEntry bool) (*Message, error) { + p := new(pbp.Packet) + err := proto.Unmarshal(data, p) + if err != nil { + return nil, err + } + messages := new(pbp.Messages) + message := new(Message) + + length := len(messages.Messages) + message.Entries = make([]pbe.Entry, length) + ack := new(pbp.Ack) + var items []pbe.Entry + var entry pbe.Entry + switch p.Type { + case pbp.PacketType_MESSAGES: + if !(p.GetCompression() == pbp.Compression_NONE) && !(p.GetCompression() == pbp.Compression_COMPRESSIONCOMPATIBLEPROTO2) { // NONE和兼容pb2的处理方式相同 + panic("compression is not supported in this connector") + } + err := proto.Unmarshal(p.Body, messages) + if err != nil { + return nil, err + } + if lazyParseEntry { + message.RawEntries = messages.Messages + message.Raw = true + } else { + + for _, value := range messages.Messages { + err := proto.Unmarshal(value, &entry) + if err != nil { + return nil, err + } + items = append(items, entry) + } + } + message.Entries = items + message.Id = messages.GetBatchId() + return message, nil + + case pbp.PacketType_ACK: + err := proto.Unmarshal(p.Body, ack) + if err != nil { + return nil, err + } + panic(errors.New(fmt.Sprintf("something goes wrong with reason:%s", ack.GetErrorMessage()))) + default: + panic(errors.New(fmt.Sprintf("unexpected packet type:%s", p.Type))) + } +} diff --git a/protocol/packet/canal_protocol.pb.go b/protocol/packet/canal_protocol.pb.go new file mode 100644 index 0000000..ec06d3b --- /dev/null +++ b/protocol/packet/canal_protocol.pb.go @@ -0,0 +1,1607 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc v4.24.4 +// source: canal_protocol.proto + +package packet + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Compression int32 + +const ( + Compression_COMPRESSIONCOMPATIBLEPROTO2 Compression = 0 + Compression_NONE Compression = 1 + Compression_ZLIB Compression = 2 + Compression_GZIP Compression = 3 + Compression_LZF Compression = 4 +) + +// Enum value maps for Compression. +var ( + Compression_name = map[int32]string{ + 0: "COMPRESSIONCOMPATIBLEPROTO2", + 1: "NONE", + 2: "ZLIB", + 3: "GZIP", + 4: "LZF", + } + Compression_value = map[string]int32{ + "COMPRESSIONCOMPATIBLEPROTO2": 0, + "NONE": 1, + "ZLIB": 2, + "GZIP": 3, + "LZF": 4, + } +) + +func (x Compression) Enum() *Compression { + p := new(Compression) + *p = x + return p +} + +func (x Compression) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Compression) Descriptor() protoreflect.EnumDescriptor { + return file_canal_protocol_proto_enumTypes[0].Descriptor() +} + +func (Compression) Type() protoreflect.EnumType { + return &file_canal_protocol_proto_enumTypes[0] +} + +func (x Compression) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Compression.Descriptor instead. +func (Compression) EnumDescriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{0} +} + +type PacketType int32 + +const ( + // compatible + PacketType_PACKAGETYPECOMPATIBLEPROTO2 PacketType = 0 + PacketType_HANDSHAKE PacketType = 1 + PacketType_CLIENTAUTHENTICATION PacketType = 2 + PacketType_ACK PacketType = 3 + PacketType_SUBSCRIPTION PacketType = 4 + PacketType_UNSUBSCRIPTION PacketType = 5 + PacketType_GET PacketType = 6 + PacketType_MESSAGES PacketType = 7 + PacketType_CLIENTACK PacketType = 8 + // management part + PacketType_SHUTDOWN PacketType = 9 + // integration + PacketType_DUMP PacketType = 10 + PacketType_HEARTBEAT PacketType = 11 + PacketType_CLIENTROLLBACK PacketType = 12 +) + +// Enum value maps for PacketType. +var ( + PacketType_name = map[int32]string{ + 0: "PACKAGETYPECOMPATIBLEPROTO2", + 1: "HANDSHAKE", + 2: "CLIENTAUTHENTICATION", + 3: "ACK", + 4: "SUBSCRIPTION", + 5: "UNSUBSCRIPTION", + 6: "GET", + 7: "MESSAGES", + 8: "CLIENTACK", + 9: "SHUTDOWN", + 10: "DUMP", + 11: "HEARTBEAT", + 12: "CLIENTROLLBACK", + } + PacketType_value = map[string]int32{ + "PACKAGETYPECOMPATIBLEPROTO2": 0, + "HANDSHAKE": 1, + "CLIENTAUTHENTICATION": 2, + "ACK": 3, + "SUBSCRIPTION": 4, + "UNSUBSCRIPTION": 5, + "GET": 6, + "MESSAGES": 7, + "CLIENTACK": 8, + "SHUTDOWN": 9, + "DUMP": 10, + "HEARTBEAT": 11, + "CLIENTROLLBACK": 12, + } +) + +func (x PacketType) Enum() *PacketType { + p := new(PacketType) + *p = x + return p +} + +func (x PacketType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PacketType) Descriptor() protoreflect.EnumDescriptor { + return file_canal_protocol_proto_enumTypes[1].Descriptor() +} + +func (PacketType) Type() protoreflect.EnumType { + return &file_canal_protocol_proto_enumTypes[1] +} + +func (x PacketType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PacketType.Descriptor instead. +func (PacketType) EnumDescriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{1} +} + +type Packet struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // [default = 17]; + // + // Types that are assignable to MagicNumberPresent: + // + // *Packet_MagicNumber + MagicNumberPresent isPacket_MagicNumberPresent `protobuf_oneof:"magic_number_present"` + // [default = 1]; + // + // Types that are assignable to VersionPresent: + // + // *Packet_Version + VersionPresent isPacket_VersionPresent `protobuf_oneof:"version_present"` + Type PacketType `protobuf:"varint,3,opt,name=type,proto3,enum=com.alibaba.otter.canal.protocol.packet.PacketType" json:"type,omitempty"` + // [default = NONE]; + // + // Types that are assignable to CompressionPresent: + // + // *Packet_Compression + CompressionPresent isPacket_CompressionPresent `protobuf_oneof:"compression_present"` + Body []byte `protobuf:"bytes,5,opt,name=body,proto3" json:"body,omitempty"` +} + +func (x *Packet) Reset() { + *x = Packet{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Packet) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Packet) ProtoMessage() {} + +func (x *Packet) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Packet.ProtoReflect.Descriptor instead. +func (*Packet) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{0} +} + +func (m *Packet) GetMagicNumberPresent() isPacket_MagicNumberPresent { + if m != nil { + return m.MagicNumberPresent + } + return nil +} + +func (x *Packet) GetMagicNumber() int32 { + if x, ok := x.GetMagicNumberPresent().(*Packet_MagicNumber); ok { + return x.MagicNumber + } + return 0 +} + +func (m *Packet) GetVersionPresent() isPacket_VersionPresent { + if m != nil { + return m.VersionPresent + } + return nil +} + +func (x *Packet) GetVersion() int32 { + if x, ok := x.GetVersionPresent().(*Packet_Version); ok { + return x.Version + } + return 0 +} + +func (x *Packet) GetType() PacketType { + if x != nil { + return x.Type + } + return PacketType_PACKAGETYPECOMPATIBLEPROTO2 +} + +func (m *Packet) GetCompressionPresent() isPacket_CompressionPresent { + if m != nil { + return m.CompressionPresent + } + return nil +} + +func (x *Packet) GetCompression() Compression { + if x, ok := x.GetCompressionPresent().(*Packet_Compression); ok { + return x.Compression + } + return Compression_COMPRESSIONCOMPATIBLEPROTO2 +} + +func (x *Packet) GetBody() []byte { + if x != nil { + return x.Body + } + return nil +} + +type isPacket_MagicNumberPresent interface { + isPacket_MagicNumberPresent() +} + +type Packet_MagicNumber struct { + MagicNumber int32 `protobuf:"varint,1,opt,name=magic_number,json=magicNumber,proto3,oneof"` +} + +func (*Packet_MagicNumber) isPacket_MagicNumberPresent() {} + +type isPacket_VersionPresent interface { + isPacket_VersionPresent() +} + +type Packet_Version struct { + Version int32 `protobuf:"varint,2,opt,name=version,proto3,oneof"` +} + +func (*Packet_Version) isPacket_VersionPresent() {} + +type isPacket_CompressionPresent interface { + isPacket_CompressionPresent() +} + +type Packet_Compression struct { + Compression Compression `protobuf:"varint,4,opt,name=compression,proto3,enum=com.alibaba.otter.canal.protocol.packet.Compression,oneof"` +} + +func (*Packet_Compression) isPacket_CompressionPresent() {} + +type HeartBeat struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SendTimestamp int64 `protobuf:"varint,1,opt,name=send_timestamp,json=sendTimestamp,proto3" json:"send_timestamp,omitempty"` + StartTimestamp int64 `protobuf:"varint,2,opt,name=start_timestamp,json=startTimestamp,proto3" json:"start_timestamp,omitempty"` +} + +func (x *HeartBeat) Reset() { + *x = HeartBeat{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeartBeat) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeartBeat) ProtoMessage() {} + +func (x *HeartBeat) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeartBeat.ProtoReflect.Descriptor instead. +func (*HeartBeat) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{1} +} + +func (x *HeartBeat) GetSendTimestamp() int64 { + if x != nil { + return x.SendTimestamp + } + return 0 +} + +func (x *HeartBeat) GetStartTimestamp() int64 { + if x != nil { + return x.StartTimestamp + } + return 0 +} + +type Handshake struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // [default = "utf8"]; + // + // Types that are assignable to CommunicationEncodingPresent: + // + // *Handshake_CommunicationEncoding + CommunicationEncodingPresent isHandshake_CommunicationEncodingPresent `protobuf_oneof:"communication_encoding_present"` + Seeds []byte `protobuf:"bytes,2,opt,name=seeds,proto3" json:"seeds,omitempty"` + SupportedCompressions Compression `protobuf:"varint,3,opt,name=supported_compressions,json=supportedCompressions,proto3,enum=com.alibaba.otter.canal.protocol.packet.Compression" json:"supported_compressions,omitempty"` +} + +func (x *Handshake) Reset() { + *x = Handshake{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Handshake) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Handshake) ProtoMessage() {} + +func (x *Handshake) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Handshake.ProtoReflect.Descriptor instead. +func (*Handshake) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{2} +} + +func (m *Handshake) GetCommunicationEncodingPresent() isHandshake_CommunicationEncodingPresent { + if m != nil { + return m.CommunicationEncodingPresent + } + return nil +} + +func (x *Handshake) GetCommunicationEncoding() string { + if x, ok := x.GetCommunicationEncodingPresent().(*Handshake_CommunicationEncoding); ok { + return x.CommunicationEncoding + } + return "" +} + +func (x *Handshake) GetSeeds() []byte { + if x != nil { + return x.Seeds + } + return nil +} + +func (x *Handshake) GetSupportedCompressions() Compression { + if x != nil { + return x.SupportedCompressions + } + return Compression_COMPRESSIONCOMPATIBLEPROTO2 +} + +type isHandshake_CommunicationEncodingPresent interface { + isHandshake_CommunicationEncodingPresent() +} + +type Handshake_CommunicationEncoding struct { + CommunicationEncoding string `protobuf:"bytes,1,opt,name=communication_encoding,json=communicationEncoding,proto3,oneof"` +} + +func (*Handshake_CommunicationEncoding) isHandshake_CommunicationEncodingPresent() {} + +// client authentication +type ClientAuth struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"` + Password []byte `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"` // hashed password with seeds from Handshake message + // [default = 0] + // + // Types that are assignable to NetReadTimeoutPresent: + // + // *ClientAuth_NetReadTimeout + NetReadTimeoutPresent isClientAuth_NetReadTimeoutPresent `protobuf_oneof:"net_read_timeout_present"` + // [default = 0]; + // + // Types that are assignable to NetWriteTimeoutPresent: + // + // *ClientAuth_NetWriteTimeout + NetWriteTimeoutPresent isClientAuth_NetWriteTimeoutPresent `protobuf_oneof:"net_write_timeout_present"` + Destination string `protobuf:"bytes,5,opt,name=destination,proto3" json:"destination,omitempty"` + ClientId string `protobuf:"bytes,6,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + Filter string `protobuf:"bytes,7,opt,name=filter,proto3" json:"filter,omitempty"` + StartTimestamp int64 `protobuf:"varint,8,opt,name=start_timestamp,json=startTimestamp,proto3" json:"start_timestamp,omitempty"` +} + +func (x *ClientAuth) Reset() { + *x = ClientAuth{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientAuth) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientAuth) ProtoMessage() {} + +func (x *ClientAuth) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientAuth.ProtoReflect.Descriptor instead. +func (*ClientAuth) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{3} +} + +func (x *ClientAuth) GetUsername() string { + if x != nil { + return x.Username + } + return "" +} + +func (x *ClientAuth) GetPassword() []byte { + if x != nil { + return x.Password + } + return nil +} + +func (m *ClientAuth) GetNetReadTimeoutPresent() isClientAuth_NetReadTimeoutPresent { + if m != nil { + return m.NetReadTimeoutPresent + } + return nil +} + +func (x *ClientAuth) GetNetReadTimeout() int32 { + if x, ok := x.GetNetReadTimeoutPresent().(*ClientAuth_NetReadTimeout); ok { + return x.NetReadTimeout + } + return 0 +} + +func (m *ClientAuth) GetNetWriteTimeoutPresent() isClientAuth_NetWriteTimeoutPresent { + if m != nil { + return m.NetWriteTimeoutPresent + } + return nil +} + +func (x *ClientAuth) GetNetWriteTimeout() int32 { + if x, ok := x.GetNetWriteTimeoutPresent().(*ClientAuth_NetWriteTimeout); ok { + return x.NetWriteTimeout + } + return 0 +} + +func (x *ClientAuth) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +func (x *ClientAuth) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *ClientAuth) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +func (x *ClientAuth) GetStartTimestamp() int64 { + if x != nil { + return x.StartTimestamp + } + return 0 +} + +type isClientAuth_NetReadTimeoutPresent interface { + isClientAuth_NetReadTimeoutPresent() +} + +type ClientAuth_NetReadTimeout struct { + NetReadTimeout int32 `protobuf:"varint,3,opt,name=net_read_timeout,json=netReadTimeout,proto3,oneof"` // in seconds +} + +func (*ClientAuth_NetReadTimeout) isClientAuth_NetReadTimeoutPresent() {} + +type isClientAuth_NetWriteTimeoutPresent interface { + isClientAuth_NetWriteTimeoutPresent() +} + +type ClientAuth_NetWriteTimeout struct { + NetWriteTimeout int32 `protobuf:"varint,4,opt,name=net_write_timeout,json=netWriteTimeout,proto3,oneof"` // in seconds +} + +func (*ClientAuth_NetWriteTimeout) isClientAuth_NetWriteTimeoutPresent() {} + +type Ack struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // [default = 0] + // + // Types that are assignable to ErrorCodePresent: + // + // *Ack_ErrorCode + ErrorCodePresent isAck_ErrorCodePresent `protobuf_oneof:"error_code_present"` + ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"` // if something like compression is not supported, erorr_message will tell about it. +} + +func (x *Ack) Reset() { + *x = Ack{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Ack) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Ack) ProtoMessage() {} + +func (x *Ack) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Ack.ProtoReflect.Descriptor instead. +func (*Ack) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{4} +} + +func (m *Ack) GetErrorCodePresent() isAck_ErrorCodePresent { + if m != nil { + return m.ErrorCodePresent + } + return nil +} + +func (x *Ack) GetErrorCode() int32 { + if x, ok := x.GetErrorCodePresent().(*Ack_ErrorCode); ok { + return x.ErrorCode + } + return 0 +} + +func (x *Ack) GetErrorMessage() string { + if x != nil { + return x.ErrorMessage + } + return "" +} + +type isAck_ErrorCodePresent interface { + isAck_ErrorCodePresent() +} + +type Ack_ErrorCode struct { + ErrorCode int32 `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3,oneof"` +} + +func (*Ack_ErrorCode) isAck_ErrorCodePresent() {} + +type ClientAck struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + BatchId int64 `protobuf:"varint,3,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` +} + +func (x *ClientAck) Reset() { + *x = ClientAck{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientAck) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientAck) ProtoMessage() {} + +func (x *ClientAck) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientAck.ProtoReflect.Descriptor instead. +func (*ClientAck) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{5} +} + +func (x *ClientAck) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +func (x *ClientAck) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *ClientAck) GetBatchId() int64 { + if x != nil { + return x.BatchId + } + return 0 +} + +// subscription +type Sub struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + Filter string `protobuf:"bytes,7,opt,name=filter,proto3" json:"filter,omitempty"` +} + +func (x *Sub) Reset() { + *x = Sub{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Sub) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Sub) ProtoMessage() {} + +func (x *Sub) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Sub.ProtoReflect.Descriptor instead. +func (*Sub) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{6} +} + +func (x *Sub) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +func (x *Sub) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *Sub) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +// Unsubscription +type Unsub struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + Filter string `protobuf:"bytes,7,opt,name=filter,proto3" json:"filter,omitempty"` +} + +func (x *Unsub) Reset() { + *x = Unsub{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Unsub) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Unsub) ProtoMessage() {} + +func (x *Unsub) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Unsub.ProtoReflect.Descriptor instead. +func (*Unsub) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{7} +} + +func (x *Unsub) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +func (x *Unsub) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *Unsub) GetFilter() string { + if x != nil { + return x.Filter + } + return "" +} + +// PullRequest +type Get struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + FetchSize int32 `protobuf:"varint,3,opt,name=fetch_size,json=fetchSize,proto3" json:"fetch_size,omitempty"` + // [default = -1] + // + // Types that are assignable to TimeoutPresent: + // + // *Get_Timeout + TimeoutPresent isGet_TimeoutPresent `protobuf_oneof:"timeout_present"` + // [default = 2] + // + // Types that are assignable to UnitPresent: + // + // *Get_Unit + UnitPresent isGet_UnitPresent `protobuf_oneof:"unit_present"` + // [default = false] + // + // Types that are assignable to AutoAckPresent: + // + // *Get_AutoAck + AutoAckPresent isGet_AutoAckPresent `protobuf_oneof:"auto_ack_present"` +} + +func (x *Get) Reset() { + *x = Get{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Get) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Get) ProtoMessage() {} + +func (x *Get) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Get.ProtoReflect.Descriptor instead. +func (*Get) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{8} +} + +func (x *Get) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +func (x *Get) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *Get) GetFetchSize() int32 { + if x != nil { + return x.FetchSize + } + return 0 +} + +func (m *Get) GetTimeoutPresent() isGet_TimeoutPresent { + if m != nil { + return m.TimeoutPresent + } + return nil +} + +func (x *Get) GetTimeout() int64 { + if x, ok := x.GetTimeoutPresent().(*Get_Timeout); ok { + return x.Timeout + } + return 0 +} + +func (m *Get) GetUnitPresent() isGet_UnitPresent { + if m != nil { + return m.UnitPresent + } + return nil +} + +func (x *Get) GetUnit() int32 { + if x, ok := x.GetUnitPresent().(*Get_Unit); ok { + return x.Unit + } + return 0 +} + +func (m *Get) GetAutoAckPresent() isGet_AutoAckPresent { + if m != nil { + return m.AutoAckPresent + } + return nil +} + +func (x *Get) GetAutoAck() bool { + if x, ok := x.GetAutoAckPresent().(*Get_AutoAck); ok { + return x.AutoAck + } + return false +} + +type isGet_TimeoutPresent interface { + isGet_TimeoutPresent() +} + +type Get_Timeout struct { + Timeout int64 `protobuf:"varint,4,opt,name=timeout,proto3,oneof"` // 默认-1时代表不控制 +} + +func (*Get_Timeout) isGet_TimeoutPresent() {} + +type isGet_UnitPresent interface { + isGet_UnitPresent() +} + +type Get_Unit struct { + Unit int32 `protobuf:"varint,5,opt,name=unit,proto3,oneof"` // 数字类型,0:纳秒,1:微秒,2:毫秒,3:秒,4:分钟,5:小时,6:天 +} + +func (*Get_Unit) isGet_UnitPresent() {} + +type isGet_AutoAckPresent interface { + isGet_AutoAckPresent() +} + +type Get_AutoAck struct { + AutoAck bool `protobuf:"varint,6,opt,name=auto_ack,json=autoAck,proto3,oneof"` // 是否自动ack +} + +func (*Get_AutoAck) isGet_AutoAckPresent() {} + +type Messages struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + BatchId int64 `protobuf:"varint,1,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` + Messages [][]byte `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` +} + +func (x *Messages) Reset() { + *x = Messages{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Messages) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Messages) ProtoMessage() {} + +func (x *Messages) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Messages.ProtoReflect.Descriptor instead. +func (*Messages) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{9} +} + +func (x *Messages) GetBatchId() int64 { + if x != nil { + return x.BatchId + } + return 0 +} + +func (x *Messages) GetMessages() [][]byte { + if x != nil { + return x.Messages + } + return nil +} + +// TBD when new packets are required +type Dump struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Journal string `protobuf:"bytes,1,opt,name=journal,proto3" json:"journal,omitempty"` + Position int64 `protobuf:"varint,2,opt,name=position,proto3" json:"position,omitempty"` + // [default = 0] + // + // Types that are assignable to TimestampPresent: + // + // *Dump_Timestamp + TimestampPresent isDump_TimestampPresent `protobuf_oneof:"timestamp_present"` +} + +func (x *Dump) Reset() { + *x = Dump{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Dump) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Dump) ProtoMessage() {} + +func (x *Dump) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Dump.ProtoReflect.Descriptor instead. +func (*Dump) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{10} +} + +func (x *Dump) GetJournal() string { + if x != nil { + return x.Journal + } + return "" +} + +func (x *Dump) GetPosition() int64 { + if x != nil { + return x.Position + } + return 0 +} + +func (m *Dump) GetTimestampPresent() isDump_TimestampPresent { + if m != nil { + return m.TimestampPresent + } + return nil +} + +func (x *Dump) GetTimestamp() int64 { + if x, ok := x.GetTimestampPresent().(*Dump_Timestamp); ok { + return x.Timestamp + } + return 0 +} + +type isDump_TimestampPresent interface { + isDump_TimestampPresent() +} + +type Dump_Timestamp struct { + Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3,oneof"` +} + +func (*Dump_Timestamp) isDump_TimestampPresent() {} + +type ClientRollback struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Destination string `protobuf:"bytes,1,opt,name=destination,proto3" json:"destination,omitempty"` + ClientId string `protobuf:"bytes,2,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` + BatchId int64 `protobuf:"varint,3,opt,name=batch_id,json=batchId,proto3" json:"batch_id,omitempty"` +} + +func (x *ClientRollback) Reset() { + *x = ClientRollback{} + if protoimpl.UnsafeEnabled { + mi := &file_canal_protocol_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ClientRollback) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ClientRollback) ProtoMessage() {} + +func (x *ClientRollback) ProtoReflect() protoreflect.Message { + mi := &file_canal_protocol_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ClientRollback.ProtoReflect.Descriptor instead. +func (*ClientRollback) Descriptor() ([]byte, []int) { + return file_canal_protocol_proto_rawDescGZIP(), []int{11} +} + +func (x *ClientRollback) GetDestination() string { + if x != nil { + return x.Destination + } + return "" +} + +func (x *ClientRollback) GetClientId() string { + if x != nil { + return x.ClientId + } + return "" +} + +func (x *ClientRollback) GetBatchId() int64 { + if x != nil { + return x.BatchId + } + return 0 +} + +var File_canal_protocol_proto protoreflect.FileDescriptor + +var file_canal_protocol_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x27, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, + 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x22, + 0xc2, 0x02, 0x0a, 0x06, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x23, 0x0a, 0x0c, 0x6d, 0x61, + 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x48, 0x00, 0x52, 0x0b, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, + 0x1a, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x48, 0x01, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x47, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, + 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, + 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x70, 0x61, 0x63, + 0x6b, 0x65, 0x74, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x58, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, 0x2e, 0x63, 0x6f, 0x6d, 0x2e, + 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, 0x65, 0x72, 0x2e, 0x63, 0x61, + 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2e, 0x70, 0x61, 0x63, + 0x6b, 0x65, 0x74, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, + 0x02, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12, + 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x62, 0x6f, + 0x64, 0x79, 0x42, 0x16, 0x0a, 0x14, 0x6d, 0x61, 0x67, 0x69, 0x63, 0x5f, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x42, 0x11, 0x0a, 0x0f, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x42, 0x15, 0x0a, + 0x13, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x72, 0x65, + 0x73, 0x65, 0x6e, 0x74, 0x22, 0x5b, 0x0a, 0x09, 0x48, 0x65, 0x61, 0x72, 0x74, 0x42, 0x65, 0x61, + 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x65, 0x6e, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x73, 0x65, 0x6e, 0x64, 0x54, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x72, + 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0e, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x22, 0xe9, 0x01, 0x0a, 0x09, 0x48, 0x61, 0x6e, 0x64, 0x73, 0x68, 0x61, 0x6b, 0x65, 0x12, + 0x37, 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, + 0x00, 0x52, 0x15, 0x63, 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x45, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x65, 0x65, 0x64, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x65, 0x65, 0x64, 0x73, 0x12, 0x6b, + 0x0a, 0x16, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x63, 0x6f, 0x6d, 0x70, + 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x34, + 0x2e, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, + 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x2e, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x2e, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x15, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x43, + 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x42, 0x20, 0x0a, 0x1e, 0x63, + 0x6f, 0x6d, 0x6d, 0x75, 0x6e, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x65, 0x6e, 0x63, + 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x22, 0xd7, 0x02, + 0x0a, 0x0a, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x12, 0x1a, 0x0a, 0x08, + 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, + 0x77, 0x6f, 0x72, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x6e, 0x65, 0x74, 0x5f, 0x72, 0x65, 0x61, 0x64, + 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, + 0x52, 0x0e, 0x6e, 0x65, 0x74, 0x52, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, + 0x12, 0x2c, 0x0a, 0x11, 0x6e, 0x65, 0x74, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x69, + 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x48, 0x01, 0x52, 0x0f, 0x6e, + 0x65, 0x74, 0x57, 0x72, 0x69, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x20, + 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, + 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, + 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x1a, + 0x0a, 0x18, 0x6e, 0x65, 0x74, 0x5f, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, + 0x75, 0x74, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x42, 0x1b, 0x0a, 0x19, 0x6e, 0x65, + 0x74, 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, + 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x22, 0x61, 0x0a, 0x03, 0x41, 0x63, 0x6b, 0x12, 0x1f, + 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x48, 0x00, 0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x23, 0x0a, 0x0d, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x42, 0x14, 0x0a, 0x12, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, + 0x64, 0x65, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x22, 0x65, 0x0a, 0x09, 0x43, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x41, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, + 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x49, + 0x64, 0x22, 0x5c, 0x0a, 0x03, 0x53, 0x75, 0x62, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, + 0x5e, 0x0a, 0x05, 0x55, 0x6e, 0x73, 0x75, 0x62, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, + 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, + 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, + 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, + 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x22, + 0xe9, 0x01, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, + 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, + 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, + 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x66, 0x65, 0x74, 0x63, 0x68, 0x5f, + 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x66, 0x65, 0x74, 0x63, + 0x68, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, + 0x74, 0x12, 0x14, 0x0a, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x48, + 0x01, 0x52, 0x04, 0x75, 0x6e, 0x69, 0x74, 0x12, 0x1b, 0x0a, 0x08, 0x61, 0x75, 0x74, 0x6f, 0x5f, + 0x61, 0x63, 0x6b, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x48, 0x02, 0x52, 0x07, 0x61, 0x75, 0x74, + 0x6f, 0x41, 0x63, 0x6b, 0x42, 0x11, 0x0a, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x5f, + 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x42, 0x0e, 0x0a, 0x0c, 0x75, 0x6e, 0x69, 0x74, 0x5f, + 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x42, 0x12, 0x0a, 0x10, 0x61, 0x75, 0x74, 0x6f, 0x5f, + 0x61, 0x63, 0x6b, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, 0x74, 0x22, 0x41, 0x0a, 0x08, 0x4d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x63, 0x68, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, + 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0c, 0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x22, 0x71, + 0x0a, 0x04, 0x44, 0x75, 0x6d, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x6a, 0x6f, 0x75, 0x72, 0x6e, 0x61, + 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6a, 0x6f, 0x75, 0x72, 0x6e, 0x61, 0x6c, + 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x48, + 0x00, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x13, 0x0a, 0x11, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x70, 0x72, 0x65, 0x73, 0x65, 0x6e, + 0x74, 0x22, 0x6a, 0x0a, 0x0e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x6f, 0x6c, 0x6c, 0x62, + 0x61, 0x63, 0x6b, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, + 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x62, 0x61, 0x74, 0x63, 0x68, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x49, 0x64, 0x2a, 0x55, 0x0a, + 0x0b, 0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x1b, + 0x43, 0x4f, 0x4d, 0x50, 0x52, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x43, 0x4f, 0x4d, 0x50, 0x41, + 0x54, 0x49, 0x42, 0x4c, 0x45, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x32, 0x10, 0x00, 0x12, 0x08, 0x0a, + 0x04, 0x4e, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x5a, 0x4c, 0x49, 0x42, 0x10, + 0x02, 0x12, 0x08, 0x0a, 0x04, 0x47, 0x5a, 0x49, 0x50, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x4c, + 0x5a, 0x46, 0x10, 0x04, 0x2a, 0xe6, 0x01, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x1b, 0x50, 0x41, 0x43, 0x4b, 0x41, 0x47, 0x45, 0x54, 0x59, + 0x50, 0x45, 0x43, 0x4f, 0x4d, 0x50, 0x41, 0x54, 0x49, 0x42, 0x4c, 0x45, 0x50, 0x52, 0x4f, 0x54, + 0x4f, 0x32, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x48, 0x41, 0x4e, 0x44, 0x53, 0x48, 0x41, 0x4b, + 0x45, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x41, 0x55, 0x54, + 0x48, 0x45, 0x4e, 0x54, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x12, 0x07, 0x0a, + 0x03, 0x41, 0x43, 0x4b, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x55, 0x42, 0x53, 0x43, 0x52, + 0x49, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x55, 0x4e, 0x53, 0x55, + 0x42, 0x53, 0x43, 0x52, 0x49, 0x50, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x05, 0x12, 0x07, 0x0a, 0x03, + 0x47, 0x45, 0x54, 0x10, 0x06, 0x12, 0x0c, 0x0a, 0x08, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, + 0x53, 0x10, 0x07, 0x12, 0x0d, 0x0a, 0x09, 0x43, 0x4c, 0x49, 0x45, 0x4e, 0x54, 0x41, 0x43, 0x4b, + 0x10, 0x08, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x48, 0x55, 0x54, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x09, + 0x12, 0x08, 0x0a, 0x04, 0x44, 0x55, 0x4d, 0x50, 0x10, 0x0a, 0x12, 0x0d, 0x0a, 0x09, 0x48, 0x45, + 0x41, 0x52, 0x54, 0x42, 0x45, 0x41, 0x54, 0x10, 0x0b, 0x12, 0x12, 0x0a, 0x0e, 0x43, 0x4c, 0x49, + 0x45, 0x4e, 0x54, 0x52, 0x4f, 0x4c, 0x4c, 0x42, 0x41, 0x43, 0x4b, 0x10, 0x0c, 0x42, 0x3c, 0x0a, + 0x20, 0x63, 0x6f, 0x6d, 0x2e, 0x61, 0x6c, 0x69, 0x62, 0x61, 0x62, 0x61, 0x2e, 0x6f, 0x74, 0x74, + 0x65, 0x72, 0x2e, 0x63, 0x61, 0x6e, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, + 0x6c, 0x42, 0x0b, 0x43, 0x61, 0x6e, 0x61, 0x6c, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x01, + 0x5a, 0x09, 0x2e, 0x2f, 0x3b, 0x70, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, +} + +var ( + file_canal_protocol_proto_rawDescOnce sync.Once + file_canal_protocol_proto_rawDescData = file_canal_protocol_proto_rawDesc +) + +func file_canal_protocol_proto_rawDescGZIP() []byte { + file_canal_protocol_proto_rawDescOnce.Do(func() { + file_canal_protocol_proto_rawDescData = protoimpl.X.CompressGZIP(file_canal_protocol_proto_rawDescData) + }) + return file_canal_protocol_proto_rawDescData +} + +var file_canal_protocol_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_canal_protocol_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_canal_protocol_proto_goTypes = []interface{}{ + (Compression)(0), // 0: com.alibaba.otter.canal.protocol.packet.Compression + (PacketType)(0), // 1: com.alibaba.otter.canal.protocol.packet.PacketType + (*Packet)(nil), // 2: com.alibaba.otter.canal.protocol.packet.Packet + (*HeartBeat)(nil), // 3: com.alibaba.otter.canal.protocol.packet.HeartBeat + (*Handshake)(nil), // 4: com.alibaba.otter.canal.protocol.packet.Handshake + (*ClientAuth)(nil), // 5: com.alibaba.otter.canal.protocol.packet.ClientAuth + (*Ack)(nil), // 6: com.alibaba.otter.canal.protocol.packet.Ack + (*ClientAck)(nil), // 7: com.alibaba.otter.canal.protocol.packet.ClientAck + (*Sub)(nil), // 8: com.alibaba.otter.canal.protocol.packet.Sub + (*Unsub)(nil), // 9: com.alibaba.otter.canal.protocol.packet.Unsub + (*Get)(nil), // 10: com.alibaba.otter.canal.protocol.packet.Get + (*Messages)(nil), // 11: com.alibaba.otter.canal.protocol.packet.Messages + (*Dump)(nil), // 12: com.alibaba.otter.canal.protocol.packet.Dump + (*ClientRollback)(nil), // 13: com.alibaba.otter.canal.protocol.packet.ClientRollback +} +var file_canal_protocol_proto_depIdxs = []int32{ + 1, // 0: com.alibaba.otter.canal.protocol.packet.Packet.type:type_name -> com.alibaba.otter.canal.protocol.packet.PacketType + 0, // 1: com.alibaba.otter.canal.protocol.packet.Packet.compression:type_name -> com.alibaba.otter.canal.protocol.packet.Compression + 0, // 2: com.alibaba.otter.canal.protocol.packet.Handshake.supported_compressions:type_name -> com.alibaba.otter.canal.protocol.packet.Compression + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_canal_protocol_proto_init() } +func file_canal_protocol_proto_init() { + if File_canal_protocol_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_canal_protocol_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Packet); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeartBeat); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Handshake); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientAuth); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Ack); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientAck); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Sub); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Unsub); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Get); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Messages); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Dump); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_canal_protocol_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ClientRollback); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + file_canal_protocol_proto_msgTypes[0].OneofWrappers = []interface{}{ + (*Packet_MagicNumber)(nil), + (*Packet_Version)(nil), + (*Packet_Compression)(nil), + } + file_canal_protocol_proto_msgTypes[2].OneofWrappers = []interface{}{ + (*Handshake_CommunicationEncoding)(nil), + } + file_canal_protocol_proto_msgTypes[3].OneofWrappers = []interface{}{ + (*ClientAuth_NetReadTimeout)(nil), + (*ClientAuth_NetWriteTimeout)(nil), + } + file_canal_protocol_proto_msgTypes[4].OneofWrappers = []interface{}{ + (*Ack_ErrorCode)(nil), + } + file_canal_protocol_proto_msgTypes[8].OneofWrappers = []interface{}{ + (*Get_Timeout)(nil), + (*Get_Unit)(nil), + (*Get_AutoAck)(nil), + } + file_canal_protocol_proto_msgTypes[10].OneofWrappers = []interface{}{ + (*Dump_Timestamp)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_canal_protocol_proto_rawDesc, + NumEnums: 2, + NumMessages: 12, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_canal_protocol_proto_goTypes, + DependencyIndexes: file_canal_protocol_proto_depIdxs, + EnumInfos: file_canal_protocol_proto_enumTypes, + MessageInfos: file_canal_protocol_proto_msgTypes, + }.Build() + File_canal_protocol_proto = out.File + file_canal_protocol_proto_rawDesc = nil + file_canal_protocol_proto_goTypes = nil + file_canal_protocol_proto_depIdxs = nil +} diff --git a/protocol/CanalProtocol.proto b/protocol/packet/canal_protocol.proto similarity index 91% rename from protocol/CanalProtocol.proto rename to protocol/packet/canal_protocol.proto index e0e4c1d..e94a54f 100644 --- a/protocol/CanalProtocol.proto +++ b/protocol/packet/canal_protocol.proto @@ -1,10 +1,12 @@ syntax = "proto3"; -package com.alibaba.otter.canal.protocol; +package com.alibaba.otter.canal.protocol.packet; option java_package = "com.alibaba.otter.canal.protocol"; option java_outer_classname = "CanalPacket"; option optimize_for = SPEED; +option go_package = "./;packet"; + enum Compression { COMPRESSIONCOMPATIBLEPROTO2 = 0; NONE = 1; @@ -72,7 +74,7 @@ message ClientAuth { oneof net_read_timeout_present { int32 net_read_timeout = 3; // in seconds } - // [default = 0]; + // [default = 0]; oneof net_write_timeout_present { int32 net_write_timeout = 4; // in seconds } @@ -121,12 +123,13 @@ message Get { } //[default = 2] oneof unit_present { - int32 unit = 5; // 数字类型,0:纳秒,1:毫秒,2:微秒,3:秒,4:分钟,5:小时,6:天 + int32 unit = 5;// 数字类型,0:纳秒,1:微秒,2:毫秒,3:秒,4:分钟,5:小时,6:天 } //[default = false] oneof auto_ack_present { bool auto_ack = 6; // 是否自动ack } + } // @@ -136,16 +139,17 @@ message Messages { } // TBD when new packets are required -message Dump { +message Dump{ string journal = 1; - int64 position = 2; + int64 position = 2; // [default = 0] oneof timestamp_present { int64 timestamp = 3; } + } -message ClientRollback { +message ClientRollback{ string destination = 1; string client_id = 2; int64 batch_id = 3; diff --git a/protocol/Position/doc.go b/protocol/position/doc.go similarity index 100% rename from protocol/Position/doc.go rename to protocol/position/doc.go diff --git a/protocol/Position/entry_position.go b/protocol/position/entry_position.go similarity index 100% rename from protocol/Position/entry_position.go rename to protocol/position/entry_position.go diff --git a/protocol/Position/log_identity.go b/protocol/position/log_identity.go similarity index 100% rename from protocol/Position/log_identity.go rename to protocol/position/log_identity.go diff --git a/protocol/Position/log_position.go b/protocol/position/log_position.go similarity index 100% rename from protocol/Position/log_position.go rename to protocol/position/log_position.go diff --git a/protocol/Position/metaq_position.go b/protocol/position/metaq_position.go similarity index 100% rename from protocol/Position/metaq_position.go rename to protocol/position/metaq_position.go diff --git a/protocol/Position/Position.go b/protocol/position/position.go similarity index 100% rename from protocol/Position/Position.go rename to protocol/position/position.go diff --git a/protocol/Position/time_position.go b/protocol/position/time_position.go similarity index 100% rename from protocol/Position/time_position.go rename to protocol/position/time_position.go diff --git a/samples/cluster/cluster_main.go b/samples/cluster/cluster_main.go index f67a945..c3589bb 100644 --- a/samples/cluster/cluster_main.go +++ b/samples/cluster/cluster_main.go @@ -2,57 +2,116 @@ package main import ( "fmt" + "github.com/withlin/canal-go/client" + pbe "github.com/withlin/canal-go/protocol/entry" + proto "google.golang.org/protobuf/proto" "log" + "os" "time" - - "github.com/CanalClient/canal-go/client" - protocol "github.com/CanalClient/canal-go/protocol" ) +var conn *client.ClusterCanalConnector + func main() { + conn = createConnection() + subscribe(conn, ".*\\..*") - fmt.Println("cluster main") - conn, _ := createConn() - conn.Subscribe(".*\\\\..*") - n := 0 + fmt.Println("canal start listening...") + listen() + err := conn.DisConnection() + if err != nil { + fmt.Println(err) + } +} + +func listen() { for { message, err := conn.Get(100, nil, nil) if err != nil { - log.Println(err) - continue + fmt.Println(err) + return } + batchId := message.Id if batchId == -1 || len(message.Entries) <= 0 { - time.Sleep(3000 * time.Millisecond) - fmt.Println("===没有数据了===") - n++ - if n > 100 { - break - } + time.Sleep(200 * time.Millisecond) continue } + printEntry(message.Entries) } +} - conn.DisConnection() +func subscribe(conn *client.ClusterCanalConnector, str string) { + err := conn.Subscribe(str) + if err != nil { + log.Println(err) + os.Exit(1) + } } -func createConn() (conn *client.ClusterCanalConnector, err error) { +func createConnection() *client.ClusterCanalConnector { + cn, err := client.NewCanalClusterNode("example", []string{"192.168.0.201:2181", "192.168.0.202:2181", "192.168.0.203:2181"}, time.Second*10) + if err != nil { + log.Println(err) + os.Exit(1) + } - cn, err := client.NewCanalClusterNode("example", []string{"zookeeper:2181"}, time.Second*10) - fmt.Printf("err=%v,cn=%+v\n\n", err, cn) + canalConnector, err := client.NewClusterCanalConnector(cn, "canal", "canal", "example", 60000, 60*60*1000) + if err != nil { + log.Println(err) + os.Exit(1) + } - addr, port, err := cn.GetNode() - fmt.Printf("addr=%s, port=%d, err=%v", addr, port, err) + err = canalConnector.Connect() + if err != nil { + log.Println(err) + os.Exit(1) + } - conn = client.NewClusterCanalConnector(cn, "", "", "example", 60000, 60*60*1000) - err = conn.Connect() - fmt.Printf("err=%v,cluCanalConn=%+vn\n", err, conn) - return + return canalConnector } -func printEntry(entrys []protocol.Entry) { +func printEntry(entrys []pbe.Entry) { + for _, entry := range entrys { - fmt.Printf("entry type:%d\n", entry.GetEntryType()) + if entry.GetEntryType() == pbe.EntryType_TRANSACTIONBEGIN || entry.GetEntryType() == pbe.EntryType_TRANSACTIONEND { + continue + } + rowChange := new(pbe.RowChange) + + err := proto.Unmarshal(entry.GetStoreValue(), rowChange) + checkError(err) + if rowChange != nil { + eventType := rowChange.GetEventType() + header := entry.GetHeader() + fmt.Println(fmt.Sprintf("================> binlog[%s : %d],name[%s,%s], eventType: %s", header.GetLogfileName(), header.GetLogfileOffset(), header.GetSchemaName(), header.GetTableName(), header.GetEventType())) + + for _, rowData := range rowChange.GetRowDatas() { + if eventType == pbe.EventType_DELETE { + printColumn(rowData.GetBeforeColumns()) + } else if eventType == pbe.EventType_INSERT { + printColumn(rowData.GetAfterColumns()) + } else { + fmt.Println("-------> before") + printColumn(rowData.GetBeforeColumns()) + fmt.Println("-------> after") + printColumn(rowData.GetAfterColumns()) + } + } + } + } +} + +func printColumn(columns []*pbe.Column) { + for _, col := range columns { + fmt.Println(fmt.Sprintf("%s : %s update= %t", col.GetName(), col.GetValue(), col.GetUpdated())) + } +} + +func checkError(err error) { + if err != nil { + fmt.Fprintf(os.Stderr, "Fatal error: %s", err.Error()) + os.Exit(1) } } diff --git a/samples/main.go b/samples/main.go index 6138d44..45d8bf4 100644 --- a/samples/main.go +++ b/samples/main.go @@ -22,20 +22,36 @@ import ( "os" "time" - "github.com/CanalClient/canal-go/client" - protocol "github.com/CanalClient/canal-go/protocol" - "github.com/golang/protobuf/proto" + "github.com/withlin/canal-go/client" + pbe "github.com/withlin/canal-go/protocol/entry" + "google.golang.org/protobuf/proto" ) func main() { - connector := client.NewSimpleCanalConnector("192.168.199.17", 11111, "", "", "example", 60000, 60*60*1000) + // 192.168.199.17 替换成你的canal server的地址 + // example 替换成-e canal.destinations=example 你自己定义的名字 + connector := client.NewSimpleCanalConnector("127.0.0.1", 11111, "", "", "example", 60000, 60*60*1000) err := connector.Connect() if err != nil { log.Println(err) os.Exit(1) } - err = connector.Subscribe(".*\\\\..*") + + // https://github.com/alibaba/canal/wiki/AdminGuide + //mysql 数据解析关注的表,Perl正则表达式. + // + //多个正则之间以逗号(,)分隔,转义符需要双斜杠(\\) + // + //常见例子: + // + // 1. 所有表:.* or .*\\..* + // 2. canal schema下所有表: canal\\..* + // 3. canal下的以canal打头的表:canal\\.canal.* + // 4. canal schema下的一张表:canal\\.test1 + // 5. 多个规则组合使用:canal\\..*,mysql.test1,mysql.test2 (逗号分隔) + + err = connector.Subscribe(".*\\..*") if err != nil { log.Println(err) os.Exit(1) @@ -60,13 +76,13 @@ func main() { } } -func printEntry(entrys []protocol.Entry) { +func printEntry(entrys []pbe.Entry) { for _, entry := range entrys { - if entry.GetEntryType() == protocol.EntryType_TRANSACTIONBEGIN || entry.GetEntryType() == protocol.EntryType_TRANSACTIONEND { + if entry.GetEntryType() == pbe.EntryType_TRANSACTIONBEGIN || entry.GetEntryType() == pbe.EntryType_TRANSACTIONEND { continue } - rowChange := new(protocol.RowChange) + rowChange := new(pbe.RowChange) err := proto.Unmarshal(entry.GetStoreValue(), rowChange) checkError(err) @@ -76,9 +92,9 @@ func printEntry(entrys []protocol.Entry) { fmt.Println(fmt.Sprintf("================> binlog[%s : %d],name[%s,%s], eventType: %s", header.GetLogfileName(), header.GetLogfileOffset(), header.GetSchemaName(), header.GetTableName(), header.GetEventType())) for _, rowData := range rowChange.GetRowDatas() { - if eventType == protocol.EventType_DELETE { + if eventType == pbe.EventType_DELETE { printColumn(rowData.GetBeforeColumns()) - } else if eventType == protocol.EventType_INSERT { + } else if eventType == pbe.EventType_INSERT { printColumn(rowData.GetAfterColumns()) } else { fmt.Println("-------> before") @@ -91,7 +107,7 @@ func printEntry(entrys []protocol.Entry) { } } -func printColumn(columns []*protocol.Column) { +func printColumn(columns []*pbe.Column) { for _, col := range columns { fmt.Println(fmt.Sprintf("%s : %s update= %t", col.GetName(), col.GetValue(), col.GetUpdated())) }