/
transport.pb.go
210 lines (176 loc) · 6.38 KB
/
transport.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// Code generated by protoc-gen-go.
// source: transport.proto
// DO NOT EDIT!
/*
Package crdt is a generated protocol buffer package.
It is generated from these files:
transport.proto
It has these top-level messages:
PingRequest
PingResult
QueryRequest
QueryResult
*/
package crdt
import proto "github.com/golang/protobuf/proto"
import fmt "fmt"
import math "math"
import (
context "golang.org/x/net/context"
grpc "google.golang.org/grpc"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// PingRequest contains the id that uniquely marks this
// request and the time this request was issued.
type PingRequest struct {
Id int32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
Timestamp int64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"`
}
func (m *PingRequest) Reset() { *m = PingRequest{} }
func (m *PingRequest) String() string { return proto.CompactTextString(m) }
func (*PingRequest) ProtoMessage() {}
// PingResult contains the id of the response and the time
// the reply was issued.
type PingResult struct {
Id int32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
Timestamp int64 `protobuf:"varint,2,opt,name=timestamp" json:"timestamp,omitempty"`
}
func (m *PingResult) Reset() { *m = PingResult{} }
func (m *PingResult) String() string { return proto.CompactTextString(m) }
func (*PingResult) ProtoMessage() {}
// QueryRequest contains the id of source server and the query
// reply as an array of bytes.
type QueryRequest struct {
Server string `protobuf:"bytes,1,opt,name=server" json:"server,omitempty"`
Query []byte `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"`
}
func (m *QueryRequest) Reset() { *m = QueryRequest{} }
func (m *QueryRequest) String() string { return proto.CompactTextString(m) }
func (*QueryRequest) ProtoMessage() {}
// QueryResult returns the result in form of an array of bytes.
type QueryResult struct {
Result []byte `protobuf:"bytes,1,opt,name=result,proto3" json:"result,omitempty"`
}
func (m *QueryResult) Reset() { *m = QueryResult{} }
func (m *QueryResult) String() string { return proto.CompactTextString(m) }
func (*QueryResult) ProtoMessage() {}
func init() {
proto.RegisterType((*PingRequest)(nil), "crdt.PingRequest")
proto.RegisterType((*PingResult)(nil), "crdt.PingResult")
proto.RegisterType((*QueryRequest)(nil), "crdt.QueryRequest")
proto.RegisterType((*QueryResult)(nil), "crdt.QueryResult")
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// Client API for ReplicationTransport service
type ReplicationTransportClient interface {
// Ping request results in a response that tells if further
// request/response can take place between the two nodes or not.
Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResult, error)
// Query issues a request that queries the peers current
// state to which it replies with the stream of query results.
Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (ReplicationTransport_QueryClient, error)
}
type replicationTransportClient struct {
cc *grpc.ClientConn
}
func NewReplicationTransportClient(cc *grpc.ClientConn) ReplicationTransportClient {
return &replicationTransportClient{cc}
}
func (c *replicationTransportClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingResult, error) {
out := new(PingResult)
err := grpc.Invoke(ctx, "/crdt.ReplicationTransport/Ping", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *replicationTransportClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (ReplicationTransport_QueryClient, error) {
stream, err := grpc.NewClientStream(ctx, &_ReplicationTransport_serviceDesc.Streams[0], c.cc, "/crdt.ReplicationTransport/Query", opts...)
if err != nil {
return nil, err
}
x := &replicationTransportQueryClient{stream}
if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err
}
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
return x, nil
}
type ReplicationTransport_QueryClient interface {
Recv() (*QueryResult, error)
grpc.ClientStream
}
type replicationTransportQueryClient struct {
grpc.ClientStream
}
func (x *replicationTransportQueryClient) Recv() (*QueryResult, error) {
m := new(QueryResult)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// Server API for ReplicationTransport service
type ReplicationTransportServer interface {
// Ping request results in a response that tells if further
// request/response can take place between the two nodes or not.
Ping(context.Context, *PingRequest) (*PingResult, error)
// Query issues a request that queries the peers current
// state to which it replies with the stream of query results.
Query(*QueryRequest, ReplicationTransport_QueryServer) error
}
func RegisterReplicationTransportServer(s *grpc.Server, srv ReplicationTransportServer) {
s.RegisterService(&_ReplicationTransport_serviceDesc, srv)
}
func _ReplicationTransport_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) {
in := new(PingRequest)
if err := dec(in); err != nil {
return nil, err
}
out, err := srv.(ReplicationTransportServer).Ping(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
func _ReplicationTransport_Query_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(QueryRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(ReplicationTransportServer).Query(m, &replicationTransportQueryServer{stream})
}
type ReplicationTransport_QueryServer interface {
Send(*QueryResult) error
grpc.ServerStream
}
type replicationTransportQueryServer struct {
grpc.ServerStream
}
func (x *replicationTransportQueryServer) Send(m *QueryResult) error {
return x.ServerStream.SendMsg(m)
}
var _ReplicationTransport_serviceDesc = grpc.ServiceDesc{
ServiceName: "crdt.ReplicationTransport",
HandlerType: (*ReplicationTransportServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Ping",
Handler: _ReplicationTransport_Ping_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "Query",
Handler: _ReplicationTransport_Query_Handler,
ServerStreams: true,
},
},
}