github.com/matrixorigin/matrixone@v1.2.0/pkg/pb/plugin/plugin.go (about) 1 // Copyright 2021 - 2023 Matrix Origin 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 15 package plugin 16 17 import ( 18 "bytes" 19 "fmt" 20 ) 21 22 // SetID implement morpc Messgae 23 func (m *Request) SetID(id uint64) { 24 m.RequestID = id 25 } 26 27 // GetID implement morpc Messgae 28 func (m *Request) GetID() uint64 { 29 return m.RequestID 30 } 31 32 // DebugString returns the debug string 33 func (m *Request) DebugString() string { 34 var buffer bytes.Buffer 35 buffer.WriteString(fmt.Sprintf("%d: ", m.RequestID)) 36 buffer.WriteString(m.ClientInfo.String()) 37 buffer.WriteString("/") 38 return buffer.String() 39 } 40 41 func (m *Response) SetID(id uint64) { 42 m.RequestID = id 43 } 44 45 // GetID implement morpc Messgae 46 func (m *Response) GetID() uint64 { 47 return m.RequestID 48 } 49 50 func (m *Response) DebugString() string { 51 var buffer bytes.Buffer 52 buffer.WriteString(fmt.Sprintf("%d: ", m.RequestID)) 53 buffer.WriteString(m.Recommendation.String()) 54 buffer.WriteString("/") 55 return buffer.String() 56 }