baza.rb 0.9.6 → 0.9.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a06284ab2458dd981b2fe05c7334f332c2ab698a1f928af4be587c2efd5fa932
4
- data.tar.gz: 8a646fe6ee1389319e10e1c12060d30dc0cea229bd25d95e82a025495b017608
3
+ metadata.gz: 49dd0eac66fa87b0721be113bef63fef2b1a6e5a940e1d7b50d9cce9e09862d0
4
+ data.tar.gz: a5f9e460e9ba4aeda8dce60fe3c09921fa7041d977c530c6b917c695c98a41c2
5
5
  SHA512:
6
- metadata.gz: 16a032097d4a21913b2ac9c24cd2248ef7171e5fc3a4caf02a71c1e403c38206721cc067aec2518fdce494b0ffb56dfd03808f36fc82355d4ac91f18b025ea9c
7
- data.tar.gz: 20578325b7d02729ab8b0c65fd0f4aa723de2c74a9ae8f324cc3508d2fea359483ef97c995a65a74369a7657ae8051e9c99cfa13aac87474206392b2d22a6cd9
6
+ metadata.gz: 19be699a163f2d53d927ff05c787e449efe72b444660218544c2ffb84e91e28a3bd42e2731dbf1a8d4f4726cd02f52d6d39b4f1188838febc56ffe26f003fbf6
7
+ data.tar.gz: 75145b1a1f5266f18f25ec956c6ef22b252729834a0af61289c5203c4a0133b78b2f303b33928457fa501b2ad0e4ff0a5b8564855146ecf2bab1c4d57d225778
data/Gemfile CHANGED
@@ -10,6 +10,7 @@ gem 'base64', '~>0.3', require: false
10
10
  gem 'factbase', '~>0.11', require: false
11
11
  gem 'minitest', '~>5.25', require: false
12
12
  gem 'minitest-reporters', '~>1.7', require: false
13
+ gem 'nio4r', '2.7.4', require: false # GPL
13
14
  gem 'online', '~>0.0', require: false
14
15
  gem 'os', '~>1.1', require: false
15
16
  gem 'puma', '~>6.6', require: false
@@ -25,7 +26,7 @@ gem 'rubocop-rake', '~>0.7', require: false
25
26
  gem 'simplecov', '~>0.22', require: false
26
27
  gem 'simplecov-cobertura', '~>2.1', require: false
27
28
  gem 'sinatra', '~>4.1', require: false
28
- gem 'wait_for', '~>0.1', require: false
29
+ gem 'wait_for', '0.1.1', require: false # Unlicensed
29
30
  gem 'webmock', '~>3.24', require: false
30
31
  gem 'webrick', '~>1.9', require: false
31
32
  gem 'yard', '~>0.9', require: false
data/Gemfile.lock CHANGED
@@ -202,6 +202,7 @@ DEPENDENCIES
202
202
  factbase (~> 0.11)
203
203
  minitest (~> 5.25)
204
204
  minitest-reporters (~> 1.7)
205
+ nio4r (= 2.7.4)
205
206
  online (~> 0.0)
206
207
  os (~> 1.1)
207
208
  puma (~> 6.6)
@@ -217,7 +218,7 @@ DEPENDENCIES
217
218
  simplecov (~> 0.22)
218
219
  simplecov-cobertura (~> 2.1)
219
220
  sinatra (~> 4.1)
220
- wait_for (~> 0.1)
221
+ wait_for (= 0.1.1)
221
222
  webmock (~> 3.24)
222
223
  webrick (~> 1.9)
223
224
  yard (~> 0.9)
@@ -13,5 +13,5 @@
13
13
  # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
14
14
  # License:: MIT
15
15
  class BazaRb
16
- VERSION = '0.9.6'
16
+ VERSION = '0.9.8'
17
17
  end
data/lib/baza-rb.rb CHANGED
@@ -31,6 +31,12 @@ require_relative 'baza-rb/version'
31
31
  # Copyright:: Copyright (c) 2024-2025 Yegor Bugayenko
32
32
  # License:: MIT
33
33
  class BazaRb
34
+ # How big are the chunks we send, by default, in bytes.
35
+ # Numbers larger than 1Mb may lead to problems with the server,
36
+ # since sending time will be too long and the server may drop
37
+ # connections. Better keep it as is: 1Mb.
38
+ DEFAULT_CHUNK_SIZE = 1_000_000
39
+
34
40
  # When the server failed (503).
35
41
  class ServerFailure < StandardError; end
36
42
 
@@ -99,7 +105,7 @@ class BazaRb
99
105
  # @param [Array<String>] meta List of metadata strings to attach to the job
100
106
  # @param [Integer] chunk_size Maximum size of one chunk
101
107
  # @raise [ServerFailure] If the push operation fails
102
- def push(name, data, meta, chunk_size: 1_000_000)
108
+ def push(name, data, meta, chunk_size: DEFAULT_CHUNK_SIZE)
103
109
  raise 'The "name" of the job is nil' if name.nil?
104
110
  raise 'The "name" of the job may not be empty' if name.empty?
105
111
  raise 'The "data" of the job is nil' if data.nil?
@@ -287,7 +293,7 @@ class BazaRb
287
293
  # @param [Integer] chunk_size Maximum size of one chunk
288
294
  # @return [Integer] The ID of the created durable
289
295
  # @raise [ServerFailure] If the upload fails
290
- def durable_place(jname, file, chunk_size: 1_000_000)
296
+ def durable_place(jname, file, chunk_size: DEFAULT_CHUNK_SIZE)
291
297
  raise 'The "jname" of the durable is nil' if jname.nil?
292
298
  raise 'The "jname" of the durable may not be empty' if jname.empty?
293
299
  raise 'The "file" of the durable is nil' if file.nil?
@@ -320,7 +326,7 @@ class BazaRb
320
326
  # @param [String] file The file to upload
321
327
  # @param [Integer] chunk_size Maximum size of one chunk
322
328
  # @raise [ServerFailure] If the save operation fails
323
- def durable_save(id, file, chunk_size: 1_000_000)
329
+ def durable_save(id, file, chunk_size: DEFAULT_CHUNK_SIZE)
324
330
  raise 'The ID of the durable is nil' if id.nil?
325
331
  raise 'The ID of the durable must be an Integer' unless id.is_a?(Integer)
326
332
  raise 'The ID of the durable must be a positive integer' unless id.positive?
@@ -803,7 +809,7 @@ class BazaRb
803
809
  # @param [Hash] extra Hash of extra HTTP headers to include
804
810
  # @param [Integer] chunk_size Maximum size of each chunk in bytes
805
811
  # @raise [ServerFailure] If the upload fails
806
- def upload(uri, file, extra = {}, chunk_size: 1_000_000)
812
+ def upload(uri, file, extra = {}, chunk_size: DEFAULT_CHUNK_SIZE)
807
813
  params = {
808
814
  connecttimeout: @timeout,
809
815
  timeout: @timeout,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baza.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko