示例#1
0
 def write_backblaze_meta_chunk(self, source, size, storage_method, sysmeta,
                                meta_chunk):
     meta_checksum = md5()
     application_key = self.conf['application-key']
     upload_chunk = meta_chunk[0]
     # upload_chunk['size'] = sysmeta['size']
     meta = _put_meta_backblaze(storage_method, application_key)
     handler = BackblazeChunkWriteHandler(sysmeta, upload_chunk,
                                          meta_checksum, storage_method,
                                          meta)
     bytes_transferred, chunks = handler.stream(source)
     return Response("OK")
示例#2
0
文件: app.py 项目: fvennetier/oio-sds
 def write_backblaze_meta_chunk(self, source, size, storage_method, sysmeta,
                                meta_chunk):
     meta_checksum = md5()
     upload_chunk = meta_chunk[0]
     key_file = self.conf.get('key_file')
     try:
         creds = BackblazeUtils.get_credentials(storage_method, key_file)
     except BackblazeUtilsException as exc:
         return Response(exc, 500)
     handler = BackblazeChunkWriteHandler(sysmeta, upload_chunk,
                                          meta_checksum, storage_method,
                                          creds)
     try:
         bytes_transferred, chunks = handler.stream(source)
     except OioException as e:
         return Response(str(e), 503)
     return Response("OK")