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