async-bus 0.3.0 → 0.3.2
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
- checksums.yaml.gz.sig +0 -0
- data/lib/async/bus/client.rb +4 -3
- data/lib/async/bus/protocol/connection.rb +3 -1
- data/lib/async/bus/protocol/wrapper.rb +21 -21
- data/lib/async/bus/version.rb +1 -1
- data/license.md +1 -1
- data/readme.md +4 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: becfca795905309ad92af37f83dbfa6ad69b0e52891ca253470a463e1e22080e
|
|
4
|
+
data.tar.gz: 0e6640c88d8492618771f59bf4192af205bd06051392033761ac5097dcc91b62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91b56cf435f4011e45ced90ca78df356a375a39f6325fb1c8deb2aafe9a1390a7ed7e90bb0a2bb0dbf9dfc2c5c18bf07a110fc6823b4f5a7f65879a5c45b4db2
|
|
7
|
+
data.tar.gz: 475f53acb59276d98a09e1dc72f4778f0f57d79294cf90e09def85e6d2e8dee61e3c5e65422066edab01c2c349d1c5e41bd0f17c989f0e1a81a9fb03ce3bcb99
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/async/bus/client.rb
CHANGED
|
@@ -63,9 +63,10 @@ module Async
|
|
|
63
63
|
# Automatically reconnects when the connection fails, with random backoff.
|
|
64
64
|
# This is useful for long-running clients that need to maintain a persistent connection.
|
|
65
65
|
#
|
|
66
|
-
# @
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
# @yields {|connection| ...} If a block is given, it will be called with the connection.
|
|
67
|
+
# @returns [Async::Task] The task that runs the client.
|
|
68
|
+
def run(&block)
|
|
69
|
+
Async(transient: true) do |task|
|
|
69
70
|
loop do
|
|
70
71
|
connection = connect!
|
|
71
72
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Released under the MIT License.
|
|
4
|
-
# Copyright, 2021-
|
|
4
|
+
# Copyright, 2021-2026, by Samuel Williams.
|
|
5
5
|
|
|
6
6
|
require "async"
|
|
7
7
|
require "io/endpoint/unix_endpoint"
|
|
@@ -324,6 +324,8 @@ module Async
|
|
|
324
324
|
Console.error(self, "Unexpected message:", message)
|
|
325
325
|
end
|
|
326
326
|
end
|
|
327
|
+
rescue IOError, EOFError
|
|
328
|
+
# Connection closed - this is normal, not an error.
|
|
327
329
|
ensure
|
|
328
330
|
finalizer_task&.stop
|
|
329
331
|
|
|
@@ -34,39 +34,39 @@ module Async
|
|
|
34
34
|
# The order here matters.
|
|
35
35
|
|
|
36
36
|
self.register_type(0x00, Invoke, recursive: true,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
packer: ->(invoke, packer){invoke.pack(packer)},
|
|
38
|
+
unpacker: ->(unpacker){Invoke.unpack(unpacker)},
|
|
39
|
+
)
|
|
40
40
|
|
|
41
41
|
[Return, Yield, Error, Next, Throw, Close].each_with_index do |klass, index|
|
|
42
42
|
self.register_type(0x01 + index, klass, recursive: true,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
packer: ->(value, packer){value.pack(packer)},
|
|
44
|
+
unpacker: ->(unpacker){klass.unpack(unpacker)},
|
|
45
|
+
)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
# Reverse serialize proxies back into proxies:
|
|
49
49
|
# When a Proxy is received, use proxy_object to handle reverse lookup
|
|
50
50
|
self.register_type(0x10, Proxy, recursive: true,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
packer: self.method(:pack_proxy),
|
|
52
|
+
unpacker: self.method(:unpack_proxy),
|
|
53
|
+
)
|
|
54
54
|
|
|
55
55
|
self.register_type(0x11, Release, recursive: true,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
packer: ->(release, packer){release.pack(packer)},
|
|
57
|
+
unpacker: ->(unpacker){Release.unpack(unpacker)},
|
|
58
|
+
)
|
|
59
59
|
|
|
60
60
|
self.register_type(0x20, Symbol)
|
|
61
61
|
self.register_type(0x21, Exception, recursive: true,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
packer: self.method(:pack_exception),
|
|
63
|
+
unpacker: self.method(:unpack_exception),
|
|
64
|
+
)
|
|
65
65
|
|
|
66
66
|
self.register_type(0x22, Class,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
packer: ->(klass){klass.name},
|
|
68
|
+
unpacker: ->(name){Object.const_get(name)},
|
|
69
|
+
)
|
|
70
70
|
|
|
71
71
|
reference_packer = self.method(:pack_reference)
|
|
72
72
|
reference_unpacker = self.method(:unpack_reference)
|
|
@@ -74,9 +74,9 @@ module Async
|
|
|
74
74
|
# Serialize objects into proxies:
|
|
75
75
|
reference_types&.each_with_index do |klass, index|
|
|
76
76
|
self.register_type(0x30 + index, klass, recursive: true,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
packer: reference_packer,
|
|
78
|
+
unpacker: reference_unpacker,
|
|
79
|
+
)
|
|
80
80
|
end
|
|
81
81
|
end
|
|
82
82
|
|
data/lib/async/bus/version.rb
CHANGED
data/license.md
CHANGED
data/readme.md
CHANGED
|
@@ -23,6 +23,10 @@ Please see the [project documentation](https://socketry.github.io/async-bus/) fo
|
|
|
23
23
|
|
|
24
24
|
Please see the [project releases](https://socketry.github.io/async-bus/releases/index) for all releases.
|
|
25
25
|
|
|
26
|
+
### v0.3.1
|
|
27
|
+
|
|
28
|
+
- `Client#run` now returns an `Async::Task` (as it did in earlier releases).
|
|
29
|
+
|
|
26
30
|
### v0.3.0
|
|
27
31
|
|
|
28
32
|
- Add support for multi-hop proxying.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: async-bus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
133
133
|
- !ruby/object:Gem::Version
|
|
134
134
|
version: '0'
|
|
135
135
|
requirements: []
|
|
136
|
-
rubygems_version:
|
|
136
|
+
rubygems_version: 4.0.3
|
|
137
137
|
specification_version: 4
|
|
138
138
|
summary: Transparent Ruby IPC over an asynchronous message bus.
|
|
139
139
|
test_files: []
|
metadata.gz.sig
CHANGED
|
Binary file
|