async-bus 0.3.1 → 0.4.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
- checksums.yaml.gz.sig +0 -0
- data/lib/async/bus/client.rb +6 -3
- data/lib/async/bus/protocol/connection.rb +3 -1
- data/lib/async/bus/protocol/proxy.rb +7 -1
- data/lib/async/bus/protocol/transaction.rb +6 -1
- data/lib/async/bus/protocol/wrapper.rb +22 -22
- data/lib/async/bus/version.rb +2 -2
- data/license.md +1 -1
- data/readme.md +22 -0
- data/releases.md +6 -0
- data.tar.gz.sig +0 -0
- metadata +3 -3
- 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: e27f275c4fe4514ebe4b47c05dbdf6754dca1681ba758a35183194064e0e2224
|
|
4
|
+
data.tar.gz: 67286b522c639b851df1e5f5ab14fd4944673cd662b375988874dd2db9924c86
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7f332dbc69e59904d60c8de1ce4932e248cf504364e45670634ee1a4d6e1723fb1a4600f9a18b358550ff45bfca2fc0661f30391868e7012f089d266354eb269
|
|
7
|
+
data.tar.gz: 3cb88b39610d1e7d9fc1bc7bd8bdc8469af56bf604bccc42c91108450d1928b3d08f1bb7ae5e17c047cb00454c31fdd8f986e99eca9124053a2075a3686bd329
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/lib/async/bus/client.rb
CHANGED
|
@@ -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_relative "protocol/connection"
|
|
7
7
|
require "async/queue"
|
|
@@ -65,8 +65,11 @@ module Async
|
|
|
65
65
|
#
|
|
66
66
|
# @yields {|connection| ...} If a block is given, it will be called with the connection.
|
|
67
67
|
# @returns [Async::Task] The task that runs the client.
|
|
68
|
-
def run(&block)
|
|
69
|
-
|
|
68
|
+
def run(**options, &block)
|
|
69
|
+
# This is the default behaviour:
|
|
70
|
+
options[:transient] = true unless options.key?(:transient)
|
|
71
|
+
|
|
72
|
+
Async(**options) do |task|
|
|
70
73
|
loop do
|
|
71
74
|
connection = connect!
|
|
72
75
|
|
|
@@ -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
|
|
|
@@ -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
|
module Async
|
|
7
7
|
module Bus
|
|
@@ -73,6 +73,12 @@ module Async
|
|
|
73
73
|
def inspect
|
|
74
74
|
"#<proxy #{@name}>"
|
|
75
75
|
end
|
|
76
|
+
|
|
77
|
+
# Return the instance variables to inspect.
|
|
78
|
+
# @returns [Array] The instance variables to inspect.
|
|
79
|
+
def instance_variables_to_inspect
|
|
80
|
+
[]
|
|
81
|
+
end
|
|
76
82
|
end
|
|
77
83
|
end
|
|
78
84
|
end
|
|
@@ -143,7 +143,12 @@ module Async
|
|
|
143
143
|
# Store both in the Throw message: result is tag, we'll add value handling
|
|
144
144
|
self.write(Throw.new(@id, [error.tag, error.value]))
|
|
145
145
|
rescue => error
|
|
146
|
-
|
|
146
|
+
# In some cases, the connection may be closed by the time we get here:
|
|
147
|
+
if @connection
|
|
148
|
+
self.write(Error.new(@id, error))
|
|
149
|
+
else
|
|
150
|
+
Console.debug(self, "Connection is closed, ignoring error:", exception: error)
|
|
151
|
+
end
|
|
147
152
|
end
|
|
148
153
|
end
|
|
149
154
|
end
|
|
@@ -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 "msgpack"
|
|
7
7
|
|
|
@@ -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
|
@@ -1,12 +1,12 @@
|
|
|
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
|
# @namespace
|
|
7
7
|
module Async
|
|
8
8
|
# @namespace
|
|
9
9
|
module Bus
|
|
10
|
-
VERSION = "0.
|
|
10
|
+
VERSION = "0.4.0"
|
|
11
11
|
end
|
|
12
12
|
end
|
data/license.md
CHANGED
data/readme.md
CHANGED
|
@@ -23,6 +23,12 @@ 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.4.0
|
|
27
|
+
|
|
28
|
+
- Fix handling of inspect on Ruby 4+.
|
|
29
|
+
- `Client#run(**options)` are passed through to `Async(**options)`.
|
|
30
|
+
- On the server side, if a transaction raises an exception, ignore the exception if the connection is closed.
|
|
31
|
+
|
|
26
32
|
### v0.3.1
|
|
27
33
|
|
|
28
34
|
- `Client#run` now returns an `Async::Task` (as it did in earlier releases).
|
|
@@ -48,6 +54,22 @@ We welcome contributions to this project.
|
|
|
48
54
|
4. Push to the branch (`git push origin my-new-feature`).
|
|
49
55
|
5. Create new Pull Request.
|
|
50
56
|
|
|
57
|
+
### Running Tests
|
|
58
|
+
|
|
59
|
+
To run the test suite:
|
|
60
|
+
|
|
61
|
+
``` shell
|
|
62
|
+
bundle exec sus
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Making Releases
|
|
66
|
+
|
|
67
|
+
To make a new release:
|
|
68
|
+
|
|
69
|
+
``` shell
|
|
70
|
+
bundle exec bake gem:release:patch # or minor or major
|
|
71
|
+
```
|
|
72
|
+
|
|
51
73
|
### Developer Certificate of Origin
|
|
52
74
|
|
|
53
75
|
In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
|
data/releases.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v0.4.0
|
|
4
|
+
|
|
5
|
+
- Fix handling of inspect on Ruby 4+.
|
|
6
|
+
- `Client#run(**options)` are passed through to `Async(**options)`.
|
|
7
|
+
- On the server side, if a transaction raises an exception, ignore the exception if the connection is closed.
|
|
8
|
+
|
|
3
9
|
## v0.3.1
|
|
4
10
|
|
|
5
11
|
- `Client#run` now returns an `Async::Task` (as it did in earlier releases).
|
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.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samuel Williams
|
|
@@ -126,14 +126,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
126
126
|
requirements:
|
|
127
127
|
- - ">="
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
|
-
version: '3.
|
|
129
|
+
version: '3.3'
|
|
130
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
requirements:
|
|
132
132
|
- - ">="
|
|
133
133
|
- !ruby/object:Gem::Version
|
|
134
134
|
version: '0'
|
|
135
135
|
requirements: []
|
|
136
|
-
rubygems_version:
|
|
136
|
+
rubygems_version: 4.0.6
|
|
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
|