baza.rb 0.11.0 → 0.11.1
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 +1 -0
- data/Gemfile.lock +46 -34
- data/Rakefile +1 -0
- data/lib/baza-rb/version.rb +1 -1
- data/lib/baza-rb.rb +29 -28
- 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: 61125f85202d4fff1512986b6d908cddf4d34154b7d0251808aed552e3710fe4
|
|
4
|
+
data.tar.gz: d7f2af72be1e37db02b235ee251b53c2a6f005fdb52bed0020a389027800c62a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad169d4883e99abacc56de890cde937e6faeff3fd690aa370584b63c10987aa8804ac6c7b15df86de39580b3e55d498bf2834c522b0d8fe58e6fa87add564220
|
|
7
|
+
data.tar.gz: 35f78d75de7e884d880ac85a56928596bad609c29211b8ec13bf6fa1d666702a4500b28ad14ab2c631b4b738e8d7d4de79cf69f00944756fce5c7153a22ce2e1
|
data/Gemfile
CHANGED
|
@@ -18,6 +18,7 @@ gem 'rack', '~>3.1', require: false
|
|
|
18
18
|
gem 'rackup', '~>2.2', require: false
|
|
19
19
|
gem 'rake', '~>13.2', require: false
|
|
20
20
|
gem 'random-port', '~>0.7', require: false
|
|
21
|
+
gem 'rdoc', '6.16.0', require: false # GPL
|
|
21
22
|
gem 'rubocop', '~>1.73', require: false
|
|
22
23
|
gem 'rubocop-minitest', '~>0.38', require: false
|
|
23
24
|
gem 'rubocop-performance', '~>1.23', require: false
|
data/Gemfile.lock
CHANGED
|
@@ -17,26 +17,28 @@ PATH
|
|
|
17
17
|
GEM
|
|
18
18
|
remote: https://rubygems.org/
|
|
19
19
|
specs:
|
|
20
|
-
addressable (2.8.
|
|
21
|
-
public_suffix (>= 2.0.2, <
|
|
20
|
+
addressable (2.8.8)
|
|
21
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
22
22
|
ansi (1.5.0)
|
|
23
23
|
ast (2.4.3)
|
|
24
24
|
backtrace (0.4.1)
|
|
25
25
|
base64 (0.3.0)
|
|
26
|
-
bigdecimal (3.
|
|
26
|
+
bigdecimal (3.3.1)
|
|
27
27
|
builder (3.3.0)
|
|
28
|
-
crack (1.0.
|
|
28
|
+
crack (1.0.1)
|
|
29
29
|
bigdecimal
|
|
30
30
|
rexml
|
|
31
|
+
date (3.5.0)
|
|
31
32
|
decoor (0.1.0)
|
|
32
33
|
docile (1.4.1)
|
|
33
34
|
elapsed (0.2.0)
|
|
34
35
|
loog (~> 0.6)
|
|
35
36
|
tago (~> 0.1)
|
|
36
37
|
ellipsized (0.3.0)
|
|
38
|
+
erb (6.0.0)
|
|
37
39
|
ethon (0.15.0)
|
|
38
40
|
ffi (>= 1.15.0)
|
|
39
|
-
factbase (0.
|
|
41
|
+
factbase (0.17.0)
|
|
40
42
|
backtrace (~> 0.4)
|
|
41
43
|
decoor (~> 0.1)
|
|
42
44
|
ellipsized (~> 0.3)
|
|
@@ -47,7 +49,7 @@ GEM
|
|
|
47
49
|
others (~> 0.1)
|
|
48
50
|
tago (~> 0.1)
|
|
49
51
|
yaml (~> 0.3)
|
|
50
|
-
faraday (2.
|
|
52
|
+
faraday (2.14.0)
|
|
51
53
|
faraday-net_http (>= 2.0, < 3.5)
|
|
52
54
|
json
|
|
53
55
|
logger
|
|
@@ -55,8 +57,8 @@ GEM
|
|
|
55
57
|
faraday (>= 0.8)
|
|
56
58
|
faraday-multipart (1.1.1)
|
|
57
59
|
multipart-post (~> 2.0)
|
|
58
|
-
faraday-net_http (3.4.
|
|
59
|
-
net-http (
|
|
60
|
+
faraday-net_http (3.4.2)
|
|
61
|
+
net-http (~> 0.5)
|
|
60
62
|
faraday-retry (2.3.2)
|
|
61
63
|
faraday (~> 2.0)
|
|
62
64
|
ffi (1.17.2-arm64-darwin)
|
|
@@ -64,14 +66,14 @@ GEM
|
|
|
64
66
|
ffi (1.17.2-x86_64-darwin)
|
|
65
67
|
ffi (1.17.2-x86_64-linux-gnu)
|
|
66
68
|
hashdiff (1.2.1)
|
|
67
|
-
iri (0.11.
|
|
68
|
-
json (2.
|
|
69
|
+
iri (0.11.3)
|
|
70
|
+
json (2.16.0)
|
|
69
71
|
language_server-protocol (3.17.0.5)
|
|
70
72
|
lint_roller (1.1.0)
|
|
71
73
|
logger (1.7.0)
|
|
72
74
|
loog (0.6.1)
|
|
73
75
|
logger (~> 1.0)
|
|
74
|
-
minitest (5.
|
|
76
|
+
minitest (5.26.2)
|
|
75
77
|
minitest-reporters (1.7.1)
|
|
76
78
|
ansi
|
|
77
79
|
builder
|
|
@@ -80,9 +82,9 @@ GEM
|
|
|
80
82
|
multipart-post (2.4.1)
|
|
81
83
|
mustermann (3.0.4)
|
|
82
84
|
ruby2_keywords (~> 0.0.1)
|
|
83
|
-
net-http (0.
|
|
84
|
-
uri
|
|
85
|
-
nio4r (2.7.
|
|
85
|
+
net-http (0.8.0)
|
|
86
|
+
uri (>= 0.11.1)
|
|
87
|
+
nio4r (2.7.5)
|
|
86
88
|
nokogiri (1.18.10-arm64-darwin)
|
|
87
89
|
racc (~> 1.4)
|
|
88
90
|
nokogiri (1.18.10-x64-mingw-ucrt)
|
|
@@ -96,21 +98,24 @@ GEM
|
|
|
96
98
|
os (1.1.4)
|
|
97
99
|
others (0.1.1)
|
|
98
100
|
parallel (1.27.0)
|
|
99
|
-
parser (3.3.
|
|
101
|
+
parser (3.3.10.0)
|
|
100
102
|
ast (~> 2.4.1)
|
|
101
103
|
racc
|
|
102
|
-
prism (1.
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
prism (1.6.0)
|
|
105
|
+
psych (5.2.6)
|
|
106
|
+
date
|
|
107
|
+
stringio
|
|
108
|
+
public_suffix (7.0.0)
|
|
109
|
+
puma (7.1.0)
|
|
105
110
|
nio4r (~> 2.0)
|
|
106
|
-
qbash (0.4.
|
|
111
|
+
qbash (0.4.8)
|
|
107
112
|
backtrace (> 0)
|
|
108
113
|
elapsed (> 0)
|
|
109
114
|
loog (> 0)
|
|
110
115
|
tago (> 0)
|
|
111
116
|
racc (1.8.1)
|
|
112
|
-
rack (3.2.
|
|
113
|
-
rack-protection (4.
|
|
117
|
+
rack (3.2.4)
|
|
118
|
+
rack-protection (4.2.1)
|
|
114
119
|
base64 (>= 0.1.0)
|
|
115
120
|
logger (>= 1.6.0)
|
|
116
121
|
rack (>= 3.0.0, < 4)
|
|
@@ -120,13 +125,17 @@ GEM
|
|
|
120
125
|
rackup (2.2.1)
|
|
121
126
|
rack (>= 3)
|
|
122
127
|
rainbow (3.1.1)
|
|
123
|
-
rake (13.3.
|
|
128
|
+
rake (13.3.1)
|
|
124
129
|
random-port (0.7.6)
|
|
125
130
|
tago (~> 0.0)
|
|
131
|
+
rdoc (6.16.0)
|
|
132
|
+
erb
|
|
133
|
+
psych (>= 4.0.0)
|
|
134
|
+
tsort
|
|
126
135
|
regexp_parser (2.11.3)
|
|
127
136
|
retries (0.0.5)
|
|
128
137
|
rexml (3.4.4)
|
|
129
|
-
rubocop (1.
|
|
138
|
+
rubocop (1.81.7)
|
|
130
139
|
json (~> 2.3)
|
|
131
140
|
language_server-protocol (~> 3.17.0.2)
|
|
132
141
|
lint_roller (~> 1.1.0)
|
|
@@ -134,20 +143,20 @@ GEM
|
|
|
134
143
|
parser (>= 3.3.0.2)
|
|
135
144
|
rainbow (>= 2.2.2, < 4.0)
|
|
136
145
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
137
|
-
rubocop-ast (>= 1.
|
|
146
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
138
147
|
ruby-progressbar (~> 1.7)
|
|
139
148
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
140
|
-
rubocop-ast (1.
|
|
149
|
+
rubocop-ast (1.48.0)
|
|
141
150
|
parser (>= 3.3.7.2)
|
|
142
151
|
prism (~> 1.4)
|
|
143
152
|
rubocop-minitest (0.38.2)
|
|
144
153
|
lint_roller (~> 1.1)
|
|
145
154
|
rubocop (>= 1.75.0, < 2.0)
|
|
146
155
|
rubocop-ast (>= 1.38.0, < 2.0)
|
|
147
|
-
rubocop-performance (1.26.
|
|
156
|
+
rubocop-performance (1.26.1)
|
|
148
157
|
lint_roller (~> 1.1)
|
|
149
158
|
rubocop (>= 1.75.0, < 2.0)
|
|
150
|
-
rubocop-ast (>= 1.
|
|
159
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
151
160
|
rubocop-rake (0.7.1)
|
|
152
161
|
lint_roller (~> 1.1)
|
|
153
162
|
rubocop (>= 1.72.1)
|
|
@@ -162,28 +171,30 @@ GEM
|
|
|
162
171
|
simplecov (~> 0.19)
|
|
163
172
|
simplecov-html (0.13.2)
|
|
164
173
|
simplecov_json_formatter (0.1.4)
|
|
165
|
-
sinatra (4.
|
|
174
|
+
sinatra (4.2.1)
|
|
166
175
|
logger (>= 1.6.0)
|
|
167
176
|
mustermann (~> 3.0)
|
|
168
177
|
rack (>= 3.0.0, < 4)
|
|
169
|
-
rack-protection (= 4.
|
|
178
|
+
rack-protection (= 4.2.1)
|
|
170
179
|
rack-session (>= 2.0.0, < 3)
|
|
171
180
|
tilt (~> 2.0)
|
|
172
|
-
|
|
181
|
+
stringio (3.1.8)
|
|
182
|
+
tago (0.4.0)
|
|
173
183
|
tilt (2.6.1)
|
|
174
|
-
timeout (0.4.
|
|
184
|
+
timeout (0.4.4)
|
|
185
|
+
tsort (0.2.0)
|
|
175
186
|
typhoeus (1.5.0)
|
|
176
187
|
ethon (>= 0.9.0, < 0.16.0)
|
|
177
188
|
unicode-display_width (3.2.0)
|
|
178
189
|
unicode-emoji (~> 4.1)
|
|
179
190
|
unicode-emoji (4.1.0)
|
|
180
|
-
uri (1.
|
|
191
|
+
uri (1.1.1)
|
|
181
192
|
wait_for (0.1.1)
|
|
182
|
-
webmock (3.
|
|
193
|
+
webmock (3.26.1)
|
|
183
194
|
addressable (>= 2.8.0)
|
|
184
195
|
crack (>= 0.3.2)
|
|
185
196
|
hashdiff (>= 0.4.0, < 2.0.0)
|
|
186
|
-
webrick (1.9.
|
|
197
|
+
webrick (1.9.2)
|
|
187
198
|
yaml (0.4.0)
|
|
188
199
|
yard (0.9.37)
|
|
189
200
|
|
|
@@ -210,6 +221,7 @@ DEPENDENCIES
|
|
|
210
221
|
rackup (~> 2.2)
|
|
211
222
|
rake (~> 13.2)
|
|
212
223
|
random-port (~> 0.7)
|
|
224
|
+
rdoc (= 6.16.0)
|
|
213
225
|
rubocop (~> 1.73)
|
|
214
226
|
rubocop-minitest (~> 0.38)
|
|
215
227
|
rubocop-performance (~> 1.23)
|
data/Rakefile
CHANGED
data/lib/baza-rb/version.rb
CHANGED
data/lib/baza-rb.rb
CHANGED
|
@@ -7,6 +7,7 @@ require 'base64'
|
|
|
7
7
|
require 'elapsed'
|
|
8
8
|
require 'fileutils'
|
|
9
9
|
require 'iri'
|
|
10
|
+
require 'logger'
|
|
10
11
|
require 'loog'
|
|
11
12
|
require 'retries'
|
|
12
13
|
require 'stringio'
|
|
@@ -78,7 +79,7 @@ class BazaRb
|
|
|
78
79
|
# @raise [ServerFailure] If authentication fails or server returns an error
|
|
79
80
|
def whoami
|
|
80
81
|
nick = nil
|
|
81
|
-
elapsed(@loog) do
|
|
82
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
82
83
|
ret = get(home.append('whoami'))
|
|
83
84
|
nick = ret.body
|
|
84
85
|
throw :"I know that I am @#{nick}, at #{@host}"
|
|
@@ -92,7 +93,7 @@ class BazaRb
|
|
|
92
93
|
# @raise [ServerFailure] If authentication fails or server returns an error
|
|
93
94
|
def balance
|
|
94
95
|
z = nil
|
|
95
|
-
elapsed(@loog) do
|
|
96
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
96
97
|
ret = get(home.append('account').append('balance'))
|
|
97
98
|
z = ret.body.to_f
|
|
98
99
|
throw :"The balance is Ƶ#{z}, at #{@host}"
|
|
@@ -102,7 +103,7 @@ class BazaRb
|
|
|
102
103
|
|
|
103
104
|
# Push factbase to the server to create a new job.
|
|
104
105
|
#
|
|
105
|
-
# @param [String]
|
|
106
|
+
# @param [String] pname The unique name of the product on the server
|
|
106
107
|
# @param [String] data The binary data to push to the server (factbase content)
|
|
107
108
|
# @param [Array<String>] meta List of metadata strings to attach to the job
|
|
108
109
|
# @param [Integer] chunk_size Maximum size of one chunk
|
|
@@ -112,7 +113,7 @@ class BazaRb
|
|
|
112
113
|
raise 'The "name" of the job may not be empty' if pname.empty?
|
|
113
114
|
raise 'The "data" of the job is nil' if data.nil?
|
|
114
115
|
raise 'The "meta" of the job is nil' if meta.nil?
|
|
115
|
-
elapsed(@loog) do
|
|
116
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
116
117
|
Tempfile.open do |file|
|
|
117
118
|
File.binwrite(file.path, data)
|
|
118
119
|
upload(
|
|
@@ -137,7 +138,7 @@ class BazaRb
|
|
|
137
138
|
raise 'The ID of the job is nil' if id.nil?
|
|
138
139
|
raise 'The ID of the job must be a positive integer' unless id.positive?
|
|
139
140
|
data = ''
|
|
140
|
-
elapsed(@loog) do
|
|
141
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
141
142
|
Tempfile.open do |file|
|
|
142
143
|
download(home.append('pull').append("#{id}.fb"), file.path)
|
|
143
144
|
data = File.binread(file)
|
|
@@ -156,7 +157,7 @@ class BazaRb
|
|
|
156
157
|
raise 'The ID of the job is nil' if id.nil?
|
|
157
158
|
raise 'The ID of the job must be a positive integer' unless id.positive?
|
|
158
159
|
fin = false
|
|
159
|
-
elapsed(@loog) do
|
|
160
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
160
161
|
ret = get(home.append('finished').append(id))
|
|
161
162
|
fin = ret.body == 'yes'
|
|
162
163
|
throw :"The job ##{id} is #{'not yet ' unless fin}finished at #{@host}#{" (#{ret.body.inspect})" unless fin}"
|
|
@@ -173,7 +174,7 @@ class BazaRb
|
|
|
173
174
|
raise 'The ID of the job is nil' if id.nil?
|
|
174
175
|
raise 'The ID of the job must be a positive integer' unless id.positive?
|
|
175
176
|
stdout = ''
|
|
176
|
-
elapsed(@loog) do
|
|
177
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
177
178
|
ret = get(home.append('stdout').append("#{id}.txt"))
|
|
178
179
|
stdout = ret.body
|
|
179
180
|
throw :"The stdout of the job ##{id} has #{stdout.split("\n").count} lines"
|
|
@@ -190,7 +191,7 @@ class BazaRb
|
|
|
190
191
|
raise 'The ID of the job is nil' if id.nil?
|
|
191
192
|
raise 'The ID of the job must be a positive integer' unless id.positive?
|
|
192
193
|
code = 0
|
|
193
|
-
elapsed(@loog) do
|
|
194
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
194
195
|
ret = get(home.append('exit').append("#{id}.txt"))
|
|
195
196
|
code = ret.body.to_i
|
|
196
197
|
throw :"The exit code of the job ##{id} is #{code}"
|
|
@@ -207,7 +208,7 @@ class BazaRb
|
|
|
207
208
|
raise 'The ID of the job is nil' if id.nil?
|
|
208
209
|
raise 'The ID of the job must be a positive integer' unless id.positive?
|
|
209
210
|
verdict = ''
|
|
210
|
-
elapsed(@loog) do
|
|
211
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
211
212
|
ret = get(home.append('jobs').append(id).append('verified.txt'))
|
|
212
213
|
verdict = ret.body
|
|
213
214
|
throw :"The verdict of the job ##{id} is #{verdict.inspect}"
|
|
@@ -225,7 +226,7 @@ class BazaRb
|
|
|
225
226
|
raise 'The "pname" of the product is nil' if pname.nil?
|
|
226
227
|
raise 'The "pname" of the product may not be empty' if pname.empty?
|
|
227
228
|
raise 'The "owner" of the lock is nil' if owner.nil?
|
|
228
|
-
elapsed(@loog) do
|
|
229
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
229
230
|
ret = post(
|
|
230
231
|
home.append('lock').append(pname),
|
|
231
232
|
{ 'owner' => owner },
|
|
@@ -246,7 +247,7 @@ class BazaRb
|
|
|
246
247
|
raise 'The "pname" of the job may not be empty' if pname.empty?
|
|
247
248
|
raise 'The "owner" of the lock is nil' if owner.nil?
|
|
248
249
|
raise 'The "owner" of the lock may not be empty' if owner.empty?
|
|
249
|
-
elapsed(@loog) do
|
|
250
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
250
251
|
post(
|
|
251
252
|
home.append('unlock').append(pname),
|
|
252
253
|
{ 'owner' => owner }
|
|
@@ -264,7 +265,7 @@ class BazaRb
|
|
|
264
265
|
raise 'The "name" of the job is nil' if name.nil?
|
|
265
266
|
raise 'The "name" of the job may not be empty' if name.empty?
|
|
266
267
|
job = nil
|
|
267
|
-
elapsed(@loog) do
|
|
268
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
268
269
|
ret = get(home.append('recent').append("#{name}.txt"))
|
|
269
270
|
job = ret.body.to_i
|
|
270
271
|
throw :"The recent \"#{name}\" job's ID is ##{job} at #{@host}"
|
|
@@ -274,13 +275,13 @@ class BazaRb
|
|
|
274
275
|
|
|
275
276
|
# Check whether the name of the job exists on the server.
|
|
276
277
|
#
|
|
277
|
-
# @param [String]
|
|
278
|
+
# @param [String] pname The name of the product on the server
|
|
278
279
|
# @return [Boolean] TRUE if such name exists
|
|
279
280
|
def name_exists?(pname)
|
|
280
281
|
raise 'The "pname" of the product is nil' if pname.nil?
|
|
281
282
|
raise 'The "pname" of the product may not be empty' if pname.empty?
|
|
282
283
|
exists = false
|
|
283
|
-
elapsed(@loog) do
|
|
284
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
284
285
|
ret = get(home.append('exists').append(pname))
|
|
285
286
|
exists = ret.body == 'yes'
|
|
286
287
|
throw :"The name #{pname.inspect} #{exists ? 'exists' : "doesn't exist"} at #{@host}"
|
|
@@ -308,7 +309,7 @@ class BazaRb
|
|
|
308
309
|
raise "The file '#{file}' is too big (#{File.size(file)} bytes) for durable_place(), use durable_save() instead"
|
|
309
310
|
end
|
|
310
311
|
id = nil
|
|
311
|
-
elapsed(@loog) do
|
|
312
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
312
313
|
ret = post(
|
|
313
314
|
home.append('durables').append('place'),
|
|
314
315
|
{
|
|
@@ -336,7 +337,7 @@ class BazaRb
|
|
|
336
337
|
raise 'The ID of the durable must be a positive integer' unless id.positive?
|
|
337
338
|
raise 'The "file" of the durable is nil' if file.nil?
|
|
338
339
|
raise "The file '#{file}' is absent" unless File.exist?(file)
|
|
339
|
-
elapsed(@loog) do
|
|
340
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
340
341
|
upload(home.append('durables').append(id), file, chunk_size:)
|
|
341
342
|
throw :"Durable ##{id} saved #{File.size(file)} bytes to #{@host}"
|
|
342
343
|
end
|
|
@@ -352,7 +353,7 @@ class BazaRb
|
|
|
352
353
|
raise 'The ID of the durable must be an Integer' unless id.is_a?(Integer)
|
|
353
354
|
raise 'The ID of the durable must be a positive integer' unless id.positive?
|
|
354
355
|
raise 'The "file" of the durable is nil' if file.nil?
|
|
355
|
-
elapsed(@loog) do
|
|
356
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
356
357
|
download(home.append('durables').append(id), file)
|
|
357
358
|
throw :"Durable ##{id} loaded #{File.size(file)} bytes from #{@host}"
|
|
358
359
|
end
|
|
@@ -369,7 +370,7 @@ class BazaRb
|
|
|
369
370
|
raise 'The ID of the durable must be a positive integer' unless id.positive?
|
|
370
371
|
raise 'The "owner" of the lock is nil' if owner.nil?
|
|
371
372
|
raise 'The "owner" of the lock may not be empty' if owner.empty?
|
|
372
|
-
elapsed(@loog) do
|
|
373
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
373
374
|
post(
|
|
374
375
|
home.append('durables').append(id).append('lock'),
|
|
375
376
|
{ 'owner' => owner }
|
|
@@ -389,7 +390,7 @@ class BazaRb
|
|
|
389
390
|
raise 'The ID of the durable must be a positive integer' unless id.positive?
|
|
390
391
|
raise 'The "owner" of the lock is nil' if owner.nil?
|
|
391
392
|
raise 'The "owner" of the lock may not be empty' if owner.empty?
|
|
392
|
-
elapsed(@loog) do
|
|
393
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
393
394
|
post(
|
|
394
395
|
home.append('durables').append(id).append('unlock'),
|
|
395
396
|
{ 'owner' => owner }
|
|
@@ -409,7 +410,7 @@ class BazaRb
|
|
|
409
410
|
raise 'The "file" is nil' if file.nil?
|
|
410
411
|
raise 'The "file" may not be empty' if file.empty?
|
|
411
412
|
id = nil
|
|
412
|
-
elapsed(@loog) do
|
|
413
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
413
414
|
ret = get(home.append('durables').append('find').add(jname: pname, pname:, file:), [200, 404])
|
|
414
415
|
if ret.code == 200
|
|
415
416
|
id = ret.body.to_i
|
|
@@ -441,7 +442,7 @@ class BazaRb
|
|
|
441
442
|
'summary' => summary
|
|
442
443
|
}
|
|
443
444
|
body['job'] = job unless job.nil?
|
|
444
|
-
elapsed(@loog) do
|
|
445
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
445
446
|
ret = post(
|
|
446
447
|
home.append('account').append('transfer'),
|
|
447
448
|
body
|
|
@@ -468,7 +469,7 @@ class BazaRb
|
|
|
468
469
|
raise 'The "job" must be Integer' unless job.is_a?(Integer)
|
|
469
470
|
raise 'The "summary" is nil' if summary.nil?
|
|
470
471
|
id = nil
|
|
471
|
-
elapsed(@loog) do
|
|
472
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
472
473
|
ret = post(
|
|
473
474
|
home.append('account').append('fee'),
|
|
474
475
|
{
|
|
@@ -492,7 +493,7 @@ class BazaRb
|
|
|
492
493
|
# @raise [ServerFailure] If the pop operation fails
|
|
493
494
|
def pop(owner, zip)
|
|
494
495
|
success = false
|
|
495
|
-
elapsed(@loog) do
|
|
496
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
496
497
|
uri = home.append('pop').add(owner:)
|
|
497
498
|
ret = get(uri, [204, 302])
|
|
498
499
|
if ret.code == 204
|
|
@@ -519,7 +520,7 @@ class BazaRb
|
|
|
519
520
|
raise 'The ID of the job must be a positive integer' unless id.positive?
|
|
520
521
|
raise 'The "zip" of the job is nil' if zip.nil?
|
|
521
522
|
raise "The 'zip' file is absent: #{zip}" unless File.exist?(zip)
|
|
522
|
-
elapsed(@loog) do
|
|
523
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
523
524
|
upload(home.append('finish').add(id:), zip)
|
|
524
525
|
throw :"Pushed #{File.size(zip)} bytes to #{@host}, finished job ##{id}"
|
|
525
526
|
end
|
|
@@ -531,7 +532,7 @@ class BazaRb
|
|
|
531
532
|
# for the given badge already exists, it's returned. Otherwise, the block
|
|
532
533
|
# is executed and its result is cached.
|
|
533
534
|
#
|
|
534
|
-
# @param [String]
|
|
535
|
+
# @param [String] pname Name of the product
|
|
535
536
|
# @param [String] badge Unique identifier for this valve/computation
|
|
536
537
|
# @param [String] why The reason/description for entering this valve
|
|
537
538
|
# @param [nil|Integer] job Optional job ID to associate with this valve
|
|
@@ -570,7 +571,7 @@ class BazaRb
|
|
|
570
571
|
# @raise [ServerFailure] If token retrieval fails
|
|
571
572
|
def csrf
|
|
572
573
|
token = nil
|
|
573
|
-
elapsed(@loog) do
|
|
574
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
574
575
|
token = get(home.append('csrf')).body
|
|
575
576
|
throw :"CSRF token retrieved (#{token.length} chars)"
|
|
576
577
|
end
|
|
@@ -794,7 +795,7 @@ class BazaRb
|
|
|
794
795
|
FileUtils.touch(file)
|
|
795
796
|
chunk = 0
|
|
796
797
|
blanks = [204, 302]
|
|
797
|
-
elapsed(@loog) do
|
|
798
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
798
799
|
loop do
|
|
799
800
|
slice = ''
|
|
800
801
|
ret = nil
|
|
@@ -879,7 +880,7 @@ class BazaRb
|
|
|
879
880
|
total = File.size(file)
|
|
880
881
|
chunk = 0
|
|
881
882
|
sent = 0
|
|
882
|
-
elapsed(@loog) do
|
|
883
|
+
elapsed(@loog, level: Logger::INFO) do
|
|
883
884
|
loop do
|
|
884
885
|
slice =
|
|
885
886
|
if total > chunk_size
|