1// Code generated by protoc-gen-go. DO NOT EDIT. 2// source: google/bytestream/bytestream.proto 3 4package bytestream 5 6import ( 7 context "context" 8 fmt "fmt" 9 math "math" 10 11 proto "github.com/golang/protobuf/proto" 12 _ "github.com/golang/protobuf/ptypes/wrappers" 13 _ "google.golang.org/genproto/googleapis/api/annotations" 14 grpc "google.golang.org/grpc" 15) 16 17// Reference imports to suppress errors if they are not otherwise used. 18var _ = proto.Marshal 19var _ = fmt.Errorf 20var _ = math.Inf 21 22// This is a compile-time assertion to ensure that this generated file 23// is compatible with the proto package it is being compiled against. 24// A compilation error at this line likely means your copy of the 25// proto package needs to be updated. 26const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package 27 28// Request object for ByteStream.Read. 29type ReadRequest struct { 30 // The name of the resource to read. 31 ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` 32 // The offset for the first byte to return in the read, relative to the start 33 // of the resource. 34 // 35 // A `read_offset` that is negative or greater than the size of the resource 36 // will cause an `OUT_OF_RANGE` error. 37 ReadOffset int64 `protobuf:"varint,2,opt,name=read_offset,json=readOffset,proto3" json:"read_offset,omitempty"` 38 // The maximum number of `data` bytes the server is allowed to return in the 39 // sum of all `ReadResponse` messages. A `read_limit` of zero indicates that 40 // there is no limit, and a negative `read_limit` will cause an error. 41 // 42 // If the stream returns fewer bytes than allowed by the `read_limit` and no 43 // error occurred, the stream includes all data from the `read_offset` to the 44 // end of the resource. 45 ReadLimit int64 `protobuf:"varint,3,opt,name=read_limit,json=readLimit,proto3" json:"read_limit,omitempty"` 46 XXX_NoUnkeyedLiteral struct{} `json:"-"` 47 XXX_unrecognized []byte `json:"-"` 48 XXX_sizecache int32 `json:"-"` 49} 50 51func (m *ReadRequest) Reset() { *m = ReadRequest{} } 52func (m *ReadRequest) String() string { return proto.CompactTextString(m) } 53func (*ReadRequest) ProtoMessage() {} 54func (*ReadRequest) Descriptor() ([]byte, []int) { 55 return fileDescriptor_657cab877f44cd08, []int{0} 56} 57 58func (m *ReadRequest) XXX_Unmarshal(b []byte) error { 59 return xxx_messageInfo_ReadRequest.Unmarshal(m, b) 60} 61func (m *ReadRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 62 return xxx_messageInfo_ReadRequest.Marshal(b, m, deterministic) 63} 64func (m *ReadRequest) XXX_Merge(src proto.Message) { 65 xxx_messageInfo_ReadRequest.Merge(m, src) 66} 67func (m *ReadRequest) XXX_Size() int { 68 return xxx_messageInfo_ReadRequest.Size(m) 69} 70func (m *ReadRequest) XXX_DiscardUnknown() { 71 xxx_messageInfo_ReadRequest.DiscardUnknown(m) 72} 73 74var xxx_messageInfo_ReadRequest proto.InternalMessageInfo 75 76func (m *ReadRequest) GetResourceName() string { 77 if m != nil { 78 return m.ResourceName 79 } 80 return "" 81} 82 83func (m *ReadRequest) GetReadOffset() int64 { 84 if m != nil { 85 return m.ReadOffset 86 } 87 return 0 88} 89 90func (m *ReadRequest) GetReadLimit() int64 { 91 if m != nil { 92 return m.ReadLimit 93 } 94 return 0 95} 96 97// Response object for ByteStream.Read. 98type ReadResponse struct { 99 // A portion of the data for the resource. The service **may** leave `data` 100 // empty for any given `ReadResponse`. This enables the service to inform the 101 // client that the request is still live while it is running an operation to 102 // generate more data. 103 Data []byte `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"` 104 XXX_NoUnkeyedLiteral struct{} `json:"-"` 105 XXX_unrecognized []byte `json:"-"` 106 XXX_sizecache int32 `json:"-"` 107} 108 109func (m *ReadResponse) Reset() { *m = ReadResponse{} } 110func (m *ReadResponse) String() string { return proto.CompactTextString(m) } 111func (*ReadResponse) ProtoMessage() {} 112func (*ReadResponse) Descriptor() ([]byte, []int) { 113 return fileDescriptor_657cab877f44cd08, []int{1} 114} 115 116func (m *ReadResponse) XXX_Unmarshal(b []byte) error { 117 return xxx_messageInfo_ReadResponse.Unmarshal(m, b) 118} 119func (m *ReadResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 120 return xxx_messageInfo_ReadResponse.Marshal(b, m, deterministic) 121} 122func (m *ReadResponse) XXX_Merge(src proto.Message) { 123 xxx_messageInfo_ReadResponse.Merge(m, src) 124} 125func (m *ReadResponse) XXX_Size() int { 126 return xxx_messageInfo_ReadResponse.Size(m) 127} 128func (m *ReadResponse) XXX_DiscardUnknown() { 129 xxx_messageInfo_ReadResponse.DiscardUnknown(m) 130} 131 132var xxx_messageInfo_ReadResponse proto.InternalMessageInfo 133 134func (m *ReadResponse) GetData() []byte { 135 if m != nil { 136 return m.Data 137 } 138 return nil 139} 140 141// Request object for ByteStream.Write. 142type WriteRequest struct { 143 // The name of the resource to write. This **must** be set on the first 144 // `WriteRequest` of each `Write()` action. If it is set on subsequent calls, 145 // it **must** match the value of the first request. 146 ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` 147 // The offset from the beginning of the resource at which the data should be 148 // written. It is required on all `WriteRequest`s. 149 // 150 // In the first `WriteRequest` of a `Write()` action, it indicates 151 // the initial offset for the `Write()` call. The value **must** be equal to 152 // the `committed_size` that a call to `QueryWriteStatus()` would return. 153 // 154 // On subsequent calls, this value **must** be set and **must** be equal to 155 // the sum of the first `write_offset` and the sizes of all `data` bundles 156 // sent previously on this stream. 157 // 158 // An incorrect value will cause an error. 159 WriteOffset int64 `protobuf:"varint,2,opt,name=write_offset,json=writeOffset,proto3" json:"write_offset,omitempty"` 160 // If `true`, this indicates that the write is complete. Sending any 161 // `WriteRequest`s subsequent to one in which `finish_write` is `true` will 162 // cause an error. 163 FinishWrite bool `protobuf:"varint,3,opt,name=finish_write,json=finishWrite,proto3" json:"finish_write,omitempty"` 164 // A portion of the data for the resource. The client **may** leave `data` 165 // empty for any given `WriteRequest`. This enables the client to inform the 166 // service that the request is still live while it is running an operation to 167 // generate more data. 168 Data []byte `protobuf:"bytes,10,opt,name=data,proto3" json:"data,omitempty"` 169 XXX_NoUnkeyedLiteral struct{} `json:"-"` 170 XXX_unrecognized []byte `json:"-"` 171 XXX_sizecache int32 `json:"-"` 172} 173 174func (m *WriteRequest) Reset() { *m = WriteRequest{} } 175func (m *WriteRequest) String() string { return proto.CompactTextString(m) } 176func (*WriteRequest) ProtoMessage() {} 177func (*WriteRequest) Descriptor() ([]byte, []int) { 178 return fileDescriptor_657cab877f44cd08, []int{2} 179} 180 181func (m *WriteRequest) XXX_Unmarshal(b []byte) error { 182 return xxx_messageInfo_WriteRequest.Unmarshal(m, b) 183} 184func (m *WriteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 185 return xxx_messageInfo_WriteRequest.Marshal(b, m, deterministic) 186} 187func (m *WriteRequest) XXX_Merge(src proto.Message) { 188 xxx_messageInfo_WriteRequest.Merge(m, src) 189} 190func (m *WriteRequest) XXX_Size() int { 191 return xxx_messageInfo_WriteRequest.Size(m) 192} 193func (m *WriteRequest) XXX_DiscardUnknown() { 194 xxx_messageInfo_WriteRequest.DiscardUnknown(m) 195} 196 197var xxx_messageInfo_WriteRequest proto.InternalMessageInfo 198 199func (m *WriteRequest) GetResourceName() string { 200 if m != nil { 201 return m.ResourceName 202 } 203 return "" 204} 205 206func (m *WriteRequest) GetWriteOffset() int64 { 207 if m != nil { 208 return m.WriteOffset 209 } 210 return 0 211} 212 213func (m *WriteRequest) GetFinishWrite() bool { 214 if m != nil { 215 return m.FinishWrite 216 } 217 return false 218} 219 220func (m *WriteRequest) GetData() []byte { 221 if m != nil { 222 return m.Data 223 } 224 return nil 225} 226 227// Response object for ByteStream.Write. 228type WriteResponse struct { 229 // The number of bytes that have been processed for the given resource. 230 CommittedSize int64 `protobuf:"varint,1,opt,name=committed_size,json=committedSize,proto3" json:"committed_size,omitempty"` 231 XXX_NoUnkeyedLiteral struct{} `json:"-"` 232 XXX_unrecognized []byte `json:"-"` 233 XXX_sizecache int32 `json:"-"` 234} 235 236func (m *WriteResponse) Reset() { *m = WriteResponse{} } 237func (m *WriteResponse) String() string { return proto.CompactTextString(m) } 238func (*WriteResponse) ProtoMessage() {} 239func (*WriteResponse) Descriptor() ([]byte, []int) { 240 return fileDescriptor_657cab877f44cd08, []int{3} 241} 242 243func (m *WriteResponse) XXX_Unmarshal(b []byte) error { 244 return xxx_messageInfo_WriteResponse.Unmarshal(m, b) 245} 246func (m *WriteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 247 return xxx_messageInfo_WriteResponse.Marshal(b, m, deterministic) 248} 249func (m *WriteResponse) XXX_Merge(src proto.Message) { 250 xxx_messageInfo_WriteResponse.Merge(m, src) 251} 252func (m *WriteResponse) XXX_Size() int { 253 return xxx_messageInfo_WriteResponse.Size(m) 254} 255func (m *WriteResponse) XXX_DiscardUnknown() { 256 xxx_messageInfo_WriteResponse.DiscardUnknown(m) 257} 258 259var xxx_messageInfo_WriteResponse proto.InternalMessageInfo 260 261func (m *WriteResponse) GetCommittedSize() int64 { 262 if m != nil { 263 return m.CommittedSize 264 } 265 return 0 266} 267 268// Request object for ByteStream.QueryWriteStatus. 269type QueryWriteStatusRequest struct { 270 // The name of the resource whose write status is being requested. 271 ResourceName string `protobuf:"bytes,1,opt,name=resource_name,json=resourceName,proto3" json:"resource_name,omitempty"` 272 XXX_NoUnkeyedLiteral struct{} `json:"-"` 273 XXX_unrecognized []byte `json:"-"` 274 XXX_sizecache int32 `json:"-"` 275} 276 277func (m *QueryWriteStatusRequest) Reset() { *m = QueryWriteStatusRequest{} } 278func (m *QueryWriteStatusRequest) String() string { return proto.CompactTextString(m) } 279func (*QueryWriteStatusRequest) ProtoMessage() {} 280func (*QueryWriteStatusRequest) Descriptor() ([]byte, []int) { 281 return fileDescriptor_657cab877f44cd08, []int{4} 282} 283 284func (m *QueryWriteStatusRequest) XXX_Unmarshal(b []byte) error { 285 return xxx_messageInfo_QueryWriteStatusRequest.Unmarshal(m, b) 286} 287func (m *QueryWriteStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 288 return xxx_messageInfo_QueryWriteStatusRequest.Marshal(b, m, deterministic) 289} 290func (m *QueryWriteStatusRequest) XXX_Merge(src proto.Message) { 291 xxx_messageInfo_QueryWriteStatusRequest.Merge(m, src) 292} 293func (m *QueryWriteStatusRequest) XXX_Size() int { 294 return xxx_messageInfo_QueryWriteStatusRequest.Size(m) 295} 296func (m *QueryWriteStatusRequest) XXX_DiscardUnknown() { 297 xxx_messageInfo_QueryWriteStatusRequest.DiscardUnknown(m) 298} 299 300var xxx_messageInfo_QueryWriteStatusRequest proto.InternalMessageInfo 301 302func (m *QueryWriteStatusRequest) GetResourceName() string { 303 if m != nil { 304 return m.ResourceName 305 } 306 return "" 307} 308 309// Response object for ByteStream.QueryWriteStatus. 310type QueryWriteStatusResponse struct { 311 // The number of bytes that have been processed for the given resource. 312 CommittedSize int64 `protobuf:"varint,1,opt,name=committed_size,json=committedSize,proto3" json:"committed_size,omitempty"` 313 // `complete` is `true` only if the client has sent a `WriteRequest` with 314 // `finish_write` set to true, and the server has processed that request. 315 Complete bool `protobuf:"varint,2,opt,name=complete,proto3" json:"complete,omitempty"` 316 XXX_NoUnkeyedLiteral struct{} `json:"-"` 317 XXX_unrecognized []byte `json:"-"` 318 XXX_sizecache int32 `json:"-"` 319} 320 321func (m *QueryWriteStatusResponse) Reset() { *m = QueryWriteStatusResponse{} } 322func (m *QueryWriteStatusResponse) String() string { return proto.CompactTextString(m) } 323func (*QueryWriteStatusResponse) ProtoMessage() {} 324func (*QueryWriteStatusResponse) Descriptor() ([]byte, []int) { 325 return fileDescriptor_657cab877f44cd08, []int{5} 326} 327 328func (m *QueryWriteStatusResponse) XXX_Unmarshal(b []byte) error { 329 return xxx_messageInfo_QueryWriteStatusResponse.Unmarshal(m, b) 330} 331func (m *QueryWriteStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 332 return xxx_messageInfo_QueryWriteStatusResponse.Marshal(b, m, deterministic) 333} 334func (m *QueryWriteStatusResponse) XXX_Merge(src proto.Message) { 335 xxx_messageInfo_QueryWriteStatusResponse.Merge(m, src) 336} 337func (m *QueryWriteStatusResponse) XXX_Size() int { 338 return xxx_messageInfo_QueryWriteStatusResponse.Size(m) 339} 340func (m *QueryWriteStatusResponse) XXX_DiscardUnknown() { 341 xxx_messageInfo_QueryWriteStatusResponse.DiscardUnknown(m) 342} 343 344var xxx_messageInfo_QueryWriteStatusResponse proto.InternalMessageInfo 345 346func (m *QueryWriteStatusResponse) GetCommittedSize() int64 { 347 if m != nil { 348 return m.CommittedSize 349 } 350 return 0 351} 352 353func (m *QueryWriteStatusResponse) GetComplete() bool { 354 if m != nil { 355 return m.Complete 356 } 357 return false 358} 359 360func init() { 361 proto.RegisterType((*ReadRequest)(nil), "google.bytestream.ReadRequest") 362 proto.RegisterType((*ReadResponse)(nil), "google.bytestream.ReadResponse") 363 proto.RegisterType((*WriteRequest)(nil), "google.bytestream.WriteRequest") 364 proto.RegisterType((*WriteResponse)(nil), "google.bytestream.WriteResponse") 365 proto.RegisterType((*QueryWriteStatusRequest)(nil), "google.bytestream.QueryWriteStatusRequest") 366 proto.RegisterType((*QueryWriteStatusResponse)(nil), "google.bytestream.QueryWriteStatusResponse") 367} 368 369func init() { proto.RegisterFile("google/bytestream/bytestream.proto", fileDescriptor_657cab877f44cd08) } 370 371var fileDescriptor_657cab877f44cd08 = []byte{ 372 // 446 bytes of a gzipped FileDescriptorProto 373 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x5b, 0x8b, 0x13, 0x31, 374 0x14, 0x66, 0xb6, 0xab, 0x74, 0x4f, 0xa7, 0x5e, 0x02, 0xe2, 0x30, 0xe8, 0x6e, 0x77, 0x44, 0x28, 375 0x0a, 0x33, 0xa2, 0xe0, 0xcb, 0x82, 0x0f, 0x7d, 0x13, 0x16, 0x2f, 0xd9, 0x07, 0x41, 0x90, 0x21, 376 0x6d, 0x4f, 0xc7, 0x60, 0x93, 0x8c, 0x49, 0x86, 0xa5, 0xfb, 0x1f, 0x7c, 0xf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0x28, 0x56, 0x73, 0xd3, 0x59, 0xe3, 0x8b, 0xcd, 0x71, 0x7a, 0xd7, 0xeb, 0xde, 400 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, 0x8f, 0x91, 0x09, 0xd4, 0xf8, 0x03, 0x00, 0x00, 401} 402 403// Reference imports to suppress errors if they are not otherwise used. 404var _ context.Context 405var _ grpc.ClientConn 406 407// This is a compile-time assertion to ensure that this generated file 408// is compatible with the grpc package it is being compiled against. 409const _ = grpc.SupportPackageIsVersion4 410 411// ByteStreamClient is the client API for ByteStream service. 412// 413// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 414type ByteStreamClient interface { 415 // `Read()` is used to retrieve the contents of a resource as a sequence 416 // of bytes. The bytes are returned in a sequence of responses, and the 417 // responses are delivered as the results of a server-side streaming RPC. 418 Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (ByteStream_ReadClient, error) 419 // `Write()` is used to send the contents of a resource as a sequence of 420 // bytes. The bytes are sent in a sequence of request protos of a client-side 421 // streaming RPC. 422 // 423 // A `Write()` action is resumable. If there is an error or the connection is 424 // broken during the `Write()`, the client should check the status of the 425 // `Write()` by calling `QueryWriteStatus()` and continue writing from the 426 // returned `committed_size`. This may be less than the amount of data the 427 // client previously sent. 428 // 429 // Calling `Write()` on a resource name that was previously written and 430 // finalized could cause an error, depending on whether the underlying service 431 // allows over-writing of previously written resources. 432 // 433 // When the client closes the request channel, the service will respond with 434 // a `WriteResponse`. The service will not view the resource as `complete` 435 // until the client has sent a `WriteRequest` with `finish_write` set to 436 // `true`. Sending any requests on a stream after sending a request with 437 // `finish_write` set to `true` will cause an error. The client **should** 438 // check the `WriteResponse` it receives to determine how much data the 439 // service was able to commit and whether the service views the resource as 440 // `complete` or not. 441 Write(ctx context.Context, opts ...grpc.CallOption) (ByteStream_WriteClient, error) 442 // `QueryWriteStatus()` is used to find the `committed_size` for a resource 443 // that is being written, which can then be used as the `write_offset` for 444 // the next `Write()` call. 445 // 446 // If the resource does not exist (i.e., the resource has been deleted, or the 447 // first `Write()` has not yet reached the service), this method returns the 448 // error `NOT_FOUND`. 449 // 450 // The client **may** call `QueryWriteStatus()` at any time to determine how 451 // much data has been processed for this resource. This is useful if the 452 // client is buffering data and needs to know which data can be safely 453 // evicted. For any sequence of `QueryWriteStatus()` calls for a given 454 // resource name, the sequence of returned `committed_size` values will be 455 // non-decreasing. 456 QueryWriteStatus(ctx context.Context, in *QueryWriteStatusRequest, opts ...grpc.CallOption) (*QueryWriteStatusResponse, error) 457} 458 459type byteStreamClient struct { 460 cc *grpc.ClientConn 461} 462 463func NewByteStreamClient(cc *grpc.ClientConn) ByteStreamClient { 464 return &byteStreamClient{cc} 465} 466 467func (c *byteStreamClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (ByteStream_ReadClient, error) { 468 stream, err := c.cc.NewStream(ctx, &_ByteStream_serviceDesc.Streams[0], "/google.bytestream.ByteStream/Read", opts...) 469 if err != nil { 470 return nil, err 471 } 472 x := &byteStreamReadClient{stream} 473 if err := x.ClientStream.SendMsg(in); err != nil { 474 return nil, err 475 } 476 if err := x.ClientStream.CloseSend(); err != nil { 477 return nil, err 478 } 479 return x, nil 480} 481 482type ByteStream_ReadClient interface { 483 Recv() (*ReadResponse, error) 484 grpc.ClientStream 485} 486 487type byteStreamReadClient struct { 488 grpc.ClientStream 489} 490 491func (x *byteStreamReadClient) Recv() (*ReadResponse, error) { 492 m := new(ReadResponse) 493 if err := x.ClientStream.RecvMsg(m); err != nil { 494 return nil, err 495 } 496 return m, nil 497} 498 499func (c *byteStreamClient) Write(ctx context.Context, opts ...grpc.CallOption) (ByteStream_WriteClient, error) { 500 stream, err := c.cc.NewStream(ctx, &_ByteStream_serviceDesc.Streams[1], "/google.bytestream.ByteStream/Write", opts...) 501 if err != nil { 502 return nil, err 503 } 504 x := &byteStreamWriteClient{stream} 505 return x, nil 506} 507 508type ByteStream_WriteClient interface { 509 Send(*WriteRequest) error 510 CloseAndRecv() (*WriteResponse, error) 511 grpc.ClientStream 512} 513 514type byteStreamWriteClient struct { 515 grpc.ClientStream 516} 517 518func (x *byteStreamWriteClient) Send(m *WriteRequest) error { 519 return x.ClientStream.SendMsg(m) 520} 521 522func (x *byteStreamWriteClient) CloseAndRecv() (*WriteResponse, error) { 523 if err := x.ClientStream.CloseSend(); err != nil { 524 return nil, err 525 } 526 m := new(WriteResponse) 527 if err := x.ClientStream.RecvMsg(m); err != nil { 528 return nil, err 529 } 530 return m, nil 531} 532 533func (c *byteStreamClient) QueryWriteStatus(ctx context.Context, in *QueryWriteStatusRequest, opts ...grpc.CallOption) (*QueryWriteStatusResponse, error) { 534 out := new(QueryWriteStatusResponse) 535 err := c.cc.Invoke(ctx, "/google.bytestream.ByteStream/QueryWriteStatus", in, out, opts...) 536 if err != nil { 537 return nil, err 538 } 539 return out, nil 540} 541 542// ByteStreamServer is the server API for ByteStream service. 543type ByteStreamServer interface { 544 // `Read()` is used to retrieve the contents of a resource as a sequence 545 // of bytes. The bytes are returned in a sequence of responses, and the 546 // responses are delivered as the results of a server-side streaming RPC. 547 Read(*ReadRequest, ByteStream_ReadServer) error 548 // `Write()` is used to send the contents of a resource as a sequence of 549 // bytes. The bytes are sent in a sequence of request protos of a client-side 550 // streaming RPC. 551 // 552 // A `Write()` action is resumable. If there is an error or the connection is 553 // broken during the `Write()`, the client should check the status of the 554 // `Write()` by calling `QueryWriteStatus()` and continue writing from the 555 // returned `committed_size`. This may be less than the amount of data the 556 // client previously sent. 557 // 558 // Calling `Write()` on a resource name that was previously written and 559 // finalized could cause an error, depending on whether the underlying service 560 // allows over-writing of previously written resources. 561 // 562 // When the client closes the request channel, the service will respond with 563 // a `WriteResponse`. The service will not view the resource as `complete` 564 // until the client has sent a `WriteRequest` with `finish_write` set to 565 // `true`. Sending any requests on a stream after sending a request with 566 // `finish_write` set to `true` will cause an error. The client **should** 567 // check the `WriteResponse` it receives to determine how much data the 568 // service was able to commit and whether the service views the resource as 569 // `complete` or not. 570 Write(ByteStream_WriteServer) error 571 // `QueryWriteStatus()` is used to find the `committed_size` for a resource 572 // that is being written, which can then be used as the `write_offset` for 573 // the next `Write()` call. 574 // 575 // If the resource does not exist (i.e., the resource has been deleted, or the 576 // first `Write()` has not yet reached the service), this method returns the 577 // error `NOT_FOUND`. 578 // 579 // The client **may** call `QueryWriteStatus()` at any time to determine how 580 // much data has been processed for this resource. This is useful if the 581 // client is buffering data and needs to know which data can be safely 582 // evicted. For any sequence of `QueryWriteStatus()` calls for a given 583 // resource name, the sequence of returned `committed_size` values will be 584 // non-decreasing. 585 QueryWriteStatus(context.Context, *QueryWriteStatusRequest) (*QueryWriteStatusResponse, error) 586} 587 588func RegisterByteStreamServer(s *grpc.Server, srv ByteStreamServer) { 589 s.RegisterService(&_ByteStream_serviceDesc, srv) 590} 591 592func _ByteStream_Read_Handler(srv interface{}, stream grpc.ServerStream) error { 593 m := new(ReadRequest) 594 if err := stream.RecvMsg(m); err != nil { 595 return err 596 } 597 return srv.(ByteStreamServer).Read(m, &byteStreamReadServer{stream}) 598} 599 600type ByteStream_ReadServer interface { 601 Send(*ReadResponse) error 602 grpc.ServerStream 603} 604 605type byteStreamReadServer struct { 606 grpc.ServerStream 607} 608 609func (x *byteStreamReadServer) Send(m *ReadResponse) error { 610 return x.ServerStream.SendMsg(m) 611} 612 613func _ByteStream_Write_Handler(srv interface{}, stream grpc.ServerStream) error { 614 return srv.(ByteStreamServer).Write(&byteStreamWriteServer{stream}) 615} 616 617type ByteStream_WriteServer interface { 618 SendAndClose(*WriteResponse) error 619 Recv() (*WriteRequest, error) 620 grpc.ServerStream 621} 622 623type byteStreamWriteServer struct { 624 grpc.ServerStream 625} 626 627func (x *byteStreamWriteServer) SendAndClose(m *WriteResponse) error { 628 return x.ServerStream.SendMsg(m) 629} 630 631func (x *byteStreamWriteServer) Recv() (*WriteRequest, error) { 632 m := new(WriteRequest) 633 if err := x.ServerStream.RecvMsg(m); err != nil { 634 return nil, err 635 } 636 return m, nil 637} 638 639func _ByteStream_QueryWriteStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 640 in := new(QueryWriteStatusRequest) 641 if err := dec(in); err != nil { 642 return nil, err 643 } 644 if interceptor == nil { 645 return srv.(ByteStreamServer).QueryWriteStatus(ctx, in) 646 } 647 info := &grpc.UnaryServerInfo{ 648 Server: srv, 649 FullMethod: "/google.bytestream.ByteStream/QueryWriteStatus", 650 } 651 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 652 return srv.(ByteStreamServer).QueryWriteStatus(ctx, req.(*QueryWriteStatusRequest)) 653 } 654 return interceptor(ctx, in, info, handler) 655} 656 657var _ByteStream_serviceDesc = grpc.ServiceDesc{ 658 ServiceName: "google.bytestream.ByteStream", 659 HandlerType: (*ByteStreamServer)(nil), 660 Methods: []grpc.MethodDesc{ 661 { 662 MethodName: "QueryWriteStatus", 663 Handler: _ByteStream_QueryWriteStatus_Handler, 664 }, 665 }, 666 Streams: []grpc.StreamDesc{ 667 { 668 StreamName: "Read", 669 Handler: _ByteStream_Read_Handler, 670 ServerStreams: true, 671 }, 672 { 673 StreamName: "Write", 674 Handler: _ByteStream_Write_Handler, 675 ClientStreams: true, 676 }, 677 }, 678 Metadata: "google/bytestream/bytestream.proto", 679} 680