google-apis-core 0.9.5 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/google/apis/core/storage_upload.rb +15 -2
- data/lib/google/apis/core/version.rb +1 -1
- data/lib/google/apis/options.rb +5 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 330bf699ecc5c12098da65f7b89e276d3670fb6cca1270960820d5c369be806d
|
4
|
+
data.tar.gz: 843c6278d958141541fb12176f3eec28d0a0c6e09fbefd2d27a717ef59859bba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41ec08bdf72e469182007ba51c0175c45705d5bc45d651bafe14635f31f4ccbba4d9ba5ff10774e1170144d3196b88ad493d324b7450c009685ec80770e43f28
|
7
|
+
data.tar.gz: a2f3ceec0e14b0d6af9bfcbf47627afb30f39764713f6e8d187413e54dab46446416911257b6f40a2baf1fa91471ef30f7e14dfe0b2b111057bb736bc7e00119
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### 0.10.0 (2023-01-26)
|
4
|
+
|
5
|
+
#### Features
|
6
|
+
|
7
|
+
* Allow chunk size zero for storage resumable upload ([#13283](https://github.com/googleapis/google-api-ruby-client/issues/13283))
|
8
|
+
* Make chunk size configurable ([#13216](https://github.com/googleapis/google-api-ruby-client/issues/13216))
|
9
|
+
|
3
10
|
### 0.9.5 (2023-01-12)
|
4
11
|
|
5
12
|
#### Bug Fixes
|
@@ -32,7 +32,6 @@ module Google
|
|
32
32
|
CONTENT_RANGE_HEADER = "Content-Range"
|
33
33
|
RESUMABLE = "resumable"
|
34
34
|
OK_STATUS = 200
|
35
|
-
CHUNK_SIZE = 8 * 1024 * 1024 # 8 MB
|
36
35
|
|
37
36
|
# File name or IO containing the content to upload
|
38
37
|
# @return [String, File, #read]
|
@@ -46,6 +45,10 @@ module Google
|
|
46
45
|
# @return [Google::Apis::Core::UploadIO]
|
47
46
|
attr_accessor :upload_io
|
48
47
|
|
48
|
+
# Upload chunk size
|
49
|
+
# @return [Integer]
|
50
|
+
attr_accessor :upload_chunk_size
|
51
|
+
|
49
52
|
# Ensure the content is readable and wrapped in an IO instance.
|
50
53
|
#
|
51
54
|
# @return [void]
|
@@ -92,6 +95,7 @@ module Google
|
|
92
95
|
def execute(client)
|
93
96
|
prepare!
|
94
97
|
opencensus_begin_span
|
98
|
+
@upload_chunk_size = options.upload_chunk_size
|
95
99
|
|
96
100
|
do_retry :initiate_resumable_upload, client
|
97
101
|
while @upload_incomplete
|
@@ -137,7 +141,7 @@ module Google
|
|
137
141
|
logger.debug { sprintf('Sending upload command to %s', @upload_url) }
|
138
142
|
|
139
143
|
remaining_content_size = upload_io.size - @offset
|
140
|
-
current_chunk_size =
|
144
|
+
current_chunk_size = get_current_chunk_size remaining_content_size
|
141
145
|
|
142
146
|
request_header = header.dup
|
143
147
|
request_header[CONTENT_RANGE_HEADER] = get_content_range_header current_chunk_size
|
@@ -177,6 +181,15 @@ module Google
|
|
177
181
|
upload_source.is_a?(IO) || upload_source.is_a?(StringIO) || upload_source.is_a?(Tempfile)
|
178
182
|
end
|
179
183
|
|
184
|
+
def get_current_chunk_size remaining_content_size
|
185
|
+
# Disable chunking if the chunk size is set to zero.
|
186
|
+
if @upload_chunk_size == 0
|
187
|
+
remaining_content_size
|
188
|
+
else
|
189
|
+
remaining_content_size < @upload_chunk_size ? remaining_content_size : @upload_chunk_size
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
180
193
|
def get_content_range_header current_chunk_size
|
181
194
|
if upload_io.size == 0
|
182
195
|
numerator = "*"
|
data/lib/google/apis/options.rb
CHANGED
@@ -40,7 +40,8 @@ module Google
|
|
40
40
|
:use_opencensus,
|
41
41
|
:quota_project,
|
42
42
|
:query,
|
43
|
-
:add_invocation_id_header
|
43
|
+
:add_invocation_id_header,
|
44
|
+
:upload_chunk_size)
|
44
45
|
|
45
46
|
# General client options
|
46
47
|
class ClientOptions
|
@@ -98,6 +99,8 @@ module Google
|
|
98
99
|
# @return [Hash<String,String>] Additional HTTP URL query parameters to include in requests.
|
99
100
|
# @!attribute [rw] add_invocation_id_header
|
100
101
|
# @return [Boolean] True if the header gccl-invocation-id need to be set
|
102
|
+
# @!attribute [rw] upload_chunk_size
|
103
|
+
# @return [Integer] The chunk size of storage upload. The default value is 100 MB.
|
101
104
|
|
102
105
|
# Get the default options
|
103
106
|
# @return [Google::Apis::RequestOptions]
|
@@ -133,5 +136,6 @@ module Google
|
|
133
136
|
RequestOptions.default.use_opencensus = true
|
134
137
|
RequestOptions.default.quota_project = nil
|
135
138
|
RequestOptions.default.add_invocation_id_header = false
|
139
|
+
RequestOptions.default.upload_chunk_size = 100 * 1024 * 1024 # 100 MB
|
136
140
|
end
|
137
141
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-apis-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Google LLC
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: representable
|
@@ -186,7 +186,7 @@ licenses:
|
|
186
186
|
metadata:
|
187
187
|
bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
|
188
188
|
changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/google-apis-core/CHANGELOG.md
|
189
|
-
documentation_uri: https://googleapis.dev/ruby/google-apis-core/v0.
|
189
|
+
documentation_uri: https://googleapis.dev/ruby/google-apis-core/v0.10.0
|
190
190
|
source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/main/google-apis-core
|
191
191
|
post_install_message:
|
192
192
|
rdoc_options: []
|