-
Notifications
You must be signed in to change notification settings - Fork 1
/
encoder.pb.go
122 lines (97 loc) · 2.61 KB
/
encoder.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// Copyright (c) 2019 Meng Huang (mhboy@outlook.com)
// This package is licensed under a MIT license that can be found in the LICENSE file.
package rpc
// PBEncoder implements a header Encoder.
type PBEncoder struct{}
// NewPBEncoder returns a header Encoder.
func NewPBEncoder() Encoder {
return &PBEncoder{}
}
// NewRequest returns the instance of Request.
func (e *PBEncoder) NewRequest() Request {
return NewPBRequest()
}
// NewResponse returns the instance of Response.
func (e *PBEncoder) NewResponse() Response {
return NewPBResponse()
}
// NewCodec returns the instance of Codec.
func (e *PBEncoder) NewCodec() Codec {
return NewPBCodec()
}
// NewPBCodec returns the instance of Codec.
func NewPBCodec() Codec {
return &GOGOPBCodec{}
}
// NewPBRequest returns the instance of pbRequest.
func NewPBRequest() Request {
return &pbRequest{}
}
// Reset resets the pbRequest.
func (req *pbRequest) Reset() {
*req = pbRequest{}
}
// SetSeq sets the value of Seq.
func (req *pbRequest) SetSeq(seq uint64) {
req.Seq = seq
}
// GetSeq returns the value of Seq.
func (req *pbRequest) GetSeq() uint64 {
return req.Seq
}
// SetUpgrade sets the value of Upgrade.
func (req *pbRequest) SetUpgrade(upgrade []byte) {
req.Upgrade = upgrade
}
// GetUpgrade returns the value of Upgrade.
func (req *pbRequest) GetUpgrade() []byte {
return req.Upgrade
}
// SetServiceMethod sets the value of ServiceMethod.
func (req *pbRequest) SetServiceMethod(serviceMethod string) {
req.ServiceMethod = serviceMethod
}
// GetServiceMethod returns the value of ServiceMethod.
func (req *pbRequest) GetServiceMethod() string {
return req.ServiceMethod
}
// SetArgs sets the value of Args.
func (req *pbRequest) SetArgs(args []byte) {
req.Args = args
}
// GetArgs returns the value of Args.
func (req *pbRequest) GetArgs() []byte {
return req.Args
}
// NewPBResponse returns the instance of pbResponse.
func NewPBResponse() Response {
return &pbResponse{}
}
// Reset resets the pbResponse.
func (res *pbResponse) Reset() {
*res = pbResponse{}
}
// SetSeq sets the value of Seq.
func (res *pbResponse) SetSeq(seq uint64) {
res.Seq = seq
}
// GetSeq returns the value of Seq.
func (res *pbResponse) GetSeq() uint64 {
return res.Seq
}
// SetError sets the value of Error.
func (res *pbResponse) SetError(errorMsg string) {
res.Error = errorMsg
}
// GetError returns the value of Error.
func (res *pbResponse) GetError() string {
return res.Error
}
// SetReply sets the value of Reply.
func (res *pbResponse) SetReply(reply []byte) {
res.Reply = reply
}
// GetReply returns the value of Reply.
func (res *pbResponse) GetReply() []byte {
return res.Reply
}