googleapis / googleapis/google-api-ruby-client
Streaming Google storage upload
- Ngôn ngữ chính
- Ruby
- Star
- 2.9k
- Fork
- 888
- Merge trung bình
- 6 phút
- Pull request đã merge (30 ngày)
- 218
Mô tả
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"
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Đọc các hạn chế được mô tả trong google-cloud-ruby issue #1997 và kiểm tra wrapper gcs_stream_upload được liên kết, sử dụng các ví dụ streaming của nó làm điểm bắt đầu. Công việc được xem là hoàn tất khi các lượt tải lên Google storage có thể ghi dữ liệu được truyền theo luồng mà không giữ toàn bộ nội dung trong bộ nhớ, bao gồm cả dữ liệu được tạo ra thông qua IO.copy_stream.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- ruby
- Lĩnh vực
- cloud
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 25/100