grumlin 1.2.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 +1 -1
- data/.tool-versions +1 -1
- data/Gemfile.lock +39 -29
- data/README.md +1 -1
- data/grumlin.gemspec +6 -2
- 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 +1 -1
- 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 +62 -6
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,9 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
grumlin (1.
|
|
5
|
-
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)
|
|
6
9
|
async-websocket (~> 0.26.0)
|
|
10
|
+
console (~> 1.25.0)
|
|
7
11
|
ibsciss-middleware (~> 0.4.0)
|
|
8
12
|
oj (~> 3.16.0)
|
|
9
13
|
retryable (~> 3.0.0)
|
|
@@ -23,30 +27,31 @@ GEM
|
|
|
23
27
|
mutex_m
|
|
24
28
|
tzinfo (~> 2.0)
|
|
25
29
|
ast (2.4.2)
|
|
26
|
-
async (
|
|
27
|
-
console (~> 1.
|
|
28
|
-
|
|
30
|
+
async (2.11.0)
|
|
31
|
+
console (~> 1.25, >= 1.25.2)
|
|
32
|
+
fiber-annotation
|
|
33
|
+
io-event (~> 1.5, >= 1.5.1)
|
|
29
34
|
timers (~> 4.1)
|
|
30
|
-
async-http (0.
|
|
31
|
-
async (>=
|
|
32
|
-
async-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
protocol-
|
|
36
|
-
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)
|
|
37
43
|
traces (>= 0.10.0)
|
|
38
|
-
async-io (1.
|
|
44
|
+
async-io (1.43.2)
|
|
39
45
|
async
|
|
40
|
-
async-pool (0.
|
|
46
|
+
async-pool (0.6.1)
|
|
41
47
|
async (>= 1.25)
|
|
42
48
|
async-rspec (1.17.0)
|
|
43
49
|
rspec (~> 3.0)
|
|
44
50
|
rspec-files (~> 1.0)
|
|
45
51
|
rspec-memory (~> 1.0)
|
|
46
|
-
async-websocket (0.26.
|
|
52
|
+
async-websocket (0.26.1)
|
|
47
53
|
async-http (~> 0.54)
|
|
48
|
-
|
|
49
|
-
protocol-rack (~> 0.1)
|
|
54
|
+
protocol-rack (~> 0.5)
|
|
50
55
|
protocol-websocket (~> 0.11)
|
|
51
56
|
backport (1.2.0)
|
|
52
57
|
base64 (0.2.0)
|
|
@@ -56,9 +61,10 @@ GEM
|
|
|
56
61
|
childprocess (4.1.0)
|
|
57
62
|
concurrent-ruby (1.2.2)
|
|
58
63
|
connection_pool (2.4.1)
|
|
59
|
-
console (1.
|
|
64
|
+
console (1.25.2)
|
|
60
65
|
fiber-annotation
|
|
61
|
-
fiber-local
|
|
66
|
+
fiber-local (~> 1.1)
|
|
67
|
+
json
|
|
62
68
|
dead_end (4.0.0)
|
|
63
69
|
diff-lcs (1.5.0)
|
|
64
70
|
docile (1.4.0)
|
|
@@ -68,11 +74,16 @@ GEM
|
|
|
68
74
|
factory_bot (6.4.5)
|
|
69
75
|
activesupport (>= 5.0.0)
|
|
70
76
|
fiber-annotation (0.2.0)
|
|
71
|
-
fiber-local (1.
|
|
77
|
+
fiber-local (1.1.0)
|
|
78
|
+
fiber-storage
|
|
79
|
+
fiber-storage (0.1.0)
|
|
72
80
|
i18n (1.14.1)
|
|
73
81
|
concurrent-ruby (~> 1.0)
|
|
74
|
-
ibsciss-middleware (0.4.
|
|
82
|
+
ibsciss-middleware (0.4.3)
|
|
75
83
|
iniparse (1.5.0)
|
|
84
|
+
io-endpoint (0.10.3)
|
|
85
|
+
io-event (1.5.1)
|
|
86
|
+
io-stream (0.4.0)
|
|
76
87
|
jaro_winkler (1.5.6)
|
|
77
88
|
json (2.7.1)
|
|
78
89
|
kramdown (2.4.0)
|
|
@@ -84,7 +95,6 @@ GEM
|
|
|
84
95
|
mini_portile2 (2.8.5)
|
|
85
96
|
minitest (5.20.0)
|
|
86
97
|
mutex_m (0.2.0)
|
|
87
|
-
nio4r (2.7.0)
|
|
88
98
|
nokogiri (1.16.0)
|
|
89
99
|
mini_portile2 (~> 2.8.2)
|
|
90
100
|
racc (~> 1.4)
|
|
@@ -100,20 +110,20 @@ GEM
|
|
|
100
110
|
parser (3.2.2.4)
|
|
101
111
|
ast (~> 2.4.1)
|
|
102
112
|
racc
|
|
103
|
-
protocol-hpack (1.4.
|
|
104
|
-
protocol-http (0.
|
|
105
|
-
protocol-http1 (0.
|
|
113
|
+
protocol-hpack (1.4.3)
|
|
114
|
+
protocol-http (0.26.5)
|
|
115
|
+
protocol-http1 (0.19.1)
|
|
106
116
|
protocol-http (~> 0.22)
|
|
107
|
-
protocol-http2 (0.
|
|
117
|
+
protocol-http2 (0.17.0)
|
|
108
118
|
protocol-hpack (~> 1.4)
|
|
109
119
|
protocol-http (~> 0.18)
|
|
110
|
-
protocol-rack (0.
|
|
120
|
+
protocol-rack (0.5.1)
|
|
111
121
|
protocol-http (~> 0.23)
|
|
112
122
|
rack (>= 1.0)
|
|
113
123
|
protocol-websocket (0.12.1)
|
|
114
124
|
protocol-http (~> 0.2)
|
|
115
125
|
racc (1.7.3)
|
|
116
|
-
rack (3.0.
|
|
126
|
+
rack (3.0.11)
|
|
117
127
|
rainbow (3.1.1)
|
|
118
128
|
rake (13.1.0)
|
|
119
129
|
rbs (2.8.4)
|
|
@@ -196,7 +206,7 @@ GEM
|
|
|
196
206
|
concurrent-ruby (~> 1.0)
|
|
197
207
|
unicode-display_width (2.5.0)
|
|
198
208
|
yard (0.9.34)
|
|
199
|
-
zeitwerk (2.6.
|
|
209
|
+
zeitwerk (2.6.14)
|
|
200
210
|
|
|
201
211
|
PLATFORMS
|
|
202
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,8 +28,12 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
end
|
|
29
29
|
spec.require_paths = ["lib"]
|
|
30
30
|
|
|
31
|
-
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"
|
|
32
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
38
|
spec.add_dependency "oj", "~> 3.16.0"
|
|
35
39
|
spec.add_dependency "retryable", "~> 3.0.0"
|
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
|
|
|
@@ -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,29 +1,71 @@
|
|
|
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: 2024-
|
|
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
|
|
@@ -38,6 +80,20 @@ dependencies:
|
|
|
38
80
|
- - "~>"
|
|
39
81
|
- !ruby/object:Gem::Version
|
|
40
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
|
|
90
|
+
type: :runtime
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: 1.25.0
|
|
41
97
|
- !ruby/object:Gem::Dependency
|
|
42
98
|
name: ibsciss-middleware
|
|
43
99
|
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.
|