thunderchunk 0.2.0 → 0.2.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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b7834dee012f928bc130486fa1ca0845434e38fd8fc859ffd4259e8df8ad6d3d
|
|
4
|
+
data.tar.gz: ed3ed2504700895afa7fb66f72addd21cee64c1a2166a12ce0f5ce5daa7f17ca
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d318ce39756d530644aa5a7ce290ca43e576bfd5d414b906f7718688602c2edd1dd83f661189bdc80cc8d28a2bbe580b6f9c950cc57e3eff4bc920dbdab67f4
|
|
7
|
+
data.tar.gz: 101c468560163739d980dc94cd0a9d3f0972edd32604e5eefbbb8e907ded0414d586533517735f480df006a246a9c4b6f3117da6471ec9ea44db466ed82bf2c5
|
data/lib/thunderchunk/event.rb
CHANGED
|
@@ -13,9 +13,9 @@ module ThunderChunk
|
|
|
13
13
|
end
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
def initialize(chunk, key,
|
|
16
|
+
def initialize(chunk, key, publisher_loader)
|
|
17
17
|
@chunk = chunk
|
|
18
|
-
@
|
|
18
|
+
@publisher_loader = publisher_loader
|
|
19
19
|
@key = key
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -24,8 +24,6 @@ module ThunderChunk
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# WARN: AI MADE
|
|
27
|
-
# A payload with a key the event does not declare, a declared key left out or a value of another type raises
|
|
28
|
-
# Error, whatever operations.validate_returns says: the payload leaves for another chunk.
|
|
29
27
|
def publish(params)
|
|
30
28
|
Console.info(self, 'Event Published', key: @key, params:)
|
|
31
29
|
begin
|
|
@@ -34,7 +32,7 @@ module ThunderChunk
|
|
|
34
32
|
raise Error, "#{self.class.name}: #{e.message}"
|
|
35
33
|
end
|
|
36
34
|
|
|
37
|
-
@
|
|
35
|
+
@publisher_loader.call.publish(@key, params)
|
|
38
36
|
end
|
|
39
37
|
end
|
|
40
38
|
end
|
|
@@ -24,10 +24,11 @@ module ThunderChunk
|
|
|
24
24
|
def get(key)
|
|
25
25
|
event_klass = @items[key] || raise(Error, 'this event is not registered')
|
|
26
26
|
|
|
27
|
+
# The publisher is built on the first publish: a command that only boots (thunder db setup) sets no resolver.
|
|
27
28
|
event_klass.new(
|
|
28
29
|
@chunk,
|
|
29
30
|
key,
|
|
30
|
-
self.class.publisher(@chunk)
|
|
31
|
+
-> { self.class.publisher(@chunk) }
|
|
31
32
|
)
|
|
32
33
|
end
|
|
33
34
|
|
|
@@ -15,10 +15,9 @@ module ThunderChunk
|
|
|
15
15
|
chunk_identifier, key = path.split('/')
|
|
16
16
|
dock = @chunk.sender_dock
|
|
17
17
|
# WARN: AI MADE
|
|
18
|
-
|
|
19
|
-
# every call is stubbed (ThunderSpec), so it is found on the first call only.
|
|
18
|
+
dock.url_for(chunk_identifier, :operation) unless ENV['THUNDER_ENV'] == 'test'
|
|
20
19
|
sender = -> { dock.sender_for(chunk_identifier, :operation) }
|
|
21
|
-
|
|
20
|
+
# WARN: ---
|
|
22
21
|
|
|
23
22
|
ThunderChunk::Operations::Remote.new(sender:, key:)
|
|
24
23
|
end
|
|
@@ -13,18 +13,21 @@ module ThunderChunk
|
|
|
13
13
|
|
|
14
14
|
def sender_for(chunk_identifier, wire)
|
|
15
15
|
get(chunk_identifier, wire) || begin
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
raise(Error, "Remote #{chunk_identifier} does not set a configured url") if url.blank?
|
|
20
|
-
|
|
21
|
-
protocol = @chunk.config["#{remote}.protocol"] || :http
|
|
16
|
+
url = url_for(chunk_identifier, wire)
|
|
17
|
+
protocol = @chunk.config["remotes.chunk.#{chunk_identifier}.external_import.#{wire}.protocol"] || :http
|
|
22
18
|
sender_class = load_class(wire, protocol)
|
|
23
19
|
|
|
24
20
|
set(chunk_identifier, wire, sender_class.new(chunk_identifier, url))
|
|
25
21
|
end
|
|
26
22
|
end
|
|
27
23
|
|
|
24
|
+
def url_for(chunk_identifier, wire)
|
|
25
|
+
url = @chunk.config["remotes.chunk.#{chunk_identifier}.external_import.#{wire}.url"]
|
|
26
|
+
raise(Error, "Remote #{chunk_identifier} does not set a configured url") if url.blank?
|
|
27
|
+
|
|
28
|
+
url
|
|
29
|
+
end
|
|
30
|
+
|
|
28
31
|
private
|
|
29
32
|
|
|
30
33
|
def get(chunk_identifier, wire)
|
data/lib/thunderchunk/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: thunderchunk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Albert Alef
|
|
@@ -57,14 +57,14 @@ dependencies:
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - '='
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 0.2.
|
|
60
|
+
version: 0.2.1
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - '='
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 0.2.
|
|
67
|
+
version: 0.2.1
|
|
68
68
|
executables: []
|
|
69
69
|
extensions: []
|
|
70
70
|
extra_rdoc_files: []
|