/
errapi.rpcx.pb.go
103 lines (84 loc) · 3.22 KB
/
errapi.rpcx.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
// Code generated by protoc-gen-rpcx. DO NOT EDIT.
// versions:
// - protoc-gen-rpcx v0.3.0
// - protoc (unknown)
// source: errapi/errapi.proto
package errapi
import (
context "context"
client "github.com/smallnest/rpcx/client"
protocol "github.com/smallnest/rpcx/protocol"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = context.TODO
var _ = client.NewClient
var _ = protocol.NewMessage
// ================== interface skeleton ===================
type ErrAPIAble interface {
// ErrAPIAble can be used for interface verification.
// SayHello is server rpc method as defined
SayHello(ctx context.Context, args *HelloRequest, reply *HelloReply) (err error)
// TestError is server rpc method as defined
TestError(ctx context.Context, args *ErrorRequest, reply *ErrorReply) (err error)
}
// ================== client stub ===================
// ErrAPI is a client wrapped XClient.
type ErrAPIClient struct {
xclient client.XClient
}
// NewErrAPIClient wraps a XClient as ErrAPIClient.
// You can pass a shared XClient object created by NewXClientForErrAPI.
func NewErrAPIClient(xclient client.XClient) *ErrAPIClient {
return &ErrAPIClient{xclient: xclient}
}
// NewXClientForErrAPI creates a XClient.
// You can configure this client with more options such as etcd registry, serialize type, select algorithm and fail mode.
func NewXClientForErrAPI(addr string) (client.XClient, error) {
d, err := client.NewPeer2PeerDiscovery("tcp@"+addr, "")
if err != nil {
return nil, err
}
opt := client.DefaultOption
opt.SerializeType = protocol.ProtoBuffer
xclient := client.NewXClient("ErrAPI", client.Failtry, client.RoundRobin, d, opt)
return xclient, nil
}
// SayHello is client rpc method as defined
func (c *ErrAPIClient) SayHello(ctx context.Context, args *HelloRequest) (reply *HelloReply, err error) {
reply = &HelloReply{}
err = c.xclient.Call(ctx, "SayHello", args, reply)
return reply, err
}
// TestError is client rpc method as defined
func (c *ErrAPIClient) TestError(ctx context.Context, args *ErrorRequest) (reply *ErrorReply, err error) {
reply = &ErrorReply{}
err = c.xclient.Call(ctx, "TestError", args, reply)
return reply, err
}
// ================== oneclient stub ===================
// ErrAPIOneClient is a client wrapped oneClient.
type ErrAPIOneClient struct {
serviceName string
oneclient *client.OneClient
}
// NewErrAPIOneClient wraps a OneClient as ErrAPIOneClient.
// You can pass a shared OneClient object created by NewOneClientForErrAPI.
func NewErrAPIOneClient(oneclient *client.OneClient) *ErrAPIOneClient {
return &ErrAPIOneClient{
serviceName: "ErrAPI",
oneclient: oneclient,
}
}
// ======================================================
// SayHello is client rpc method as defined
func (c *ErrAPIOneClient) SayHello(ctx context.Context, args *HelloRequest) (reply *HelloReply, err error) {
reply = &HelloReply{}
err = c.oneclient.Call(ctx, c.serviceName, "SayHello", args, reply)
return reply, err
}
// TestError is client rpc method as defined
func (c *ErrAPIOneClient) TestError(ctx context.Context, args *ErrorRequest) (reply *ErrorReply, err error) {
reply = &ErrorReply{}
err = c.oneclient.Call(ctx, c.serviceName, "TestError", args, reply)
return reply, err
}