grumlin 1.1.0 → 1.3.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/.github/workflows/main.yml +5 -8
- data/.rubocop.yml +4 -1
- data/.tool-versions +1 -1
- data/Gemfile.lock +86 -66
- data/README.md +1 -1
- data/grumlin.gemspec +8 -4
- data/lib/grumlin/client.rb +2 -4
- data/lib/grumlin/config.rb +1 -1
- data/lib/grumlin/dummy_transaction.rb +1 -3
- data/lib/grumlin/repository/error_handling_strategy.rb +5 -5
- data/lib/grumlin/repository/instance_methods.rb +5 -5
- data/lib/grumlin/request_dispatcher.rb +2 -2
- data/lib/grumlin/shortcuts/storage.rb +2 -2
- data/lib/grumlin/shortcuts.rb +1 -1
- data/lib/grumlin/shortcuts_applyer.rb +1 -1
- data/lib/grumlin/step.rb +3 -3
- data/lib/grumlin/steppable.rb +2 -2
- data/lib/grumlin/steps.rb +3 -5
- data/lib/grumlin/transaction.rb +0 -2
- data/lib/grumlin/transport.rb +2 -4
- data/lib/grumlin/traversal_start.rb +1 -1
- data/lib/grumlin/traversal_strategies/options_strategy.rb +1 -1
- data/lib/grumlin/version.rb +1 -1
- metadata +66 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 553507d5129346a6cfb4de0dc7a49c921bcc55fa66bcfb1b34977e2c5745c99d
|
|
4
|
+
data.tar.gz: 50bc26cc953f4c5ecf5a98113694e27222af024d1dc44caa9a4c67f7d25f1001
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fef41b400fac0f1a5630912c8dd28beac3741e5e90d22c60c20dc2bb9c7b5dba266a5ddaaf9a53fbf30f66c854a3a97dad8d61a96e3acc96edcf9bc41c5b0634
|
|
7
|
+
data.tar.gz: a45d7897f703eb52fb94e2d8e9375f9031f9ab2a5ef1c1f465d401a630a5f1831ca73819fee7c445d46bdad120687c64248d12e33874de4de74056e0d6bc8286
|
data/.github/workflows/main.yml
CHANGED
|
@@ -10,19 +10,16 @@ jobs:
|
|
|
10
10
|
|
|
11
11
|
- uses: ruby/setup-ruby@v1
|
|
12
12
|
with:
|
|
13
|
-
ruby-version: "3.0"
|
|
14
13
|
bundler-cache: true
|
|
15
14
|
|
|
16
|
-
- name: Run
|
|
17
|
-
run:
|
|
18
|
-
|
|
19
|
-
bundle install
|
|
20
|
-
bundle exec rubocop
|
|
15
|
+
- name: Run rubocop
|
|
16
|
+
run: bundle exec rubocop -f github
|
|
17
|
+
|
|
21
18
|
test:
|
|
22
19
|
runs-on: ubuntu-latest
|
|
23
20
|
strategy:
|
|
24
21
|
matrix:
|
|
25
|
-
ruby: ["3.
|
|
22
|
+
ruby: ["3.1", "3.2", "3.3"]
|
|
26
23
|
steps:
|
|
27
24
|
- uses: actions/checkout@v2
|
|
28
25
|
|
|
@@ -43,6 +40,7 @@ jobs:
|
|
|
43
40
|
|
|
44
41
|
- name: Run tests
|
|
45
42
|
run: bundle exec rspec
|
|
43
|
+
|
|
46
44
|
publish:
|
|
47
45
|
runs-on: ubuntu-latest
|
|
48
46
|
needs:
|
|
@@ -54,7 +52,6 @@ jobs:
|
|
|
54
52
|
|
|
55
53
|
- uses: ruby/setup-ruby@v1
|
|
56
54
|
with:
|
|
57
|
-
ruby-version: "3.0"
|
|
58
55
|
bundler-cache: true
|
|
59
56
|
|
|
60
57
|
- name: Build gem
|
data/.rubocop.yml
CHANGED
data/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby 3.
|
|
1
|
+
ruby 3.1.5
|
data/Gemfile.lock
CHANGED
|
@@ -1,113 +1,133 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
grumlin (1.
|
|
5
|
-
async
|
|
6
|
-
async-
|
|
4
|
+
grumlin (1.3.0)
|
|
5
|
+
async (~> 2.11.0)
|
|
6
|
+
async-http (~> 0.66.0)
|
|
7
|
+
async-io (~> 1.43.0)
|
|
8
|
+
async-pool (~> 0.6.0)
|
|
9
|
+
async-websocket (~> 0.26.0)
|
|
10
|
+
console (~> 1.25.0)
|
|
7
11
|
ibsciss-middleware (~> 0.4.0)
|
|
8
|
-
oj (~> 3.
|
|
12
|
+
oj (~> 3.16.0)
|
|
9
13
|
retryable (~> 3.0.0)
|
|
10
14
|
zeitwerk (~> 2.6.0)
|
|
11
15
|
|
|
12
16
|
GEM
|
|
13
17
|
remote: https://rubygems.org/
|
|
14
18
|
specs:
|
|
15
|
-
activesupport (7.
|
|
19
|
+
activesupport (7.1.2)
|
|
20
|
+
base64
|
|
21
|
+
bigdecimal
|
|
16
22
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
23
|
+
connection_pool (>= 2.2.5)
|
|
24
|
+
drb
|
|
17
25
|
i18n (>= 1.6, < 2)
|
|
18
26
|
minitest (>= 5.1)
|
|
27
|
+
mutex_m
|
|
19
28
|
tzinfo (~> 2.0)
|
|
20
29
|
ast (2.4.2)
|
|
21
|
-
async (
|
|
22
|
-
console (~> 1.
|
|
23
|
-
|
|
30
|
+
async (2.11.0)
|
|
31
|
+
console (~> 1.25, >= 1.25.2)
|
|
32
|
+
fiber-annotation
|
|
33
|
+
io-event (~> 1.5, >= 1.5.1)
|
|
24
34
|
timers (~> 4.1)
|
|
25
|
-
async-http (0.
|
|
26
|
-
async (>=
|
|
27
|
-
async-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
protocol-
|
|
31
|
-
protocol-
|
|
35
|
+
async-http (0.66.3)
|
|
36
|
+
async (>= 2.10.2)
|
|
37
|
+
async-pool (>= 0.6.1)
|
|
38
|
+
io-endpoint (~> 0.10, >= 0.10.3)
|
|
39
|
+
io-stream (~> 0.4)
|
|
40
|
+
protocol-http (~> 0.26.0)
|
|
41
|
+
protocol-http1 (~> 0.19.0)
|
|
42
|
+
protocol-http2 (~> 0.17.0)
|
|
32
43
|
traces (>= 0.10.0)
|
|
33
|
-
async-io (1.
|
|
44
|
+
async-io (1.43.2)
|
|
34
45
|
async
|
|
35
|
-
async-pool (0.
|
|
46
|
+
async-pool (0.6.1)
|
|
36
47
|
async (>= 1.25)
|
|
37
48
|
async-rspec (1.17.0)
|
|
38
49
|
rspec (~> 3.0)
|
|
39
50
|
rspec-files (~> 1.0)
|
|
40
51
|
rspec-memory (~> 1.0)
|
|
41
|
-
async-websocket (0.
|
|
52
|
+
async-websocket (0.26.1)
|
|
42
53
|
async-http (~> 0.54)
|
|
43
|
-
|
|
44
|
-
protocol-rack (~> 0.1)
|
|
54
|
+
protocol-rack (~> 0.5)
|
|
45
55
|
protocol-websocket (~> 0.11)
|
|
46
56
|
backport (1.2.0)
|
|
47
|
-
base64 (0.
|
|
48
|
-
benchmark (0.
|
|
49
|
-
benchmark-ips (2.
|
|
57
|
+
base64 (0.2.0)
|
|
58
|
+
benchmark (0.3.0)
|
|
59
|
+
benchmark-ips (2.13.0)
|
|
60
|
+
bigdecimal (3.1.5)
|
|
50
61
|
childprocess (4.1.0)
|
|
51
62
|
concurrent-ruby (1.2.2)
|
|
52
|
-
|
|
63
|
+
connection_pool (2.4.1)
|
|
64
|
+
console (1.25.2)
|
|
53
65
|
fiber-annotation
|
|
54
|
-
fiber-local
|
|
66
|
+
fiber-local (~> 1.1)
|
|
67
|
+
json
|
|
55
68
|
dead_end (4.0.0)
|
|
56
69
|
diff-lcs (1.5.0)
|
|
57
70
|
docile (1.4.0)
|
|
71
|
+
drb (2.2.0)
|
|
72
|
+
ruby2_keywords
|
|
58
73
|
e2mmap (0.1.0)
|
|
59
|
-
factory_bot (6.
|
|
74
|
+
factory_bot (6.4.5)
|
|
60
75
|
activesupport (>= 5.0.0)
|
|
61
76
|
fiber-annotation (0.2.0)
|
|
62
|
-
fiber-local (1.
|
|
77
|
+
fiber-local (1.1.0)
|
|
78
|
+
fiber-storage
|
|
79
|
+
fiber-storage (0.1.0)
|
|
63
80
|
i18n (1.14.1)
|
|
64
81
|
concurrent-ruby (~> 1.0)
|
|
65
|
-
ibsciss-middleware (0.4.
|
|
82
|
+
ibsciss-middleware (0.4.3)
|
|
66
83
|
iniparse (1.5.0)
|
|
84
|
+
io-endpoint (0.10.3)
|
|
85
|
+
io-event (1.5.1)
|
|
86
|
+
io-stream (0.4.0)
|
|
67
87
|
jaro_winkler (1.5.6)
|
|
68
|
-
json (2.
|
|
88
|
+
json (2.7.1)
|
|
69
89
|
kramdown (2.4.0)
|
|
70
90
|
rexml
|
|
71
91
|
kramdown-parser-gfm (1.1.0)
|
|
72
92
|
kramdown (~> 2.0)
|
|
73
93
|
language_server-protocol (3.17.0.3)
|
|
74
94
|
memory_profiler (1.0.1)
|
|
75
|
-
mini_portile2 (2.8.
|
|
76
|
-
minitest (5.
|
|
77
|
-
|
|
78
|
-
nokogiri (1.
|
|
95
|
+
mini_portile2 (2.8.5)
|
|
96
|
+
minitest (5.20.0)
|
|
97
|
+
mutex_m (0.2.0)
|
|
98
|
+
nokogiri (1.16.0)
|
|
79
99
|
mini_portile2 (~> 2.8.2)
|
|
80
100
|
racc (~> 1.4)
|
|
81
|
-
nokogiri (1.
|
|
101
|
+
nokogiri (1.16.0-x86_64-linux)
|
|
82
102
|
racc (~> 1.4)
|
|
83
|
-
oj (3.
|
|
84
|
-
|
|
103
|
+
oj (3.16.3)
|
|
104
|
+
bigdecimal (>= 3.0)
|
|
105
|
+
overcommit (0.61.0)
|
|
85
106
|
childprocess (>= 0.6.3, < 5)
|
|
86
107
|
iniparse (~> 1.4)
|
|
87
108
|
rexml (~> 3.2)
|
|
88
|
-
parallel (1.
|
|
89
|
-
parser (3.2.2.
|
|
109
|
+
parallel (1.24.0)
|
|
110
|
+
parser (3.2.2.4)
|
|
90
111
|
ast (~> 2.4.1)
|
|
91
112
|
racc
|
|
92
|
-
protocol-hpack (1.4.
|
|
93
|
-
protocol-http (0.
|
|
94
|
-
protocol-http1 (0.
|
|
113
|
+
protocol-hpack (1.4.3)
|
|
114
|
+
protocol-http (0.26.5)
|
|
115
|
+
protocol-http1 (0.19.1)
|
|
95
116
|
protocol-http (~> 0.22)
|
|
96
|
-
protocol-http2 (0.
|
|
117
|
+
protocol-http2 (0.17.0)
|
|
97
118
|
protocol-hpack (~> 1.4)
|
|
98
119
|
protocol-http (~> 0.18)
|
|
99
|
-
protocol-rack (0.
|
|
120
|
+
protocol-rack (0.5.1)
|
|
100
121
|
protocol-http (~> 0.23)
|
|
101
122
|
rack (>= 1.0)
|
|
102
|
-
protocol-websocket (0.12.
|
|
123
|
+
protocol-websocket (0.12.1)
|
|
103
124
|
protocol-http (~> 0.2)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
rack (3.0.8)
|
|
125
|
+
racc (1.7.3)
|
|
126
|
+
rack (3.0.11)
|
|
107
127
|
rainbow (3.1.1)
|
|
108
|
-
rake (13.0
|
|
128
|
+
rake (13.1.0)
|
|
109
129
|
rbs (2.8.4)
|
|
110
|
-
regexp_parser (2.8.
|
|
130
|
+
regexp_parser (2.8.3)
|
|
111
131
|
retryable (3.0.5)
|
|
112
132
|
reverse_markdown (2.1.1)
|
|
113
133
|
nokogiri
|
|
@@ -129,40 +149,40 @@ GEM
|
|
|
129
149
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
130
150
|
rspec-support (~> 3.12.0)
|
|
131
151
|
rspec-support (3.12.1)
|
|
132
|
-
rubocop (1.
|
|
133
|
-
base64 (~> 0.1.1)
|
|
152
|
+
rubocop (1.59.0)
|
|
134
153
|
json (~> 2.3)
|
|
135
154
|
language_server-protocol (>= 3.17.0)
|
|
136
155
|
parallel (~> 1.10)
|
|
137
|
-
parser (>= 3.2.2.
|
|
156
|
+
parser (>= 3.2.2.4)
|
|
138
157
|
rainbow (>= 2.2.2, < 4.0)
|
|
139
158
|
regexp_parser (>= 1.8, < 3.0)
|
|
140
159
|
rexml (>= 3.2.5, < 4.0)
|
|
141
|
-
rubocop-ast (>= 1.
|
|
160
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
|
142
161
|
ruby-progressbar (~> 1.7)
|
|
143
162
|
unicode-display_width (>= 2.4.0, < 3.0)
|
|
144
|
-
rubocop-ast (1.
|
|
163
|
+
rubocop-ast (1.30.0)
|
|
145
164
|
parser (>= 3.2.1.0)
|
|
146
|
-
rubocop-capybara (2.
|
|
165
|
+
rubocop-capybara (2.19.0)
|
|
147
166
|
rubocop (~> 1.41)
|
|
148
|
-
rubocop-factory_bot (2.
|
|
149
|
-
rubocop (~> 1.33)
|
|
150
|
-
rubocop-performance (1.19.0)
|
|
151
|
-
rubocop (>= 1.7.0, < 2.0)
|
|
152
|
-
rubocop-ast (>= 0.4.0)
|
|
153
|
-
rubocop-rspec (2.23.2)
|
|
167
|
+
rubocop-factory_bot (2.24.0)
|
|
154
168
|
rubocop (~> 1.33)
|
|
169
|
+
rubocop-performance (1.20.1)
|
|
170
|
+
rubocop (>= 1.48.1, < 2.0)
|
|
171
|
+
rubocop-ast (>= 1.30.0, < 2.0)
|
|
172
|
+
rubocop-rspec (2.25.0)
|
|
173
|
+
rubocop (~> 1.40)
|
|
155
174
|
rubocop-capybara (~> 2.17)
|
|
156
175
|
rubocop-factory_bot (~> 2.22)
|
|
157
176
|
ruby-prof (1.6.3)
|
|
158
177
|
ruby-progressbar (1.13.0)
|
|
178
|
+
ruby2_keywords (0.0.5)
|
|
159
179
|
simplecov (0.22.0)
|
|
160
180
|
docile (~> 1.1)
|
|
161
181
|
simplecov-html (~> 0.11)
|
|
162
182
|
simplecov_json_formatter (~> 0.1)
|
|
163
183
|
simplecov-html (0.12.3)
|
|
164
184
|
simplecov_json_formatter (0.1.4)
|
|
165
|
-
solargraph (0.
|
|
185
|
+
solargraph (0.50.0)
|
|
166
186
|
backport (~> 1.2)
|
|
167
187
|
benchmark
|
|
168
188
|
bundler (~> 2.0)
|
|
@@ -178,15 +198,15 @@ GEM
|
|
|
178
198
|
thor (~> 1.0)
|
|
179
199
|
tilt (~> 2.0)
|
|
180
200
|
yard (~> 0.9, >= 0.9.24)
|
|
181
|
-
thor (1.
|
|
182
|
-
tilt (2.
|
|
201
|
+
thor (1.3.0)
|
|
202
|
+
tilt (2.3.0)
|
|
183
203
|
timers (4.3.5)
|
|
184
204
|
traces (0.11.1)
|
|
185
205
|
tzinfo (2.0.6)
|
|
186
206
|
concurrent-ruby (~> 1.0)
|
|
187
|
-
unicode-display_width (2.
|
|
207
|
+
unicode-display_width (2.5.0)
|
|
188
208
|
yard (0.9.34)
|
|
189
|
-
zeitwerk (2.6.
|
|
209
|
+
zeitwerk (2.6.14)
|
|
190
210
|
|
|
191
211
|
PLATFORMS
|
|
192
212
|
ruby
|
data/README.md
CHANGED
data/grumlin.gemspec
CHANGED
|
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
|
16
16
|
|
|
17
17
|
spec.homepage = "https://github.com/babbel/grumlin"
|
|
18
18
|
spec.license = "MIT"
|
|
19
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 3.
|
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 3.1")
|
|
20
20
|
|
|
21
21
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
22
22
|
spec.metadata["source_code_uri"] = "https://github.com/babbel/grumlin"
|
|
@@ -28,10 +28,14 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
end
|
|
29
29
|
spec.require_paths = ["lib"]
|
|
30
30
|
|
|
31
|
-
spec.add_dependency "async
|
|
32
|
-
spec.add_dependency "async-
|
|
31
|
+
spec.add_dependency "async", "~> 2.11.0"
|
|
32
|
+
spec.add_dependency "async-http", "~> 0.66.0"
|
|
33
|
+
spec.add_dependency "async-io", "~> 1.43.0"
|
|
34
|
+
spec.add_dependency "async-pool", "~> 0.6.0"
|
|
35
|
+
spec.add_dependency "async-websocket", "~> 0.26.0"
|
|
36
|
+
spec.add_dependency "console", "~> 1.25.0"
|
|
33
37
|
spec.add_dependency "ibsciss-middleware", "~> 0.4.0"
|
|
34
|
-
spec.add_dependency "oj", "~> 3.
|
|
38
|
+
spec.add_dependency "oj", "~> 3.16.0"
|
|
35
39
|
spec.add_dependency "retryable", "~> 3.0.0"
|
|
36
40
|
spec.add_dependency "zeitwerk", "~> 2.6.0"
|
|
37
41
|
end
|
data/lib/grumlin/client.rb
CHANGED
|
@@ -38,8 +38,6 @@ class Grumlin::Client
|
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
include Console
|
|
42
|
-
|
|
43
41
|
# Client is not reusable. Once closed should be recreated.
|
|
44
42
|
def initialize(url, parent: Async::Task.current, **client_options)
|
|
45
43
|
@url = url
|
|
@@ -62,7 +60,7 @@ class Grumlin::Client
|
|
|
62
60
|
rescue Async::Stop, Async::TimeoutError, StandardError
|
|
63
61
|
close(check_requests: false)
|
|
64
62
|
end
|
|
65
|
-
|
|
63
|
+
Console.debug(self, "Connected")
|
|
66
64
|
end
|
|
67
65
|
|
|
68
66
|
# Before calling close the user must ensure that:
|
|
@@ -85,7 +83,7 @@ class Grumlin::Client
|
|
|
85
83
|
|
|
86
84
|
raise Grumlin::ResourceLeakError, "Request list is not empty: #{@request_dispatcher.requests}" if check_requests
|
|
87
85
|
ensure
|
|
88
|
-
|
|
86
|
+
Console.debug(self, "Closed")
|
|
89
87
|
end
|
|
90
88
|
|
|
91
89
|
def connected?
|
data/lib/grumlin/config.rb
CHANGED
|
@@ -22,7 +22,7 @@ class Grumlin::Config
|
|
|
22
22
|
@pool_size = 10
|
|
23
23
|
@client_concurrency = 5
|
|
24
24
|
@provider = :tinkergraph
|
|
25
|
-
@client_factory = ->(url, parent) { Grumlin::Client.new(url, parent:
|
|
25
|
+
@client_factory = ->(url, parent) { Grumlin::Client.new(url, parent:) }
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def middlewares
|
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
class Grumlin::DummyTransaction < Grumlin::Transaction
|
|
4
4
|
attr_reader :uuid
|
|
5
5
|
|
|
6
|
-
include Console
|
|
7
|
-
|
|
8
6
|
def initialize(traversal_start_class, middlewares:, pool:)
|
|
9
7
|
super
|
|
10
8
|
@session_id = nil
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
Console.info(self) do
|
|
13
11
|
"#{Grumlin.config.provider} does not support transactions. commit and rollback are ignored, data will be saved"
|
|
14
12
|
end
|
|
15
13
|
end
|
|
@@ -19,11 +19,11 @@ class Grumlin::Repository::ErrorHandlingStrategy
|
|
|
19
19
|
@mode == :retry
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def apply!(&
|
|
22
|
+
def apply!(&)
|
|
23
23
|
return yield if raise?
|
|
24
|
-
return ignore_errors!(&
|
|
24
|
+
return ignore_errors!(&) if ignore?
|
|
25
25
|
|
|
26
|
-
retry_errors!(&
|
|
26
|
+
retry_errors!(&)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
private
|
|
@@ -34,7 +34,7 @@ class Grumlin::Repository::ErrorHandlingStrategy
|
|
|
34
34
|
# ignore errors
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
def retry_errors!(&
|
|
38
|
-
Retryable.retryable(**@params, &
|
|
37
|
+
def retry_errors!(&)
|
|
38
|
+
Retryable.retryable(**@params, &)
|
|
39
39
|
end
|
|
40
40
|
end
|
|
@@ -42,7 +42,7 @@ module Grumlin::Repository::InstanceMethods # rubocop:disable Metrics/ModuleLeng
|
|
|
42
42
|
|
|
43
43
|
return if traversal.count.next.zero?
|
|
44
44
|
|
|
45
|
-
drop_in_batches(traversal, batch_size:
|
|
45
|
+
drop_in_batches(traversal, batch_size:)
|
|
46
46
|
|
|
47
47
|
Console.logger.info(self) { "drop_in_batches: finished." }
|
|
48
48
|
end
|
|
@@ -123,17 +123,17 @@ module Grumlin::Repository::InstanceMethods # rubocop:disable Metrics/ModuleLeng
|
|
|
123
123
|
|
|
124
124
|
private
|
|
125
125
|
|
|
126
|
-
def with_upsert_error_handling(on_failure, params, &
|
|
126
|
+
def with_upsert_error_handling(on_failure, params, &)
|
|
127
127
|
if params.any?
|
|
128
128
|
Grumlin::Repository::ErrorHandlingStrategy.new(mode: on_failure, **UPSERT_RETRY_PARAMS.merge(params))
|
|
129
129
|
else
|
|
130
130
|
DEFAULT_ERROR_HANDLING_STRATEGY
|
|
131
|
-
end.apply!(&
|
|
131
|
+
end.apply!(&)
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
-
def with_upsert_retry(retry_params, &
|
|
134
|
+
def with_upsert_retry(retry_params, &)
|
|
135
135
|
retry_params = UPSERT_RETRY_PARAMS.merge(retry_params)
|
|
136
|
-
Retryable.retryable(**retry_params, &
|
|
136
|
+
Retryable.retryable(**retry_params, &)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
def cleanup_properties(create_properties, update_properties, *props_to_cleanup)
|
|
@@ -23,7 +23,7 @@ class Grumlin::RequestDispatcher
|
|
|
23
23
|
raise RequestAlreadyAddedError if @requests.include?(request[:requestId])
|
|
24
24
|
|
|
25
25
|
Async::Channel.new.tap do |channel|
|
|
26
|
-
@requests[request[:requestId]] = { request
|
|
26
|
+
@requests[request[:requestId]] = { request:, result: [], channel: }
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -61,7 +61,7 @@ class Grumlin::RequestDispatcher
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
def clear
|
|
64
|
-
@requests.
|
|
64
|
+
@requests.each_value do |request|
|
|
65
65
|
request[:channel].close!
|
|
66
66
|
end
|
|
67
67
|
@requests.clear
|
|
@@ -35,7 +35,7 @@ class Grumlin::Shortcuts::Storage
|
|
|
35
35
|
sc = step_class
|
|
36
36
|
|
|
37
37
|
shortcut_methods_module.define_method(name) do |*args, **params|
|
|
38
|
-
next sc.new(name, args
|
|
38
|
+
next sc.new(name, args:, params:, previous_step: self, pool:)
|
|
39
39
|
end
|
|
40
40
|
extend_traversal_classes(shortcut) unless shortcut.lazy?
|
|
41
41
|
end
|
|
@@ -47,7 +47,7 @@ class Grumlin::Shortcuts::Storage
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
def g(middlewares: Grumlin.default_middlewares)
|
|
50
|
-
traversal_start_class.new(pool: Grumlin.default_pool, middlewares:
|
|
50
|
+
traversal_start_class.new(pool: Grumlin.default_pool, middlewares:)
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def __
|
data/lib/grumlin/shortcuts.rb
CHANGED
|
@@ -21,7 +21,7 @@ module Grumlin::Shortcuts
|
|
|
21
21
|
|
|
22
22
|
raise ArgumentError, "either shortcut or block must be passed" if [shortcut, block].count(&:nil?) != 1
|
|
23
23
|
|
|
24
|
-
shortcuts.add(name, shortcut || Grumlin::Shortcut.new(name, lazy
|
|
24
|
+
shortcuts.add(name, shortcut || Grumlin::Shortcut.new(name, lazy:, &block))
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
def shortcuts_from(other_shortcuts)
|
|
@@ -26,7 +26,7 @@ class Grumlin::ShortcutsApplyer
|
|
|
26
26
|
args = step.args.map { |arg| call(arg) }
|
|
27
27
|
|
|
28
28
|
shortcut = shortcuts[step.name]
|
|
29
|
-
next result << Grumlin::StepData.new(step.name, args
|
|
29
|
+
next result << Grumlin::StepData.new(step.name, args:, params: step.params) unless shortcut&.lazy?
|
|
30
30
|
|
|
31
31
|
t = shortcuts.__
|
|
32
32
|
step = shortcut.apply(t, *args, **step.params)
|
data/lib/grumlin/step.rb
CHANGED
|
@@ -6,7 +6,7 @@ class Grumlin::Step < Grumlin::Steppable
|
|
|
6
6
|
# TODO: replace pool, session_id and middlewares with a context?
|
|
7
7
|
def initialize(name, args: [], params: {}, previous_step: nil, pool: nil, session_id: nil, # rubocop:disable Metrics/ParameterLists
|
|
8
8
|
middlewares: Grumlin.default_middlewares)
|
|
9
|
-
super(pool
|
|
9
|
+
super(pool:, session_id:, middlewares:)
|
|
10
10
|
|
|
11
11
|
@name = name.to_sym
|
|
12
12
|
@args = args # TODO: add recursive validation: only json types or Step
|
|
@@ -55,7 +55,7 @@ class Grumlin::Step < Grumlin::Steppable
|
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
def bytecode(no_return: false)
|
|
58
|
-
Grumlin::StepsSerializers::Bytecode.new(steps, no_return:
|
|
58
|
+
Grumlin::StepsSerializers::Bytecode.new(steps, no_return:)
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def next
|
|
@@ -85,7 +85,7 @@ class Grumlin::Step < Grumlin::Steppable
|
|
|
85
85
|
|
|
86
86
|
def send_query(need_results:)
|
|
87
87
|
@middlewares.call(traversal: self,
|
|
88
|
-
need_results
|
|
88
|
+
need_results:,
|
|
89
89
|
session_id: @session_id,
|
|
90
90
|
pool: @pool)
|
|
91
91
|
end
|
data/lib/grumlin/steppable.rb
CHANGED
|
@@ -23,13 +23,13 @@ class Grumlin::Steppable
|
|
|
23
23
|
|
|
24
24
|
ALL_STEPS.each do |step|
|
|
25
25
|
define_method step do |*args, **params|
|
|
26
|
-
shortcuts.step_class.new(step, args
|
|
26
|
+
shortcuts.step_class.new(step, args:, params:, previous_step: self,
|
|
27
27
|
session_id: @session_id, pool: @pool, middlewares: @middlewares)
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def step(name, *args, **params)
|
|
32
|
-
shortcuts.step_class.new(name, args
|
|
32
|
+
shortcuts.step_class.new(name, args:, params:, previous_step: self,
|
|
33
33
|
session_id: @session_id, pool: @pool, middlewares: @middlewares)
|
|
34
34
|
end
|
|
35
35
|
|
data/lib/grumlin/steps.rb
CHANGED
|
@@ -24,11 +24,9 @@ class Grumlin::Steps
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def add(name, args: [], params: {}, to: :end)
|
|
27
|
-
if CONFIGURATION_STEPS.include?(name) || name.to_sym == :tx
|
|
28
|
-
return add_configuration_step(name, args: args, params: params, to: to)
|
|
29
|
-
end
|
|
27
|
+
return add_configuration_step(name, args:, params:, to:) if CONFIGURATION_STEPS.include?(name) || name.to_sym == :tx
|
|
30
28
|
|
|
31
|
-
Grumlin::StepData.new(name, args: cast_arguments(args), params:
|
|
29
|
+
Grumlin::StepData.new(name, args: cast_arguments(args), params:).tap do |step|
|
|
32
30
|
next @steps << step if to == :end
|
|
33
31
|
next @steps.unshift(step) if to == :begin
|
|
34
32
|
|
|
@@ -62,7 +60,7 @@ class Grumlin::Steps
|
|
|
62
60
|
def add_configuration_step(name, args: [], params: {}, to: :end)
|
|
63
61
|
raise ArgumentError, "cannot use configuration steps after start step was used" if @steps.any? && to == :end
|
|
64
62
|
|
|
65
|
-
Grumlin::StepData.new(name, args: cast_arguments(args), params:
|
|
63
|
+
Grumlin::StepData.new(name, args: cast_arguments(args), params:).tap do |step|
|
|
66
64
|
next @configuration_steps << step if to == :end
|
|
67
65
|
next @configuration_steps.unshift(step) if to == :begin
|
|
68
66
|
|
data/lib/grumlin/transaction.rb
CHANGED
data/lib/grumlin/transport.rb
CHANGED
|
@@ -4,8 +4,6 @@ class Grumlin::Transport
|
|
|
4
4
|
# A transport based on https://github.com/socketry/async
|
|
5
5
|
# and https://github.com/socketry/async-websocket
|
|
6
6
|
|
|
7
|
-
include Console
|
|
8
|
-
|
|
9
7
|
attr_reader :url
|
|
10
8
|
|
|
11
9
|
# Transport is not reusable. Once closed should be recreated.
|
|
@@ -26,7 +24,7 @@ class Grumlin::Transport
|
|
|
26
24
|
raise AlreadyConnectedError if connected?
|
|
27
25
|
|
|
28
26
|
@connection = Async::WebSocket::Client.connect(Async::HTTP::Endpoint.parse(@url), **@client_options)
|
|
29
|
-
|
|
27
|
+
Console.debug(self) { "Connected to #{@url}." }
|
|
30
28
|
|
|
31
29
|
@response_task = @parent.async { run_response_task }
|
|
32
30
|
|
|
@@ -88,7 +86,7 @@ class Grumlin::Transport
|
|
|
88
86
|
def with_guard
|
|
89
87
|
yield
|
|
90
88
|
rescue Async::Stop, Async::TimeoutError, StandardError => e
|
|
91
|
-
|
|
89
|
+
Console.debug(self) { "Guard error, closing." }
|
|
92
90
|
begin
|
|
93
91
|
@response_channel.exception(e)
|
|
94
92
|
rescue Async::Channel::ChannelClosedError
|
|
@@ -12,7 +12,7 @@ class Grumlin::TraversalStart < Grumlin::Steppable
|
|
|
12
12
|
# Pool should have size of 1 when working with session
|
|
13
13
|
pool = Async::Pool::Controller.new(Grumlin::Client::PoolResource, limit: 1)
|
|
14
14
|
|
|
15
|
-
transaction = tx_class.new(self.class, pool
|
|
15
|
+
transaction = tx_class.new(self.class, pool:, middlewares: @middlewares)
|
|
16
16
|
return transaction unless block_given?
|
|
17
17
|
|
|
18
18
|
result = nil
|
data/lib/grumlin/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,43 +1,99 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: grumlin
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gleb Sinyavskiy
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-05-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: async
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 2.11.0
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 2.11.0
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: async-http
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 0.66.0
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 0.66.0
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: async-io
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 1.43.0
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 1.43.0
|
|
13
55
|
- !ruby/object:Gem::Dependency
|
|
14
56
|
name: async-pool
|
|
15
57
|
requirement: !ruby/object:Gem::Requirement
|
|
16
58
|
requirements:
|
|
17
59
|
- - "~>"
|
|
18
60
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 0.
|
|
61
|
+
version: 0.6.0
|
|
20
62
|
type: :runtime
|
|
21
63
|
prerelease: false
|
|
22
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
65
|
requirements:
|
|
24
66
|
- - "~>"
|
|
25
67
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 0.
|
|
68
|
+
version: 0.6.0
|
|
27
69
|
- !ruby/object:Gem::Dependency
|
|
28
70
|
name: async-websocket
|
|
29
71
|
requirement: !ruby/object:Gem::Requirement
|
|
30
72
|
requirements:
|
|
31
73
|
- - "~>"
|
|
32
74
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 0.
|
|
75
|
+
version: 0.26.0
|
|
76
|
+
type: :runtime
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: 0.26.0
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: console
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: 1.25.0
|
|
34
90
|
type: :runtime
|
|
35
91
|
prerelease: false
|
|
36
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
93
|
requirements:
|
|
38
94
|
- - "~>"
|
|
39
95
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
96
|
+
version: 1.25.0
|
|
41
97
|
- !ruby/object:Gem::Dependency
|
|
42
98
|
name: ibsciss-middleware
|
|
43
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,14 +114,14 @@ dependencies:
|
|
|
58
114
|
requirements:
|
|
59
115
|
- - "~>"
|
|
60
116
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 3.
|
|
117
|
+
version: 3.16.0
|
|
62
118
|
type: :runtime
|
|
63
119
|
prerelease: false
|
|
64
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
121
|
requirements:
|
|
66
122
|
- - "~>"
|
|
67
123
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 3.
|
|
124
|
+
version: 3.16.0
|
|
69
125
|
- !ruby/object:Gem::Dependency
|
|
70
126
|
name: retryable
|
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -213,14 +269,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
213
269
|
requirements:
|
|
214
270
|
- - ">="
|
|
215
271
|
- !ruby/object:Gem::Version
|
|
216
|
-
version: '3.
|
|
272
|
+
version: '3.1'
|
|
217
273
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
218
274
|
requirements:
|
|
219
275
|
- - ">="
|
|
220
276
|
- !ruby/object:Gem::Version
|
|
221
277
|
version: '0'
|
|
222
278
|
requirements: []
|
|
223
|
-
rubygems_version: 3.
|
|
279
|
+
rubygems_version: 3.3.27
|
|
224
280
|
signing_key:
|
|
225
281
|
specification_version: 4
|
|
226
282
|
summary: Gremlin graph traversal language DSL and client for Ruby.
|