github.com/annchain/OG@v0.0.9/og/message_router_og32.go (about) 1 // Copyright © 2019 Annchain Authors <EMAIL ADDRESS> 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 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 package og 15 16 type MessageRouterOG02 struct { 17 GetNodeDataMsgHandler GetNodeDataMsgHandler 18 NodeDataMsgHandler NodeDataMsgHandler 19 GetReceiptsMsgHandler GetReceiptsMsgHandler 20 } 21 22 type GetNodeDataMsgHandler interface { 23 HandleGetNodeDataMsg(peerId string) 24 } 25 26 type NodeDataMsgHandler interface { 27 HandleNodeDataMsg(peerId string) 28 } 29 30 type GetReceiptsMsgHandler interface { 31 HandleGetReceiptsMsg(peerId string) 32 } 33 34 func (m *MessageRouterOG02) Start() { 35 } 36 37 func (m *MessageRouterOG02) Stop() { 38 39 } 40 41 func (m *MessageRouterOG02) Name() string { 42 return "MessageRouterOG32" 43 } 44 45 func (m *MessageRouterOG02) RouteGetNodeDataMsg(msg *types) { 46 m.GetNodeDataMsgHandler.HandleGetNodeDataMsg(msg.SourceID) 47 } 48 49 func (m *MessageRouterOG02) RouteNodeDataMsg(msg *types) { 50 m.NodeDataMsgHandler.HandleNodeDataMsg(msg.SourceID) 51 } 52 53 func (m *MessageRouterOG02) RouteGetReceiptsMsg(msg *types) { 54 m.GetReceiptsMsgHandler.HandleGetReceiptsMsg(msg.SourceID) 55 }