github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/pkg/p2p/model.go (about) 1 // Copyright 2021 PingCAP, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package p2p 15 16 import ( 17 proto "github.com/pingcap/tiflow/proto/p2p" 18 ) 19 20 type ( 21 // NodeID represents the identifier of a sender node. 22 // Using IP address is not enough because of possible restarts. 23 NodeID = string 24 // Topic represents the topic for a peer-to-peer message 25 Topic = string 26 // Seq represents the serial number of a message for a given topic. 27 Seq = int64 28 // MessageServerStream is an alias for the protobuf-generated interface for the message service. 29 MessageServerStream = proto.CDCPeerToPeer_SendMessageServer 30 // MessageClientStream is an alias for the protobuf-generated interface for the message service. 31 MessageClientStream = proto.CDCPeerToPeer_SendMessageClient 32 ) 33 34 // MessageEntry is an alias for the protobuf-generated type for a message. 35 type MessageEntry = *proto.MessageEntry 36 37 // RawMessageEntry is an alias for the protobuf-generated type for a message. 38 type RawMessageEntry struct { 39 topic Topic 40 value interface{} 41 }