-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathencoder.code.go
122 lines (97 loc) · 2.58 KB
/
encoder.code.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 ([email protected])
// This package is licensed under a MIT license that can be found in the LICENSE file.
package rpc
// CODEEncoder implements a header Encoder.
type CODEEncoder struct{}
// NewCODEEncoder returns a header Encoder.
func NewCODEEncoder() Encoder {
return &CODEEncoder{}
}
// NewRequest returns the instance of Request.
func (e *CODEEncoder) NewRequest() Request {
return NewCODERequest()
}
// NewResponse returns the instance of Response.
func (e *CODEEncoder) NewResponse() Response {
return NewCODEResponse()
}
// NewCodec returns the instance of Codec.
func (e *CODEEncoder) NewCodec() Codec {
return NewCODECodec()
}
// NewCODECodec returns the instance of Codec.
func NewCODECodec() Codec {
return &CODECodec{}
}
// NewCODERequest returns the instance of codeRequest.
func NewCODERequest() Request {
return &request{}
}
//Reset resets the Request.
func (req *request) Reset() {
*req = request{}
}
//SetSeq sets the value of Seq.
func (req *request) SetSeq(seq uint64) {
req.Seq = seq
}
//GetSeq returns the value of Seq.
func (req *request) GetSeq() uint64 {
return req.Seq
}
//SetUpgrade sets the value of Upgrade.
func (req *request) SetUpgrade(upgrade []byte) {
req.Upgrade = upgrade
}
//GetUpgrade returns the value of Upgrade.
func (req *request) GetUpgrade() []byte {
return req.Upgrade
}
//SetServiceMethod sets the value of ServiceMethod.
func (req *request) SetServiceMethod(serviceMethod string) {
req.ServiceMethod = serviceMethod
}
//GetServiceMethod returns the value of ServiceMethod.
func (req *request) GetServiceMethod() string {
return req.ServiceMethod
}
//SetArgs sets the value of Args.
func (req *request) SetArgs(args []byte) {
req.Args = args
}
//GetArgs returns the value of Args.
func (req *request) GetArgs() []byte {
return req.Args
}
// NewCODEResponse returns the instance of codeResponse.
func NewCODEResponse() Response {
return &response{}
}
//Reset resets the Response.
func (res *response) Reset() {
*res = response{}
}
//SetSeq sets the value of Seq.
func (res *response) SetSeq(seq uint64) {
res.Seq = seq
}
//GetSeq returns the value of Seq.
func (res *response) GetSeq() uint64 {
return res.Seq
}
//SetError sets the value of Error.
func (res *response) SetError(errorMsg string) {
res.Error = errorMsg
}
//GetError returns the value of Error.
func (res *response) GetError() string {
return res.Error
}
//SetReply sets the value of Reply.
func (res *response) SetReply(reply []byte) {
res.Reply = reply
}
//GetReply returns the value of Reply.
func (res *response) GetReply() []byte {
return res.Reply
}