/
echo_drpc.pb.go
111 lines (87 loc) · 2.85 KB
/
echo_drpc.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
// Code generated by protoc-gen-go-drpc. DO NOT EDIT.
// protoc-gen-go-drpc version: v0.0.33
// source: echo/echo.proto
package echo
import (
context "context"
errors "errors"
protojson "google.golang.org/protobuf/encoding/protojson"
proto "google.golang.org/protobuf/proto"
drpc "storj.io/drpc"
drpcerr "storj.io/drpc/drpcerr"
)
type drpcEncoding_File_echo_echo_proto struct{}
func (drpcEncoding_File_echo_echo_proto) Marshal(msg drpc.Message) ([]byte, error) {
return proto.Marshal(msg.(proto.Message))
}
func (drpcEncoding_File_echo_echo_proto) MarshalAppend(buf []byte, msg drpc.Message) ([]byte, error) {
return proto.MarshalOptions{}.MarshalAppend(buf, msg.(proto.Message))
}
func (drpcEncoding_File_echo_echo_proto) Unmarshal(buf []byte, msg drpc.Message) error {
return proto.Unmarshal(buf, msg.(proto.Message))
}
func (drpcEncoding_File_echo_echo_proto) JSONMarshal(msg drpc.Message) ([]byte, error) {
return protojson.Marshal(msg.(proto.Message))
}
func (drpcEncoding_File_echo_echo_proto) JSONUnmarshal(buf []byte, msg drpc.Message) error {
return protojson.Unmarshal(buf, msg.(proto.Message))
}
type DRPCEchoClient interface {
DRPCConn() drpc.Conn
Echo(ctx context.Context, in *Req) (*Resp, error)
}
type drpcEchoClient struct {
cc drpc.Conn
}
func NewDRPCEchoClient(cc drpc.Conn) DRPCEchoClient {
return &drpcEchoClient{cc}
}
func (c *drpcEchoClient) DRPCConn() drpc.Conn { return c.cc }
func (c *drpcEchoClient) Echo(ctx context.Context, in *Req) (*Resp, error) {
out := new(Resp)
err := c.cc.Invoke(ctx, "/echo.Echo/Echo", drpcEncoding_File_echo_echo_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
type DRPCEchoServer interface {
Echo(context.Context, *Req) (*Resp, error)
}
type DRPCEchoUnimplementedServer struct{}
func (s *DRPCEchoUnimplementedServer) Echo(context.Context, *Req) (*Resp, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
type DRPCEchoDescription struct{}
func (DRPCEchoDescription) NumMethods() int { return 1 }
func (DRPCEchoDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n {
case 0:
return "/echo.Echo/Echo", drpcEncoding_File_echo_echo_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCEchoServer).
Echo(
ctx,
in1.(*Req),
)
}, DRPCEchoServer.Echo, true
default:
return "", nil, nil, nil, false
}
}
func DRPCRegisterEcho(mux drpc.Mux, impl DRPCEchoServer) error {
return mux.Register(impl, DRPCEchoDescription{})
}
type DRPCEcho_EchoStream interface {
drpc.Stream
SendAndClose(*Resp) error
}
type drpcEcho_EchoStream struct {
drpc.Stream
}
func (x *drpcEcho_EchoStream) SendAndClose(m *Resp) error {
if err := x.MsgSend(m, drpcEncoding_File_echo_echo_proto{}); err != nil {
return err
}
return x.CloseSend()
}