-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapi_srpc.pb.go
191 lines (159 loc) · 5.83 KB
/
api_srpc.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// Code generated by protoc-gen-srpc. DO NOT EDIT.
// protoc-gen-srpc version: v0.38.1
// source: github.com/aperturerobotics/controllerbus/bus/api/api.proto
package bus_api
import (
context "context"
exec "github.com/aperturerobotics/controllerbus/controller/exec"
srpc "github.com/aperturerobotics/starpc/srpc"
)
type SRPCControllerBusServiceClient interface {
// SRPCClient returns the underlying SRPC client.
SRPCClient() srpc.Client
// GetBusInfo requests information about the controller bus.
GetBusInfo(ctx context.Context, in *GetBusInfoRequest) (*GetBusInfoResponse, error)
// ExecController executes a controller configuration on the bus.
ExecController(ctx context.Context, in *exec.ExecControllerRequest) (SRPCControllerBusService_ExecControllerClient, error)
}
type srpcControllerBusServiceClient struct {
cc srpc.Client
serviceID string
}
func NewSRPCControllerBusServiceClient(cc srpc.Client) SRPCControllerBusServiceClient {
return &srpcControllerBusServiceClient{cc: cc, serviceID: SRPCControllerBusServiceServiceID}
}
func NewSRPCControllerBusServiceClientWithServiceID(cc srpc.Client, serviceID string) SRPCControllerBusServiceClient {
if serviceID == "" {
serviceID = SRPCControllerBusServiceServiceID
}
return &srpcControllerBusServiceClient{cc: cc, serviceID: serviceID}
}
func (c *srpcControllerBusServiceClient) SRPCClient() srpc.Client { return c.cc }
func (c *srpcControllerBusServiceClient) GetBusInfo(ctx context.Context, in *GetBusInfoRequest) (*GetBusInfoResponse, error) {
out := new(GetBusInfoResponse)
err := c.cc.ExecCall(ctx, c.serviceID, "GetBusInfo", in, out)
if err != nil {
return nil, err
}
return out, nil
}
func (c *srpcControllerBusServiceClient) ExecController(ctx context.Context, in *exec.ExecControllerRequest) (SRPCControllerBusService_ExecControllerClient, error) {
stream, err := c.cc.NewStream(ctx, c.serviceID, "ExecController", in)
if err != nil {
return nil, err
}
strm := &srpcControllerBusService_ExecControllerClient{stream}
if err := strm.CloseSend(); err != nil {
return nil, err
}
return strm, nil
}
type SRPCControllerBusService_ExecControllerClient interface {
srpc.Stream
Recv() (*exec.ExecControllerResponse, error)
RecvTo(*exec.ExecControllerResponse) error
}
type srpcControllerBusService_ExecControllerClient struct {
srpc.Stream
}
func (x *srpcControllerBusService_ExecControllerClient) Recv() (*exec.ExecControllerResponse, error) {
m := new(exec.ExecControllerResponse)
if err := x.MsgRecv(m); err != nil {
return nil, err
}
return m, nil
}
func (x *srpcControllerBusService_ExecControllerClient) RecvTo(m *exec.ExecControllerResponse) error {
return x.MsgRecv(m)
}
type SRPCControllerBusServiceServer interface {
// GetBusInfo requests information about the controller bus.
GetBusInfo(context.Context, *GetBusInfoRequest) (*GetBusInfoResponse, error)
// ExecController executes a controller configuration on the bus.
ExecController(*exec.ExecControllerRequest, SRPCControllerBusService_ExecControllerStream) error
}
const SRPCControllerBusServiceServiceID = "bus.api.ControllerBusService"
type SRPCControllerBusServiceHandler struct {
serviceID string
impl SRPCControllerBusServiceServer
}
// NewSRPCControllerBusServiceHandler constructs a new RPC handler.
// serviceID: if empty, uses default: bus.api.ControllerBusService
func NewSRPCControllerBusServiceHandler(impl SRPCControllerBusServiceServer, serviceID string) srpc.Handler {
if serviceID == "" {
serviceID = SRPCControllerBusServiceServiceID
}
return &SRPCControllerBusServiceHandler{impl: impl, serviceID: serviceID}
}
// SRPCRegisterControllerBusService registers the implementation with the mux.
// Uses the default serviceID: bus.api.ControllerBusService
func SRPCRegisterControllerBusService(mux srpc.Mux, impl SRPCControllerBusServiceServer) error {
return mux.Register(NewSRPCControllerBusServiceHandler(impl, ""))
}
func (d *SRPCControllerBusServiceHandler) GetServiceID() string { return d.serviceID }
func (SRPCControllerBusServiceHandler) GetMethodIDs() []string {
return []string{
"GetBusInfo",
"ExecController",
}
}
func (d *SRPCControllerBusServiceHandler) InvokeMethod(
serviceID, methodID string,
strm srpc.Stream,
) (bool, error) {
if serviceID != "" && serviceID != d.GetServiceID() {
return false, nil
}
switch methodID {
case "GetBusInfo":
return true, d.InvokeMethod_GetBusInfo(d.impl, strm)
case "ExecController":
return true, d.InvokeMethod_ExecController(d.impl, strm)
default:
return false, nil
}
}
func (SRPCControllerBusServiceHandler) InvokeMethod_GetBusInfo(impl SRPCControllerBusServiceServer, strm srpc.Stream) error {
req := new(GetBusInfoRequest)
if err := strm.MsgRecv(req); err != nil {
return err
}
out, err := impl.GetBusInfo(strm.Context(), req)
if err != nil {
return err
}
return strm.MsgSend(out)
}
func (SRPCControllerBusServiceHandler) InvokeMethod_ExecController(impl SRPCControllerBusServiceServer, strm srpc.Stream) error {
req := new(exec.ExecControllerRequest)
if err := strm.MsgRecv(req); err != nil {
return err
}
serverStrm := &srpcControllerBusService_ExecControllerStream{strm}
return impl.ExecController(req, serverStrm)
}
type SRPCControllerBusService_GetBusInfoStream interface {
srpc.Stream
}
type srpcControllerBusService_GetBusInfoStream struct {
srpc.Stream
}
type SRPCControllerBusService_ExecControllerStream interface {
srpc.Stream
Send(*exec.ExecControllerResponse) error
SendAndClose(*exec.ExecControllerResponse) error
}
type srpcControllerBusService_ExecControllerStream struct {
srpc.Stream
}
func (x *srpcControllerBusService_ExecControllerStream) Send(m *exec.ExecControllerResponse) error {
return x.MsgSend(m)
}
func (x *srpcControllerBusService_ExecControllerStream) SendAndClose(m *exec.ExecControllerResponse) error {
if m != nil {
if err := x.MsgSend(m); err != nil {
return err
}
}
return x.CloseSend()
}