googleapis / googleapis/google-api-ruby-client
Streaming Google storage upload
- Langage dominant
- Ruby
- Étoiles
- 2.9k
- Forks
- 888
- Merge moyen
- 6 min
- PR mergées (30 j)
- 218
Description
I am trying to solve the case of uploading files in a streaming fashion without keeping the full contents in memory
I have previously implemented the same feature in https://github.com/aws/aws-sdk-ruby/pull/1711
As identified in https://github.com/googleapis/google-cloud-ruby/issues/1997
There are some limitations in `google-api-client` which hard codes the use of the content length header
I have written a minimal wrapper library that monkey patches it here which should serve as a good source of inspiration: https://github.com/Fonsan/gcs_stream_upload
```ruby
require 'gcs_stream_upload'
storage = Google::Cloud::Storage.new(timeout: 5 * 60)
bucket = storage.bucket('bucket')
gcs_stream_upload = GCSStreamUpload.new(bucket)
gcs_stream_upload.upload('object') do |io|
IO.copy_stream(IO.popen('yes | head -n 10'), io)
end
# => Written "y\n" * 10
gcs_stream_upload.upload('object') do |io|
io << 'data'
io << 'dat2'
end
# => Written "datadat2"
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Lisez les limitations décrites dans google-cloud-ruby issue #1997 et examinez le wrapper gcs_stream_upload associé, en utilisant ses exemples de streaming comme point de départ. Le travail est terminé lorsque les téléversements Google storage peuvent écrire des données transmises en continu sans conserver l’intégralité du contenu en mémoire, y compris les données produites par IO.copy_stream.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- ruby
- Domaine
- cloud
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 25/100