OLD | NEW |
(Empty) | |
| 1 # Generated by the protocol buffer compiler. DO NOT EDIT! |
| 2 # source: bytestream.proto |
| 3 |
| 4 import sys |
| 5 _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) |
| 6 from google.protobuf import descriptor as _descriptor |
| 7 from google.protobuf import message as _message |
| 8 from google.protobuf import reflection as _reflection |
| 9 from google.protobuf import symbol_database as _symbol_database |
| 10 from google.protobuf import descriptor_pb2 |
| 11 # @@protoc_insertion_point(imports) |
| 12 |
| 13 _sym_db = _symbol_database.Default() |
| 14 |
| 15 |
| 16 |
| 17 |
| 18 DESCRIPTOR = _descriptor.FileDescriptor( |
| 19 name='bytestream.proto', |
| 20 package='google.bytestream', |
| 21 syntax='proto3', |
| 22 serialized_pb=_b('\n\x10\x62ytestream.proto\x12\x11google.bytestream\"M\n\x0bR
eadRequest\x12\x15\n\rresource_name\x18\x01 \x01(\t\x12\x13\n\x0bread_offset\x18
\x02 \x01(\x03\x12\x12\n\nread_limit\x18\x03 \x01(\x03\"\x1c\n\x0cReadResponse\x
12\x0c\n\x04\x64\x61ta\x18\n \x01(\x0c\"_\n\x0cWriteRequest\x12\x15\n\rresource_
name\x18\x01 \x01(\t\x12\x14\n\x0cwrite_offset\x18\x02 \x01(\x03\x12\x14\n\x0c\x
66inish_write\x18\x03 \x01(\x08\x12\x0c\n\x04\x64\x61ta\x18\n \x01(\x0c\"\'\n\rW
riteResponse\x12\x16\n\x0e\x63ommitted_size\x18\x01 \x01(\x03\"0\n\x17QueryWrite
StatusRequest\x12\x15\n\rresource_name\x18\x01 \x01(\t\"D\n\x18QueryWriteStatusR
esponse\x12\x16\n\x0e\x63ommitted_size\x18\x01 \x01(\x03\x12\x10\n\x08\x63omplet
e\x18\x02 \x01(\x08\x32\x92\x02\n\nByteStream\x12I\n\x04Read\x12\x1e.google.byte
stream.ReadRequest\x1a\x1f.google.bytestream.ReadResponse0\x01\x12L\n\x05Write\x
12\x1f.google.bytestream.WriteRequest\x1a .google.bytestream.WriteResponse(\x01\
x12k\n\x10QueryWriteStatus\x12*.google.bytestream.QueryWriteStatusRequest\x1a+.g
oogle.bytestream.QueryWriteStatusResponseb\x06proto3') |
| 23 ) |
| 24 _sym_db.RegisterFileDescriptor(DESCRIPTOR) |
| 25 |
| 26 |
| 27 |
| 28 |
| 29 _READREQUEST = _descriptor.Descriptor( |
| 30 name='ReadRequest', |
| 31 full_name='google.bytestream.ReadRequest', |
| 32 filename=None, |
| 33 file=DESCRIPTOR, |
| 34 containing_type=None, |
| 35 fields=[ |
| 36 _descriptor.FieldDescriptor( |
| 37 name='resource_name', full_name='google.bytestream.ReadRequest.resource_na
me', index=0, |
| 38 number=1, type=9, cpp_type=9, label=1, |
| 39 has_default_value=False, default_value=_b("").decode('utf-8'), |
| 40 message_type=None, enum_type=None, containing_type=None, |
| 41 is_extension=False, extension_scope=None, |
| 42 options=None), |
| 43 _descriptor.FieldDescriptor( |
| 44 name='read_offset', full_name='google.bytestream.ReadRequest.read_offset',
index=1, |
| 45 number=2, type=3, cpp_type=2, label=1, |
| 46 has_default_value=False, default_value=0, |
| 47 message_type=None, enum_type=None, containing_type=None, |
| 48 is_extension=False, extension_scope=None, |
| 49 options=None), |
| 50 _descriptor.FieldDescriptor( |
| 51 name='read_limit', full_name='google.bytestream.ReadRequest.read_limit', i
ndex=2, |
| 52 number=3, type=3, cpp_type=2, label=1, |
| 53 has_default_value=False, default_value=0, |
| 54 message_type=None, enum_type=None, containing_type=None, |
| 55 is_extension=False, extension_scope=None, |
| 56 options=None), |
| 57 ], |
| 58 extensions=[ |
| 59 ], |
| 60 nested_types=[], |
| 61 enum_types=[ |
| 62 ], |
| 63 options=None, |
| 64 is_extendable=False, |
| 65 syntax='proto3', |
| 66 extension_ranges=[], |
| 67 oneofs=[ |
| 68 ], |
| 69 serialized_start=39, |
| 70 serialized_end=116, |
| 71 ) |
| 72 |
| 73 |
| 74 _READRESPONSE = _descriptor.Descriptor( |
| 75 name='ReadResponse', |
| 76 full_name='google.bytestream.ReadResponse', |
| 77 filename=None, |
| 78 file=DESCRIPTOR, |
| 79 containing_type=None, |
| 80 fields=[ |
| 81 _descriptor.FieldDescriptor( |
| 82 name='data', full_name='google.bytestream.ReadResponse.data', index=0, |
| 83 number=10, type=12, cpp_type=9, label=1, |
| 84 has_default_value=False, default_value=_b(""), |
| 85 message_type=None, enum_type=None, containing_type=None, |
| 86 is_extension=False, extension_scope=None, |
| 87 options=None), |
| 88 ], |
| 89 extensions=[ |
| 90 ], |
| 91 nested_types=[], |
| 92 enum_types=[ |
| 93 ], |
| 94 options=None, |
| 95 is_extendable=False, |
| 96 syntax='proto3', |
| 97 extension_ranges=[], |
| 98 oneofs=[ |
| 99 ], |
| 100 serialized_start=118, |
| 101 serialized_end=146, |
| 102 ) |
| 103 |
| 104 |
| 105 _WRITEREQUEST = _descriptor.Descriptor( |
| 106 name='WriteRequest', |
| 107 full_name='google.bytestream.WriteRequest', |
| 108 filename=None, |
| 109 file=DESCRIPTOR, |
| 110 containing_type=None, |
| 111 fields=[ |
| 112 _descriptor.FieldDescriptor( |
| 113 name='resource_name', full_name='google.bytestream.WriteRequest.resource_n
ame', index=0, |
| 114 number=1, type=9, cpp_type=9, label=1, |
| 115 has_default_value=False, default_value=_b("").decode('utf-8'), |
| 116 message_type=None, enum_type=None, containing_type=None, |
| 117 is_extension=False, extension_scope=None, |
| 118 options=None), |
| 119 _descriptor.FieldDescriptor( |
| 120 name='write_offset', full_name='google.bytestream.WriteRequest.write_offse
t', index=1, |
| 121 number=2, type=3, cpp_type=2, label=1, |
| 122 has_default_value=False, default_value=0, |
| 123 message_type=None, enum_type=None, containing_type=None, |
| 124 is_extension=False, extension_scope=None, |
| 125 options=None), |
| 126 _descriptor.FieldDescriptor( |
| 127 name='finish_write', full_name='google.bytestream.WriteRequest.finish_writ
e', index=2, |
| 128 number=3, type=8, cpp_type=7, label=1, |
| 129 has_default_value=False, default_value=False, |
| 130 message_type=None, enum_type=None, containing_type=None, |
| 131 is_extension=False, extension_scope=None, |
| 132 options=None), |
| 133 _descriptor.FieldDescriptor( |
| 134 name='data', full_name='google.bytestream.WriteRequest.data', index=3, |
| 135 number=10, type=12, cpp_type=9, label=1, |
| 136 has_default_value=False, default_value=_b(""), |
| 137 message_type=None, enum_type=None, containing_type=None, |
| 138 is_extension=False, extension_scope=None, |
| 139 options=None), |
| 140 ], |
| 141 extensions=[ |
| 142 ], |
| 143 nested_types=[], |
| 144 enum_types=[ |
| 145 ], |
| 146 options=None, |
| 147 is_extendable=False, |
| 148 syntax='proto3', |
| 149 extension_ranges=[], |
| 150 oneofs=[ |
| 151 ], |
| 152 serialized_start=148, |
| 153 serialized_end=243, |
| 154 ) |
| 155 |
| 156 |
| 157 _WRITERESPONSE = _descriptor.Descriptor( |
| 158 name='WriteResponse', |
| 159 full_name='google.bytestream.WriteResponse', |
| 160 filename=None, |
| 161 file=DESCRIPTOR, |
| 162 containing_type=None, |
| 163 fields=[ |
| 164 _descriptor.FieldDescriptor( |
| 165 name='committed_size', full_name='google.bytestream.WriteResponse.committe
d_size', index=0, |
| 166 number=1, type=3, cpp_type=2, label=1, |
| 167 has_default_value=False, default_value=0, |
| 168 message_type=None, enum_type=None, containing_type=None, |
| 169 is_extension=False, extension_scope=None, |
| 170 options=None), |
| 171 ], |
| 172 extensions=[ |
| 173 ], |
| 174 nested_types=[], |
| 175 enum_types=[ |
| 176 ], |
| 177 options=None, |
| 178 is_extendable=False, |
| 179 syntax='proto3', |
| 180 extension_ranges=[], |
| 181 oneofs=[ |
| 182 ], |
| 183 serialized_start=245, |
| 184 serialized_end=284, |
| 185 ) |
| 186 |
| 187 |
| 188 _QUERYWRITESTATUSREQUEST = _descriptor.Descriptor( |
| 189 name='QueryWriteStatusRequest', |
| 190 full_name='google.bytestream.QueryWriteStatusRequest', |
| 191 filename=None, |
| 192 file=DESCRIPTOR, |
| 193 containing_type=None, |
| 194 fields=[ |
| 195 _descriptor.FieldDescriptor( |
| 196 name='resource_name', full_name='google.bytestream.QueryWriteStatusRequest
.resource_name', index=0, |
| 197 number=1, type=9, cpp_type=9, label=1, |
| 198 has_default_value=False, default_value=_b("").decode('utf-8'), |
| 199 message_type=None, enum_type=None, containing_type=None, |
| 200 is_extension=False, extension_scope=None, |
| 201 options=None), |
| 202 ], |
| 203 extensions=[ |
| 204 ], |
| 205 nested_types=[], |
| 206 enum_types=[ |
| 207 ], |
| 208 options=None, |
| 209 is_extendable=False, |
| 210 syntax='proto3', |
| 211 extension_ranges=[], |
| 212 oneofs=[ |
| 213 ], |
| 214 serialized_start=286, |
| 215 serialized_end=334, |
| 216 ) |
| 217 |
| 218 |
| 219 _QUERYWRITESTATUSRESPONSE = _descriptor.Descriptor( |
| 220 name='QueryWriteStatusResponse', |
| 221 full_name='google.bytestream.QueryWriteStatusResponse', |
| 222 filename=None, |
| 223 file=DESCRIPTOR, |
| 224 containing_type=None, |
| 225 fields=[ |
| 226 _descriptor.FieldDescriptor( |
| 227 name='committed_size', full_name='google.bytestream.QueryWriteStatusRespon
se.committed_size', index=0, |
| 228 number=1, type=3, cpp_type=2, label=1, |
| 229 has_default_value=False, default_value=0, |
| 230 message_type=None, enum_type=None, containing_type=None, |
| 231 is_extension=False, extension_scope=None, |
| 232 options=None), |
| 233 _descriptor.FieldDescriptor( |
| 234 name='complete', full_name='google.bytestream.QueryWriteStatusResponse.com
plete', index=1, |
| 235 number=2, type=8, cpp_type=7, label=1, |
| 236 has_default_value=False, default_value=False, |
| 237 message_type=None, enum_type=None, containing_type=None, |
| 238 is_extension=False, extension_scope=None, |
| 239 options=None), |
| 240 ], |
| 241 extensions=[ |
| 242 ], |
| 243 nested_types=[], |
| 244 enum_types=[ |
| 245 ], |
| 246 options=None, |
| 247 is_extendable=False, |
| 248 syntax='proto3', |
| 249 extension_ranges=[], |
| 250 oneofs=[ |
| 251 ], |
| 252 serialized_start=336, |
| 253 serialized_end=404, |
| 254 ) |
| 255 |
| 256 DESCRIPTOR.message_types_by_name['ReadRequest'] = _READREQUEST |
| 257 DESCRIPTOR.message_types_by_name['ReadResponse'] = _READRESPONSE |
| 258 DESCRIPTOR.message_types_by_name['WriteRequest'] = _WRITEREQUEST |
| 259 DESCRIPTOR.message_types_by_name['WriteResponse'] = _WRITERESPONSE |
| 260 DESCRIPTOR.message_types_by_name['QueryWriteStatusRequest'] = _QUERYWRITESTATUSR
EQUEST |
| 261 DESCRIPTOR.message_types_by_name['QueryWriteStatusResponse'] = _QUERYWRITESTATUS
RESPONSE |
| 262 |
| 263 ReadRequest = _reflection.GeneratedProtocolMessageType('ReadRequest', (_message.
Message,), dict( |
| 264 DESCRIPTOR = _READREQUEST, |
| 265 __module__ = 'bytestream_pb2' |
| 266 # @@protoc_insertion_point(class_scope:google.bytestream.ReadRequest) |
| 267 )) |
| 268 _sym_db.RegisterMessage(ReadRequest) |
| 269 |
| 270 ReadResponse = _reflection.GeneratedProtocolMessageType('ReadResponse', (_messag
e.Message,), dict( |
| 271 DESCRIPTOR = _READRESPONSE, |
| 272 __module__ = 'bytestream_pb2' |
| 273 # @@protoc_insertion_point(class_scope:google.bytestream.ReadResponse) |
| 274 )) |
| 275 _sym_db.RegisterMessage(ReadResponse) |
| 276 |
| 277 WriteRequest = _reflection.GeneratedProtocolMessageType('WriteRequest', (_messag
e.Message,), dict( |
| 278 DESCRIPTOR = _WRITEREQUEST, |
| 279 __module__ = 'bytestream_pb2' |
| 280 # @@protoc_insertion_point(class_scope:google.bytestream.WriteRequest) |
| 281 )) |
| 282 _sym_db.RegisterMessage(WriteRequest) |
| 283 |
| 284 WriteResponse = _reflection.GeneratedProtocolMessageType('WriteResponse', (_mess
age.Message,), dict( |
| 285 DESCRIPTOR = _WRITERESPONSE, |
| 286 __module__ = 'bytestream_pb2' |
| 287 # @@protoc_insertion_point(class_scope:google.bytestream.WriteResponse) |
| 288 )) |
| 289 _sym_db.RegisterMessage(WriteResponse) |
| 290 |
| 291 QueryWriteStatusRequest = _reflection.GeneratedProtocolMessageType('QueryWriteSt
atusRequest', (_message.Message,), dict( |
| 292 DESCRIPTOR = _QUERYWRITESTATUSREQUEST, |
| 293 __module__ = 'bytestream_pb2' |
| 294 # @@protoc_insertion_point(class_scope:google.bytestream.QueryWriteStatusReque
st) |
| 295 )) |
| 296 _sym_db.RegisterMessage(QueryWriteStatusRequest) |
| 297 |
| 298 QueryWriteStatusResponse = _reflection.GeneratedProtocolMessageType('QueryWriteS
tatusResponse', (_message.Message,), dict( |
| 299 DESCRIPTOR = _QUERYWRITESTATUSRESPONSE, |
| 300 __module__ = 'bytestream_pb2' |
| 301 # @@protoc_insertion_point(class_scope:google.bytestream.QueryWriteStatusRespo
nse) |
| 302 )) |
| 303 _sym_db.RegisterMessage(QueryWriteStatusResponse) |
| 304 |
| 305 |
| 306 try: |
| 307 # THESE ELEMENTS WILL BE DEPRECATED. |
| 308 # Please use the generated *_pb2_grpc.py files instead. |
| 309 import grpc |
| 310 from grpc.framework.common import cardinality |
| 311 from grpc.framework.interfaces.face import utilities as face_utilities |
| 312 from grpc.beta import implementations as beta_implementations |
| 313 from grpc.beta import interfaces as beta_interfaces |
| 314 |
| 315 |
| 316 class ByteStreamStub(object): |
| 317 """#### Introduction |
| 318 |
| 319 The Byte Stream API enables a client to read and write a stream of bytes to |
| 320 and from a resource. Resources have names, and these names are supplied in |
| 321 the API calls below to identify the resource that is being read from or |
| 322 written to. |
| 323 |
| 324 All implementations of the Byte Stream API export the interface defined here
: |
| 325 |
| 326 * `Read()`: Reads the contents of a resource. |
| 327 |
| 328 * `Write()`: Writes the contents of a resource. The client can call `Write()
` |
| 329 multiple times with the same resource and can check the status of the write |
| 330 by calling `QueryWriteStatus()`. |
| 331 |
| 332 #### Service parameters and metadata |
| 333 |
| 334 The ByteStream API provides no direct way to access/modify any metadata |
| 335 associated with the resource. |
| 336 |
| 337 #### Errors |
| 338 |
| 339 The errors returned by the service are in the Google canonical error space. |
| 340 """ |
| 341 |
| 342 def __init__(self, channel): |
| 343 """Constructor. |
| 344 |
| 345 Args: |
| 346 channel: A grpc.Channel. |
| 347 """ |
| 348 self.Read = channel.unary_stream( |
| 349 '/google.bytestream.ByteStream/Read', |
| 350 request_serializer=ReadRequest.SerializeToString, |
| 351 response_deserializer=ReadResponse.FromString, |
| 352 ) |
| 353 self.Write = channel.stream_unary( |
| 354 '/google.bytestream.ByteStream/Write', |
| 355 request_serializer=WriteRequest.SerializeToString, |
| 356 response_deserializer=WriteResponse.FromString, |
| 357 ) |
| 358 self.QueryWriteStatus = channel.unary_unary( |
| 359 '/google.bytestream.ByteStream/QueryWriteStatus', |
| 360 request_serializer=QueryWriteStatusRequest.SerializeToString, |
| 361 response_deserializer=QueryWriteStatusResponse.FromString, |
| 362 ) |
| 363 |
| 364 |
| 365 class ByteStreamServicer(object): |
| 366 """#### Introduction |
| 367 |
| 368 The Byte Stream API enables a client to read and write a stream of bytes to |
| 369 and from a resource. Resources have names, and these names are supplied in |
| 370 the API calls below to identify the resource that is being read from or |
| 371 written to. |
| 372 |
| 373 All implementations of the Byte Stream API export the interface defined here
: |
| 374 |
| 375 * `Read()`: Reads the contents of a resource. |
| 376 |
| 377 * `Write()`: Writes the contents of a resource. The client can call `Write()
` |
| 378 multiple times with the same resource and can check the status of the write |
| 379 by calling `QueryWriteStatus()`. |
| 380 |
| 381 #### Service parameters and metadata |
| 382 |
| 383 The ByteStream API provides no direct way to access/modify any metadata |
| 384 associated with the resource. |
| 385 |
| 386 #### Errors |
| 387 |
| 388 The errors returned by the service are in the Google canonical error space. |
| 389 """ |
| 390 |
| 391 def Read(self, request, context): |
| 392 """`Read()` is used to retrieve the contents of a resource as a sequence |
| 393 of bytes. The bytes are returned in a sequence of responses, and the |
| 394 responses are delivered as the results of a server-side streaming RPC. |
| 395 """ |
| 396 context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 397 context.set_details('Method not implemented!') |
| 398 raise NotImplementedError('Method not implemented!') |
| 399 |
| 400 def Write(self, request_iterator, context): |
| 401 """`Write()` is used to send the contents of a resource as a sequence of |
| 402 bytes. The bytes are sent in a sequence of request protos of a client-side |
| 403 streaming RPC. |
| 404 |
| 405 A `Write()` action is resumable. If there is an error or the connection is |
| 406 broken during the `Write()`, the client should check the status of the |
| 407 `Write()` by calling `QueryWriteStatus()` and continue writing from the |
| 408 returned `committed_size`. This may be less than the amount of data the |
| 409 client previously sent. |
| 410 |
| 411 Calling `Write()` on a resource name that was previously written and |
| 412 finalized could cause an error, depending on whether the underlying servic
e |
| 413 allows over-writing of previously written resources. |
| 414 |
| 415 When the client closes the request channel, the service will respond with |
| 416 a `WriteResponse`. The service will not view the resource as `complete` |
| 417 until the client has sent a `WriteRequest` with `finish_write` set to |
| 418 `true`. Sending any requests on a stream after sending a request with |
| 419 `finish_write` set to `true` will cause an error. The client **should** |
| 420 check the `WriteResponse` it receives to determine how much data the |
| 421 service was able to commit and whether the service views the resource as |
| 422 `complete` or not. |
| 423 """ |
| 424 context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 425 context.set_details('Method not implemented!') |
| 426 raise NotImplementedError('Method not implemented!') |
| 427 |
| 428 def QueryWriteStatus(self, request, context): |
| 429 """`QueryWriteStatus()` is used to find the `committed_size` for a resourc
e |
| 430 that is being written, which can then be used as the `write_offset` for |
| 431 the next `Write()` call. |
| 432 |
| 433 If the resource does not exist (i.e., the resource has been deleted, or th
e |
| 434 first `Write()` has not yet reached the service), this method returns the |
| 435 error `NOT_FOUND`. |
| 436 |
| 437 The client **may** call `QueryWriteStatus()` at any time to determine how |
| 438 much data has been processed for this resource. This is useful if the |
| 439 client is buffering data and needs to know which data can be safely |
| 440 evicted. For any sequence of `QueryWriteStatus()` calls for a given |
| 441 resource name, the sequence of returned `committed_size` values will be |
| 442 non-decreasing. |
| 443 """ |
| 444 context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 445 context.set_details('Method not implemented!') |
| 446 raise NotImplementedError('Method not implemented!') |
| 447 |
| 448 |
| 449 def add_ByteStreamServicer_to_server(servicer, server): |
| 450 rpc_method_handlers = { |
| 451 'Read': grpc.unary_stream_rpc_method_handler( |
| 452 servicer.Read, |
| 453 request_deserializer=ReadRequest.FromString, |
| 454 response_serializer=ReadResponse.SerializeToString, |
| 455 ), |
| 456 'Write': grpc.stream_unary_rpc_method_handler( |
| 457 servicer.Write, |
| 458 request_deserializer=WriteRequest.FromString, |
| 459 response_serializer=WriteResponse.SerializeToString, |
| 460 ), |
| 461 'QueryWriteStatus': grpc.unary_unary_rpc_method_handler( |
| 462 servicer.QueryWriteStatus, |
| 463 request_deserializer=QueryWriteStatusRequest.FromString, |
| 464 response_serializer=QueryWriteStatusResponse.SerializeToString, |
| 465 ), |
| 466 } |
| 467 generic_handler = grpc.method_handlers_generic_handler( |
| 468 'google.bytestream.ByteStream', rpc_method_handlers) |
| 469 server.add_generic_rpc_handlers((generic_handler,)) |
| 470 |
| 471 |
| 472 class BetaByteStreamServicer(object): |
| 473 """The Beta API is deprecated for 0.15.0 and later. |
| 474 |
| 475 It is recommended to use the GA API (classes and functions in this |
| 476 file not marked beta) for all further purposes. This class was generated |
| 477 only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" |
| 478 """#### Introduction |
| 479 |
| 480 The Byte Stream API enables a client to read and write a stream of bytes to |
| 481 and from a resource. Resources have names, and these names are supplied in |
| 482 the API calls below to identify the resource that is being read from or |
| 483 written to. |
| 484 |
| 485 All implementations of the Byte Stream API export the interface defined here
: |
| 486 |
| 487 * `Read()`: Reads the contents of a resource. |
| 488 |
| 489 * `Write()`: Writes the contents of a resource. The client can call `Write()
` |
| 490 multiple times with the same resource and can check the status of the write |
| 491 by calling `QueryWriteStatus()`. |
| 492 |
| 493 #### Service parameters and metadata |
| 494 |
| 495 The ByteStream API provides no direct way to access/modify any metadata |
| 496 associated with the resource. |
| 497 |
| 498 #### Errors |
| 499 |
| 500 The errors returned by the service are in the Google canonical error space. |
| 501 """ |
| 502 def Read(self, request, context): |
| 503 """`Read()` is used to retrieve the contents of a resource as a sequence |
| 504 of bytes. The bytes are returned in a sequence of responses, and the |
| 505 responses are delivered as the results of a server-side streaming RPC. |
| 506 """ |
| 507 context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) |
| 508 def Write(self, request_iterator, context): |
| 509 """`Write()` is used to send the contents of a resource as a sequence of |
| 510 bytes. The bytes are sent in a sequence of request protos of a client-side |
| 511 streaming RPC. |
| 512 |
| 513 A `Write()` action is resumable. If there is an error or the connection is |
| 514 broken during the `Write()`, the client should check the status of the |
| 515 `Write()` by calling `QueryWriteStatus()` and continue writing from the |
| 516 returned `committed_size`. This may be less than the amount of data the |
| 517 client previously sent. |
| 518 |
| 519 Calling `Write()` on a resource name that was previously written and |
| 520 finalized could cause an error, depending on whether the underlying servic
e |
| 521 allows over-writing of previously written resources. |
| 522 |
| 523 When the client closes the request channel, the service will respond with |
| 524 a `WriteResponse`. The service will not view the resource as `complete` |
| 525 until the client has sent a `WriteRequest` with `finish_write` set to |
| 526 `true`. Sending any requests on a stream after sending a request with |
| 527 `finish_write` set to `true` will cause an error. The client **should** |
| 528 check the `WriteResponse` it receives to determine how much data the |
| 529 service was able to commit and whether the service views the resource as |
| 530 `complete` or not. |
| 531 """ |
| 532 context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) |
| 533 def QueryWriteStatus(self, request, context): |
| 534 """`QueryWriteStatus()` is used to find the `committed_size` for a resourc
e |
| 535 that is being written, which can then be used as the `write_offset` for |
| 536 the next `Write()` call. |
| 537 |
| 538 If the resource does not exist (i.e., the resource has been deleted, or th
e |
| 539 first `Write()` has not yet reached the service), this method returns the |
| 540 error `NOT_FOUND`. |
| 541 |
| 542 The client **may** call `QueryWriteStatus()` at any time to determine how |
| 543 much data has been processed for this resource. This is useful if the |
| 544 client is buffering data and needs to know which data can be safely |
| 545 evicted. For any sequence of `QueryWriteStatus()` calls for a given |
| 546 resource name, the sequence of returned `committed_size` values will be |
| 547 non-decreasing. |
| 548 """ |
| 549 context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) |
| 550 |
| 551 |
| 552 class BetaByteStreamStub(object): |
| 553 """The Beta API is deprecated for 0.15.0 and later. |
| 554 |
| 555 It is recommended to use the GA API (classes and functions in this |
| 556 file not marked beta) for all further purposes. This class was generated |
| 557 only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" |
| 558 """#### Introduction |
| 559 |
| 560 The Byte Stream API enables a client to read and write a stream of bytes to |
| 561 and from a resource. Resources have names, and these names are supplied in |
| 562 the API calls below to identify the resource that is being read from or |
| 563 written to. |
| 564 |
| 565 All implementations of the Byte Stream API export the interface defined here
: |
| 566 |
| 567 * `Read()`: Reads the contents of a resource. |
| 568 |
| 569 * `Write()`: Writes the contents of a resource. The client can call `Write()
` |
| 570 multiple times with the same resource and can check the status of the write |
| 571 by calling `QueryWriteStatus()`. |
| 572 |
| 573 #### Service parameters and metadata |
| 574 |
| 575 The ByteStream API provides no direct way to access/modify any metadata |
| 576 associated with the resource. |
| 577 |
| 578 #### Errors |
| 579 |
| 580 The errors returned by the service are in the Google canonical error space. |
| 581 """ |
| 582 def Read(self, request, timeout, metadata=None, with_call=False, protocol_op
tions=None): |
| 583 """`Read()` is used to retrieve the contents of a resource as a sequence |
| 584 of bytes. The bytes are returned in a sequence of responses, and the |
| 585 responses are delivered as the results of a server-side streaming RPC. |
| 586 """ |
| 587 raise NotImplementedError() |
| 588 def Write(self, request_iterator, timeout, metadata=None, with_call=False, p
rotocol_options=None): |
| 589 """`Write()` is used to send the contents of a resource as a sequence of |
| 590 bytes. The bytes are sent in a sequence of request protos of a client-side |
| 591 streaming RPC. |
| 592 |
| 593 A `Write()` action is resumable. If there is an error or the connection is |
| 594 broken during the `Write()`, the client should check the status of the |
| 595 `Write()` by calling `QueryWriteStatus()` and continue writing from the |
| 596 returned `committed_size`. This may be less than the amount of data the |
| 597 client previously sent. |
| 598 |
| 599 Calling `Write()` on a resource name that was previously written and |
| 600 finalized could cause an error, depending on whether the underlying servic
e |
| 601 allows over-writing of previously written resources. |
| 602 |
| 603 When the client closes the request channel, the service will respond with |
| 604 a `WriteResponse`. The service will not view the resource as `complete` |
| 605 until the client has sent a `WriteRequest` with `finish_write` set to |
| 606 `true`. Sending any requests on a stream after sending a request with |
| 607 `finish_write` set to `true` will cause an error. The client **should** |
| 608 check the `WriteResponse` it receives to determine how much data the |
| 609 service was able to commit and whether the service views the resource as |
| 610 `complete` or not. |
| 611 """ |
| 612 raise NotImplementedError() |
| 613 Write.future = None |
| 614 def QueryWriteStatus(self, request, timeout, metadata=None, with_call=False,
protocol_options=None): |
| 615 """`QueryWriteStatus()` is used to find the `committed_size` for a resourc
e |
| 616 that is being written, which can then be used as the `write_offset` for |
| 617 the next `Write()` call. |
| 618 |
| 619 If the resource does not exist (i.e., the resource has been deleted, or th
e |
| 620 first `Write()` has not yet reached the service), this method returns the |
| 621 error `NOT_FOUND`. |
| 622 |
| 623 The client **may** call `QueryWriteStatus()` at any time to determine how |
| 624 much data has been processed for this resource. This is useful if the |
| 625 client is buffering data and needs to know which data can be safely |
| 626 evicted. For any sequence of `QueryWriteStatus()` calls for a given |
| 627 resource name, the sequence of returned `committed_size` values will be |
| 628 non-decreasing. |
| 629 """ |
| 630 raise NotImplementedError() |
| 631 QueryWriteStatus.future = None |
| 632 |
| 633 |
| 634 def beta_create_ByteStream_server(servicer, pool=None, pool_size=None, default
_timeout=None, maximum_timeout=None): |
| 635 """The Beta API is deprecated for 0.15.0 and later. |
| 636 |
| 637 It is recommended to use the GA API (classes and functions in this |
| 638 file not marked beta) for all further purposes. This function was |
| 639 generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" |
| 640 request_deserializers = { |
| 641 ('google.bytestream.ByteStream', 'QueryWriteStatus'): QueryWriteStatusRequ
est.FromString, |
| 642 ('google.bytestream.ByteStream', 'Read'): ReadRequest.FromString, |
| 643 ('google.bytestream.ByteStream', 'Write'): WriteRequest.FromString, |
| 644 } |
| 645 response_serializers = { |
| 646 ('google.bytestream.ByteStream', 'QueryWriteStatus'): QueryWriteStatusResp
onse.SerializeToString, |
| 647 ('google.bytestream.ByteStream', 'Read'): ReadResponse.SerializeToString, |
| 648 ('google.bytestream.ByteStream', 'Write'): WriteResponse.SerializeToString
, |
| 649 } |
| 650 method_implementations = { |
| 651 ('google.bytestream.ByteStream', 'QueryWriteStatus'): face_utilities.unary
_unary_inline(servicer.QueryWriteStatus), |
| 652 ('google.bytestream.ByteStream', 'Read'): face_utilities.unary_stream_inli
ne(servicer.Read), |
| 653 ('google.bytestream.ByteStream', 'Write'): face_utilities.stream_unary_inl
ine(servicer.Write), |
| 654 } |
| 655 server_options = beta_implementations.server_options(request_deserializers=r
equest_deserializers, response_serializers=response_serializers, thread_pool=poo
l, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=
maximum_timeout) |
| 656 return beta_implementations.server(method_implementations, options=server_op
tions) |
| 657 |
| 658 |
| 659 def beta_create_ByteStream_stub(channel, host=None, metadata_transformer=None,
pool=None, pool_size=None): |
| 660 """The Beta API is deprecated for 0.15.0 and later. |
| 661 |
| 662 It is recommended to use the GA API (classes and functions in this |
| 663 file not marked beta) for all further purposes. This function was |
| 664 generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" |
| 665 request_serializers = { |
| 666 ('google.bytestream.ByteStream', 'QueryWriteStatus'): QueryWriteStatusRequ
est.SerializeToString, |
| 667 ('google.bytestream.ByteStream', 'Read'): ReadRequest.SerializeToString, |
| 668 ('google.bytestream.ByteStream', 'Write'): WriteRequest.SerializeToString, |
| 669 } |
| 670 response_deserializers = { |
| 671 ('google.bytestream.ByteStream', 'QueryWriteStatus'): QueryWriteStatusResp
onse.FromString, |
| 672 ('google.bytestream.ByteStream', 'Read'): ReadResponse.FromString, |
| 673 ('google.bytestream.ByteStream', 'Write'): WriteResponse.FromString, |
| 674 } |
| 675 cardinalities = { |
| 676 'QueryWriteStatus': cardinality.Cardinality.UNARY_UNARY, |
| 677 'Read': cardinality.Cardinality.UNARY_STREAM, |
| 678 'Write': cardinality.Cardinality.STREAM_UNARY, |
| 679 } |
| 680 stub_options = beta_implementations.stub_options(host=host, metadata_transfo
rmer=metadata_transformer, request_serializers=request_serializers, response_des
erializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) |
| 681 return beta_implementations.dynamic_stub(channel, 'google.bytestream.ByteStr
eam', cardinalities, options=stub_options) |
| 682 except ImportError: |
| 683 pass |
| 684 # @@protoc_insertion_point(module_scope) |
OLD | NEW |