1 // Code generated by protoc-gen-go. DO NOT EDIT.
2 // source: google/bytestream/bytestream.proto
5 Package bytestream is a generated protocol buffer package.
7 It is generated from these files:
8 google/bytestream/bytestream.proto
10 It has these top-level messages:
15 QueryWriteStatusRequest
16 QueryWriteStatusResponse
20 import proto "github.com/golang/protobuf/proto"
23 import _ "google.golang.org/genproto/googleapis/api/annotations"
24 import _ "github.com/golang/protobuf/ptypes/wrappers"
27 context "golang.org/x/net/context"
28 grpc "google.golang.org/grpc"
31 // Reference imports to suppress errors if they are not otherwise used.
36 // This is a compile-time assertion to ensure that this generated file
37 // is compatible with the proto package it is being compiled against.
38 // A compilation error at this line likely means your copy of the
39 // proto package needs to be updated.
40 const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
42 // Request object for ByteStream.Read.
43 type ReadRequest struct {
44 // The name of the resource to read.
45 ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName" json:"resource_name,omitempty"`
46 // The offset for the first byte to return in the read, relative to the start
49 // A `read_offset` that is negative or greater than the size of the resource
50 // will cause an `OUT_OF_RANGE` error.
51 ReadOffset int64 `protobuf:"varint,2,opt,name=read_offset,json=readOffset" json:"read_offset,omitempty"`
52 // The maximum number of `data` bytes the server is allowed to return in the
53 // sum of all `ReadResponse` messages. A `read_limit` of zero indicates that
54 // there is no limit, and a negative `read_limit` will cause an error.
56 // If the stream returns fewer bytes than allowed by the `read_limit` and no
57 // error occurred, the stream includes all data from the `read_offset` to the
58 // end of the resource.
59 ReadLimit int64 `protobuf:"varint,3,opt,name=read_limit,json=readLimit" json:"read_limit,omitempty"`
62 func (m *ReadRequest) Reset() { *m = ReadRequest{} }
63 func (m *ReadRequest) String() string { return proto.CompactTextString(m) }
64 func (*ReadRequest) ProtoMessage() {}
65 func (*ReadRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
67 func (m *ReadRequest) GetResourceName() string {
74 func (m *ReadRequest) GetReadOffset() int64 {
81 func (m *ReadRequest) GetReadLimit() int64 {
88 // Response object for ByteStream.Read.
89 type ReadResponse struct {
90 // A portion of the data for the resource. The service **may** leave `data`
91 // empty for any given `ReadResponse`. This enables the service to inform the
92 // client that the request is still live while it is running an operation to
93 // generate more data.
94 Data []byte `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"`
97 func (m *ReadResponse) Reset() { *m = ReadResponse{} }
98 func (m *ReadResponse) String() string { return proto.CompactTextString(m) }
99 func (*ReadResponse) ProtoMessage() {}
100 func (*ReadResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
102 func (m *ReadResponse) GetData() []byte {
109 // Request object for ByteStream.Write.
110 type WriteRequest struct {
111 // The name of the resource to write. This **must** be set on the first
112 // `WriteRequest` of each `Write()` action. If it is set on subsequent calls,
113 // it **must** match the value of the first request.
114 ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName" json:"resource_name,omitempty"`
115 // The offset from the beginning of the resource at which the data should be
116 // written. It is required on all `WriteRequest`s.
118 // In the first `WriteRequest` of a `Write()` action, it indicates
119 // the initial offset for the `Write()` call. The value **must** be equal to
120 // the `committed_size` that a call to `QueryWriteStatus()` would return.
122 // On subsequent calls, this value **must** be set and **must** be equal to
123 // the sum of the first `write_offset` and the sizes of all `data` bundles
124 // sent previously on this stream.
126 // An incorrect value will cause an error.
127 WriteOffset int64 `protobuf:"varint,2,opt,name=write_offset,json=writeOffset" json:"write_offset,omitempty"`
128 // If `true`, this indicates that the write is complete. Sending any
129 // `WriteRequest`s subsequent to one in which `finish_write` is `true` will
131 FinishWrite bool `protobuf:"varint,3,opt,name=finish_write,json=finishWrite" json:"finish_write,omitempty"`
132 // A portion of the data for the resource. The client **may** leave `data`
133 // empty for any given `WriteRequest`. This enables the client to inform the
134 // service that the request is still live while it is running an operation to
135 // generate more data.
136 Data []byte `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"`
139 func (m *WriteRequest) Reset() { *m = WriteRequest{} }
140 func (m *WriteRequest) String() string { return proto.CompactTextString(m) }
141 func (*WriteRequest) ProtoMessage() {}
142 func (*WriteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
144 func (m *WriteRequest) GetResourceName() string {
146 return m.ResourceName
151 func (m *WriteRequest) GetWriteOffset() int64 {
158 func (m *WriteRequest) GetFinishWrite() bool {
165 func (m *WriteRequest) GetData() []byte {
172 // Response object for ByteStream.Write.
173 type WriteResponse struct {
174 // The number of bytes that have been processed for the given resource.
175 CommittedSize int64 `protobuf:"varint,1,opt,name=committed_size,json=committedSize" json:"committed_size,omitempty"`
178 func (m *WriteResponse) Reset() { *m = WriteResponse{} }
179 func (m *WriteResponse) String() string { return proto.CompactTextString(m) }
180 func (*WriteResponse) ProtoMessage() {}
181 func (*WriteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
183 func (m *WriteResponse) GetCommittedSize() int64 {
185 return m.CommittedSize
190 // Request object for ByteStream.QueryWriteStatus.
191 type QueryWriteStatusRequest struct {
192 // The name of the resource whose write status is being requested.
193 ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName" json:"resource_name,omitempty"`
196 func (m *QueryWriteStatusRequest) Reset() { *m = QueryWriteStatusRequest{} }
197 func (m *QueryWriteStatusRequest) String() string { return proto.CompactTextString(m) }
198 func (*QueryWriteStatusRequest) ProtoMessage() {}
199 func (*QueryWriteStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
201 func (m *QueryWriteStatusRequest) GetResourceName() string {
203 return m.ResourceName
208 // Response object for ByteStream.QueryWriteStatus.
209 type QueryWriteStatusResponse struct {
210 // The number of bytes that have been processed for the given resource.
211 CommittedSize int64 `protobuf:"varint,1,opt,name=committed_size,json=committedSize" json:"committed_size,omitempty"`
212 // `complete` is `true` only if the client has sent a `WriteRequest` with
213 // `finish_write` set to true, and the server has processed that request.
214 Complete bool `protobuf:"varint,2,opt,name=complete" json:"complete,omitempty"`
217 func (m *QueryWriteStatusResponse) Reset() { *m = QueryWriteStatusResponse{} }
218 func (m *QueryWriteStatusResponse) String() string { return proto.CompactTextString(m) }
219 func (*QueryWriteStatusResponse) ProtoMessage() {}
220 func (*QueryWriteStatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
222 func (m *QueryWriteStatusResponse) GetCommittedSize() int64 {
224 return m.CommittedSize
229 func (m *QueryWriteStatusResponse) GetComplete() bool {
237 proto.RegisterType((*ReadRequest)(nil), "google.bytestream.ReadRequest")
238 proto.RegisterType((*ReadResponse)(nil), "google.bytestream.ReadResponse")
239 proto.RegisterType((*WriteRequest)(nil), "google.bytestream.WriteRequest")
240 proto.RegisterType((*WriteResponse)(nil), "google.bytestream.WriteResponse")
241 proto.RegisterType((*QueryWriteStatusRequest)(nil), "google.bytestream.QueryWriteStatusRequest")
242 proto.RegisterType((*QueryWriteStatusResponse)(nil), "google.bytestream.QueryWriteStatusResponse")
245 // Reference imports to suppress errors if they are not otherwise used.
246 var _ context.Context
247 var _ grpc.ClientConn
249 // This is a compile-time assertion to ensure that this generated file
250 // is compatible with the grpc package it is being compiled against.
251 const _ = grpc.SupportPackageIsVersion4
253 // Client API for ByteStream service
255 type ByteStreamClient interface {
256 // `Read()` is used to retrieve the contents of a resource as a sequence
257 // of bytes. The bytes are returned in a sequence of responses, and the
258 // responses are delivered as the results of a server-side streaming RPC.
259 Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (ByteStream_ReadClient, error)
260 // `Write()` is used to send the contents of a resource as a sequence of
261 // bytes. The bytes are sent in a sequence of request protos of a client-side
264 // A `Write()` action is resumable. If there is an error or the connection is
265 // broken during the `Write()`, the client should check the status of the
266 // `Write()` by calling `QueryWriteStatus()` and continue writing from the
267 // returned `committed_size`. This may be less than the amount of data the
268 // client previously sent.
270 // Calling `Write()` on a resource name that was previously written and
271 // finalized could cause an error, depending on whether the underlying service
272 // allows over-writing of previously written resources.
274 // When the client closes the request channel, the service will respond with
275 // a `WriteResponse`. The service will not view the resource as `complete`
276 // until the client has sent a `WriteRequest` with `finish_write` set to
277 // `true`. Sending any requests on a stream after sending a request with
278 // `finish_write` set to `true` will cause an error. The client **should**
279 // check the `WriteResponse` it receives to determine how much data the
280 // service was able to commit and whether the service views the resource as
281 // `complete` or not.
282 Write(ctx context.Context, opts ...grpc.CallOption) (ByteStream_WriteClient, error)
283 // `QueryWriteStatus()` is used to find the `committed_size` for a resource
284 // that is being written, which can then be used as the `write_offset` for
285 // the next `Write()` call.
287 // If the resource does not exist (i.e., the resource has been deleted, or the
288 // first `Write()` has not yet reached the service), this method returns the
289 // error `NOT_FOUND`.
291 // The client **may** call `QueryWriteStatus()` at any time to determine how
292 // much data has been processed for this resource. This is useful if the
293 // client is buffering data and needs to know which data can be safely
294 // evicted. For any sequence of `QueryWriteStatus()` calls for a given
295 // resource name, the sequence of returned `committed_size` values will be
297 QueryWriteStatus(ctx context.Context, in *QueryWriteStatusRequest, opts ...grpc.CallOption) (*QueryWriteStatusResponse, error)
300 type byteStreamClient struct {
304 func NewByteStreamClient(cc *grpc.ClientConn) ByteStreamClient {
305 return &byteStreamClient{cc}
308 func (c *byteStreamClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (ByteStream_ReadClient, error) {
309 stream, err := grpc.NewClientStream(ctx, &_ByteStream_serviceDesc.Streams[0], c.cc, "/google.bytestream.ByteStream/Read", opts...)
313 x := &byteStreamReadClient{stream}
314 if err := x.ClientStream.SendMsg(in); err != nil {
317 if err := x.ClientStream.CloseSend(); err != nil {
323 type ByteStream_ReadClient interface {
324 Recv() (*ReadResponse, error)
328 type byteStreamReadClient struct {
332 func (x *byteStreamReadClient) Recv() (*ReadResponse, error) {
333 m := new(ReadResponse)
334 if err := x.ClientStream.RecvMsg(m); err != nil {
340 func (c *byteStreamClient) Write(ctx context.Context, opts ...grpc.CallOption) (ByteStream_WriteClient, error) {
341 stream, err := grpc.NewClientStream(ctx, &_ByteStream_serviceDesc.Streams[1], c.cc, "/google.bytestream.ByteStream/Write", opts...)
345 x := &byteStreamWriteClient{stream}
349 type ByteStream_WriteClient interface {
350 Send(*WriteRequest) error
351 CloseAndRecv() (*WriteResponse, error)
355 type byteStreamWriteClient struct {
359 func (x *byteStreamWriteClient) Send(m *WriteRequest) error {
360 return x.ClientStream.SendMsg(m)
363 func (x *byteStreamWriteClient) CloseAndRecv() (*WriteResponse, error) {
364 if err := x.ClientStream.CloseSend(); err != nil {
367 m := new(WriteResponse)
368 if err := x.ClientStream.RecvMsg(m); err != nil {
374 func (c *byteStreamClient) QueryWriteStatus(ctx context.Context, in *QueryWriteStatusRequest, opts ...grpc.CallOption) (*QueryWriteStatusResponse, error) {
375 out := new(QueryWriteStatusResponse)
376 err := grpc.Invoke(ctx, "/google.bytestream.ByteStream/QueryWriteStatus", in, out, c.cc, opts...)
383 // Server API for ByteStream service
385 type ByteStreamServer interface {
386 // `Read()` is used to retrieve the contents of a resource as a sequence
387 // of bytes. The bytes are returned in a sequence of responses, and the
388 // responses are delivered as the results of a server-side streaming RPC.
389 Read(*ReadRequest, ByteStream_ReadServer) error
390 // `Write()` is used to send the contents of a resource as a sequence of
391 // bytes. The bytes are sent in a sequence of request protos of a client-side
394 // A `Write()` action is resumable. If there is an error or the connection is
395 // broken during the `Write()`, the client should check the status of the
396 // `Write()` by calling `QueryWriteStatus()` and continue writing from the
397 // returned `committed_size`. This may be less than the amount of data the
398 // client previously sent.
400 // Calling `Write()` on a resource name that was previously written and
401 // finalized could cause an error, depending on whether the underlying service
402 // allows over-writing of previously written resources.
404 // When the client closes the request channel, the service will respond with
405 // a `WriteResponse`. The service will not view the resource as `complete`
406 // until the client has sent a `WriteRequest` with `finish_write` set to
407 // `true`. Sending any requests on a stream after sending a request with
408 // `finish_write` set to `true` will cause an error. The client **should**
409 // check the `WriteResponse` it receives to determine how much data the
410 // service was able to commit and whether the service views the resource as
411 // `complete` or not.
412 Write(ByteStream_WriteServer) error
413 // `QueryWriteStatus()` is used to find the `committed_size` for a resource
414 // that is being written, which can then be used as the `write_offset` for
415 // the next `Write()` call.
417 // If the resource does not exist (i.e., the resource has been deleted, or the
418 // first `Write()` has not yet reached the service), this method returns the
419 // error `NOT_FOUND`.
421 // The client **may** call `QueryWriteStatus()` at any time to determine how
422 // much data has been processed for this resource. This is useful if the
423 // client is buffering data and needs to know which data can be safely
424 // evicted. For any sequence of `QueryWriteStatus()` calls for a given
425 // resource name, the sequence of returned `committed_size` values will be
427 QueryWriteStatus(context.Context, *QueryWriteStatusRequest) (*QueryWriteStatusResponse, error)
430 func RegisterByteStreamServer(s *grpc.Server, srv ByteStreamServer) {
431 s.RegisterService(&_ByteStream_serviceDesc, srv)
434 func _ByteStream_Read_Handler(srv interface{}, stream grpc.ServerStream) error {
435 m := new(ReadRequest)
436 if err := stream.RecvMsg(m); err != nil {
439 return srv.(ByteStreamServer).Read(m, &byteStreamReadServer{stream})
442 type ByteStream_ReadServer interface {
443 Send(*ReadResponse) error
447 type byteStreamReadServer struct {
451 func (x *byteStreamReadServer) Send(m *ReadResponse) error {
452 return x.ServerStream.SendMsg(m)
455 func _ByteStream_Write_Handler(srv interface{}, stream grpc.ServerStream) error {
456 return srv.(ByteStreamServer).Write(&byteStreamWriteServer{stream})
459 type ByteStream_WriteServer interface {
460 SendAndClose(*WriteResponse) error
461 Recv() (*WriteRequest, error)
465 type byteStreamWriteServer struct {
469 func (x *byteStreamWriteServer) SendAndClose(m *WriteResponse) error {
470 return x.ServerStream.SendMsg(m)
473 func (x *byteStreamWriteServer) Recv() (*WriteRequest, error) {
474 m := new(WriteRequest)
475 if err := x.ServerStream.RecvMsg(m); err != nil {
481 func _ByteStream_QueryWriteStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
482 in := new(QueryWriteStatusRequest)
483 if err := dec(in); err != nil {
486 if interceptor == nil {
487 return srv.(ByteStreamServer).QueryWriteStatus(ctx, in)
489 info := &grpc.UnaryServerInfo{
491 FullMethod: "/google.bytestream.ByteStream/QueryWriteStatus",
493 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
494 return srv.(ByteStreamServer).QueryWriteStatus(ctx, req.(*QueryWriteStatusRequest))
496 return interceptor(ctx, in, info, handler)
499 var _ByteStream_serviceDesc = grpc.ServiceDesc{
500 ServiceName: "google.bytestream.ByteStream",
501 HandlerType: (*ByteStreamServer)(nil),
502 Methods: []grpc.MethodDesc{
504 MethodName: "QueryWriteStatus",
505 Handler: _ByteStream_QueryWriteStatus_Handler,
508 Streams: []grpc.StreamDesc{
511 Handler: _ByteStream_Read_Handler,
516 Handler: _ByteStream_Write_Handler,
520 Metadata: "google/bytestream/bytestream.proto",
523 func init() { proto.RegisterFile("google/bytestream/bytestream.proto", fileDescriptor0) }
525 var fileDescriptor0 = []byte{
526 // 446 bytes of a gzipped FileDescriptorProto
527 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x5b, 0x8b, 0x13, 0x31,
528 0x14, 0x66, 0xb6, 0xab, 0x74, 0x4f, 0xa7, 0x5e, 0x02, 0xe2, 0x30, 0xe8, 0x6e, 0x77, 0x44, 0x28,
529 0x0a, 0x33, 0xa2, 0xe0, 0xcb, 0x82, 0x0f, 0x7d, 0x13, 0x16, 0x2f, 0xd9, 0x07, 0x41, 0x90, 0x21,
530 0x6d, 0x4f, 0xc7, 0x60, 0x93, 0x8c, 0x49, 0x86, 0xa5, 0xfb, 0x1f, 0x7c, 0xf1, 0x17, 0x4b, 0x92,
531 0xb1, 0x1d, 0x6d, 0x0b, 0xdb, 0xb7, 0xe4, 0xbb, 0xcc, 0xf9, 0xe6, 0xe4, 0x1c, 0xc8, 0x2a, 0xa5,
532 0xaa, 0x25, 0x16, 0xd3, 0x95, 0x45, 0x63, 0x35, 0x32, 0xd1, 0x39, 0xe6, 0xb5, 0x56, 0x56, 0x91,
533 0x87, 0x41, 0x93, 0x6f, 0x88, 0xf4, 0x49, 0x6b, 0x63, 0x35, 0x2f, 0x98, 0x94, 0xca, 0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