baza.rb 0.9.6 → 0.9.7
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/Gemfile +2 -1
- data/Gemfile.lock +2 -1
- data/lib/baza-rb/version.rb +1 -1
- data/lib/baza-rb.rb +7 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4291b734210c6b32949c0025f343304de1c636ab00e0d2efdaeaf8e9eba3a51
|
4
|
+
data.tar.gz: d3cd7f75b3d71a17dea16c1cd164d094c8b4c26b1a20e56c62df8c0d5778f80a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b6375cc3204a5530b8c1b90c8376a63ce262c51cf0ef9ce998068c467390cd94d911c5be0ab16c5bb43522eddabb24b3af8e0de7261ad28baebfdea074d589bd
|
7
|
+
data.tar.gz: 2fcbdcd001c5dc9d1c26320583c6f4a09debc1bbf89b461f0964abcbe4fc165ce7a1f98844c31f7fdeaea076d8c3383308cfc160850a5cde8acebbc28cadbe18
|
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', '
|
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 (
|
221
|
+
wait_for (= 0.1.1)
|
221
222
|
webmock (~> 3.24)
|
222
223
|
webrick (~> 1.9)
|
223
224
|
yard (~> 0.9)
|
data/lib/baza-rb/version.rb
CHANGED
data/lib/baza-rb.rb
CHANGED
@@ -31,6 +31,9 @@ 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
|
+
DEFAULT_CHUNK_SIZE = 4_000_000
|
36
|
+
|
34
37
|
# When the server failed (503).
|
35
38
|
class ServerFailure < StandardError; end
|
36
39
|
|
@@ -99,7 +102,7 @@ class BazaRb
|
|
99
102
|
# @param [Array<String>] meta List of metadata strings to attach to the job
|
100
103
|
# @param [Integer] chunk_size Maximum size of one chunk
|
101
104
|
# @raise [ServerFailure] If the push operation fails
|
102
|
-
def push(name, data, meta, chunk_size:
|
105
|
+
def push(name, data, meta, chunk_size: DEFAULT_CHUNK_SIZE)
|
103
106
|
raise 'The "name" of the job is nil' if name.nil?
|
104
107
|
raise 'The "name" of the job may not be empty' if name.empty?
|
105
108
|
raise 'The "data" of the job is nil' if data.nil?
|
@@ -287,7 +290,7 @@ class BazaRb
|
|
287
290
|
# @param [Integer] chunk_size Maximum size of one chunk
|
288
291
|
# @return [Integer] The ID of the created durable
|
289
292
|
# @raise [ServerFailure] If the upload fails
|
290
|
-
def durable_place(jname, file, chunk_size:
|
293
|
+
def durable_place(jname, file, chunk_size: DEFAULT_CHUNK_SIZE)
|
291
294
|
raise 'The "jname" of the durable is nil' if jname.nil?
|
292
295
|
raise 'The "jname" of the durable may not be empty' if jname.empty?
|
293
296
|
raise 'The "file" of the durable is nil' if file.nil?
|
@@ -320,7 +323,7 @@ class BazaRb
|
|
320
323
|
# @param [String] file The file to upload
|
321
324
|
# @param [Integer] chunk_size Maximum size of one chunk
|
322
325
|
# @raise [ServerFailure] If the save operation fails
|
323
|
-
def durable_save(id, file, chunk_size:
|
326
|
+
def durable_save(id, file, chunk_size: DEFAULT_CHUNK_SIZE)
|
324
327
|
raise 'The ID of the durable is nil' if id.nil?
|
325
328
|
raise 'The ID of the durable must be an Integer' unless id.is_a?(Integer)
|
326
329
|
raise 'The ID of the durable must be a positive integer' unless id.positive?
|
@@ -803,7 +806,7 @@ class BazaRb
|
|
803
806
|
# @param [Hash] extra Hash of extra HTTP headers to include
|
804
807
|
# @param [Integer] chunk_size Maximum size of each chunk in bytes
|
805
808
|
# @raise [ServerFailure] If the upload fails
|
806
|
-
def upload(uri, file, extra = {}, chunk_size:
|
809
|
+
def upload(uri, file, extra = {}, chunk_size: DEFAULT_CHUNK_SIZE)
|
807
810
|
params = {
|
808
811
|
connecttimeout: @timeout,
|
809
812
|
timeout: @timeout,
|