示例#1
0
 def _write_blob_request_iterator(self, blob_sequence_id, seq_index, blob):
     # For now all use cases have the blob in memory already.
     # In the future we may want to stream from disk; that will require
     # refactoring here.
     # TODO(soergel): compute crc32c's to allow server-side data validation.
     for offset in range(0, len(blob), BLOB_CHUNK_SIZE):
         chunk = blob[offset:offset + BLOB_CHUNK_SIZE]
         finalize_object = offset + BLOB_CHUNK_SIZE >= len(blob)
         request = write_service_pb2.WriteBlobRequest(
             blob_sequence_id=blob_sequence_id,
             index=seq_index,
             data=chunk,
             offset=offset,
             crc32c=None,
             finalize_object=finalize_object,
             final_crc32c=None,
         )
         yield request
示例#2
0
 def dummy_iterator():
     yield write_service_pb2.WriteBlobRequest()
     yield write_service_pb2.WriteBlobRequest()