lib/google/cloud/storage.rb in google-cloud-storage-1.44.0 vs lib/google/cloud/storage.rb in google-cloud-storage-1.45.0

- old
+ new

@@ -65,10 +65,13 @@ # @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional. # @param [Integer] read_timeout How long, in seconds, before requests time out. Optional. # @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional. # @param [String] endpoint Override of the endpoint host name. Optional. # If the param is nil, uses the default endpoint. + # @param [Integer] upload_chunk_size The chunk size of storage upload, in bytes. + # The default value is 100 MB, i.e. 104_857_600 bytes. To disable chunking and upload + # the complete file regardless of size, pass 0 as the chunk size. # @param [String] project Alias for the `project_id` argument. Deprecated. # @param [String] keyfile Alias for the `credentials` argument. # Deprecated. # # @return [Google::Cloud::Storage::Project] @@ -87,11 +90,11 @@ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize def self.new project_id: nil, credentials: nil, scope: nil, retries: nil, timeout: nil, open_timeout: nil, read_timeout: nil, send_timeout: nil, endpoint: nil, project: nil, keyfile: nil, max_elapsed_time: nil, base_interval: nil, max_interval: nil, - multiplier: nil + multiplier: nil, upload_chunk_size: nil scope ||= configure.scope retries ||= configure.retries timeout ||= configure.timeout open_timeout ||= (configure.open_timeout || timeout) read_timeout ||= (configure.read_timeout || timeout) @@ -100,10 +103,11 @@ credentials ||= (keyfile || default_credentials(scope: scope)) max_elapsed_time ||= configure.max_elapsed_time base_interval ||= configure.base_interval max_interval ||= configure.max_interval multiplier ||= configure.multiplier + upload_chunk_size ||= configure.upload_chunk_size unless credentials.is_a? Google::Auth::Credentials credentials = Storage::Credentials.new credentials, scope: scope end @@ -115,11 +119,11 @@ project_id, credentials, retries: retries, timeout: timeout, open_timeout: open_timeout, read_timeout: read_timeout, send_timeout: send_timeout, host: endpoint, quota_project: configure.quota_project, max_elapsed_time: max_elapsed_time, base_interval: base_interval, - max_interval: max_interval, multiplier: multiplier + max_interval: max_interval, multiplier: multiplier, upload_chunk_size: upload_chunk_size ) ) end # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/AbcSize @@ -139,10 +143,13 @@ # @param [Integer] open_timeout How long, in seconds, before failed connections time out. Optional. # @param [Integer] read_timeout How long, in seconds, before requests time out. Optional. # @param [Integer] send_timeout How long, in seconds, before receiving response from server times out. Optional. # @param [String] endpoint Override of the endpoint host name. Optional. # If the param is nil, uses the default endpoint. + # @param [Integer] upload_chunk_size The chunk size of storage upload, in bytes. + # The default value is 100 MB, i.e. 104_857_600 bytes. To disable chunking and upload + # the complete file regardless of size, pass 0 as the chunk size. # # @return [Google::Cloud::Storage::Project] # # @example Use `skip_lookup` to avoid retrieving non-public metadata: # require "google/cloud/storage" @@ -157,20 +164,20 @@ # downloaded.read #=> "Hello world!" # def self.anonymous retries: nil, timeout: nil, open_timeout: nil, read_timeout: nil, send_timeout: nil, endpoint: nil, max_elapsed_time: nil, base_interval: nil, max_interval: nil, - multiplier: nil + multiplier: nil, upload_chunk_size: nil open_timeout ||= timeout read_timeout ||= timeout send_timeout ||= timeout Storage::Project.new( Storage::Service.new( nil, nil, retries: retries, timeout: timeout, open_timeout: open_timeout, read_timeout: read_timeout, send_timeout: send_timeout, host: endpoint, max_elapsed_time: max_elapsed_time, base_interval: base_interval, - max_interval: max_interval, multiplier: multiplier + max_interval: max_interval, multiplier: multiplier, upload_chunk_size: upload_chunk_size ) ) end ## @@ -200,9 +207,10 @@ # * `timeout` - (Integer) (default timeout) The max duration, in seconds, to wait before timing out. # If left blank, the wait will be at most the time permitted by the underlying HTTP/RPC protocol. # * `open_timeout` - (Integer) How long, in seconds, before failed connections time out. # * `read_timeout` - (Integer) How long, in seconds, before requests time out. # * `send_timeout` - (Integer) How long, in seconds, before receiving response from server times out. + # * `upload_chunk_size` - (Integer) The chunk size of storage upload, in bytes. # # @return [Google::Cloud::Config] The configuration object the # Google::Cloud::Storage library uses. # def self.configure