async-bus 0.1.1 → 0.2.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 +68 -36
- data/lib/async/bus/controller.rb +58 -0
- data/lib/async/bus/protocol/connection.rb +146 -78
- data/lib/async/bus/protocol/invoke.rb +58 -0
- data/lib/async/bus/protocol/proxy.rb +20 -40
- data/lib/async/bus/protocol/release.rb +29 -0
- data/lib/async/bus/protocol/response.rb +39 -0
- data/lib/async/bus/protocol/transaction.rb +57 -62
- data/lib/async/bus/protocol/wrapper.rb +71 -31
- data/lib/async/bus/server.rb +8 -30
- data/lib/async/bus/version.rb +3 -20
- data/lib/async/bus.rb +3 -19
- data/license.md +21 -0
- data/readme.md +41 -0
- data/releases.md +5 -0
- data.tar.gz.sig +0 -0
- metadata +49 -16
- metadata.gz.sig +3 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2025, by Samuel Williams.
|
|
5
|
+
|
|
6
|
+
module Async
|
|
7
|
+
module Bus
|
|
8
|
+
module Protocol
|
|
9
|
+
class Response
|
|
10
|
+
def initialize(id, result)
|
|
11
|
+
@id = id
|
|
12
|
+
@result = result
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
attr :id
|
|
16
|
+
attr :result
|
|
17
|
+
|
|
18
|
+
def pack(packer)
|
|
19
|
+
packer.write(@id)
|
|
20
|
+
packer.write(@result)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.unpack(unpacker)
|
|
24
|
+
id = unpacker.read
|
|
25
|
+
result = unpacker.read
|
|
26
|
+
|
|
27
|
+
return self.new(id, result)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Return = Class.new(Response)
|
|
32
|
+
Yield = Class.new(Response)
|
|
33
|
+
Error = Class.new(Response)
|
|
34
|
+
Next = Class.new(Response)
|
|
35
|
+
Throw = Class.new(Response)
|
|
36
|
+
Close = Class.new(Response)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -1,59 +1,60 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
|
22
5
|
|
|
23
|
-
require
|
|
6
|
+
require "async/queue"
|
|
24
7
|
|
|
25
8
|
module Async
|
|
26
9
|
module Bus
|
|
27
10
|
module Protocol
|
|
28
11
|
class Transaction
|
|
29
|
-
def initialize(connection, id)
|
|
12
|
+
def initialize(connection, id, timeout: nil)
|
|
30
13
|
@connection = connection
|
|
31
14
|
@id = id
|
|
32
15
|
|
|
33
|
-
@
|
|
16
|
+
@timeout = timeout
|
|
17
|
+
|
|
18
|
+
@received = Thread::Queue.new
|
|
34
19
|
@accept = nil
|
|
35
20
|
end
|
|
36
21
|
|
|
22
|
+
attr :connection
|
|
37
23
|
attr :id
|
|
24
|
+
|
|
25
|
+
attr_accessor :timeout
|
|
26
|
+
|
|
38
27
|
attr :received
|
|
28
|
+
attr :accept
|
|
39
29
|
|
|
40
30
|
def read
|
|
41
31
|
if @received.empty?
|
|
42
|
-
@connection.
|
|
32
|
+
@connection.flush
|
|
43
33
|
end
|
|
44
34
|
|
|
45
|
-
@received.
|
|
35
|
+
@received.pop(timeout: @timeout)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def write(message)
|
|
39
|
+
if @connection
|
|
40
|
+
@connection.write(message)
|
|
41
|
+
else
|
|
42
|
+
raise RuntimeError, "Transaction is closed!"
|
|
43
|
+
end
|
|
46
44
|
end
|
|
47
45
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
# Push a message to the transaction's received queue.
|
|
47
|
+
# Silently ignores messages if the queue is already closed.
|
|
48
|
+
def push(message)
|
|
49
|
+
@received.push(message)
|
|
50
|
+
rescue ClosedQueueError
|
|
51
|
+
# Queue is closed (transaction already finished/closed) - ignore silently.
|
|
51
52
|
end
|
|
52
53
|
|
|
53
54
|
def close
|
|
54
|
-
if @connection
|
|
55
|
-
connection = @connection
|
|
55
|
+
if connection = @connection
|
|
56
56
|
@connection = nil
|
|
57
|
+
@received.close
|
|
57
58
|
|
|
58
59
|
connection.transactions.delete(@id)
|
|
59
60
|
end
|
|
@@ -61,61 +62,55 @@ module Async
|
|
|
61
62
|
|
|
62
63
|
# Invoke a remote procedure.
|
|
63
64
|
def invoke(name, arguments, options, &block)
|
|
64
|
-
Console.
|
|
65
|
+
Console.debug(self){[name, arguments, options, block]}
|
|
65
66
|
|
|
66
|
-
self.write(
|
|
67
|
+
self.write(Invoke.new(@id, name, arguments, options, block_given?))
|
|
67
68
|
|
|
68
69
|
while response = self.read
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
when
|
|
73
|
-
raise(result)
|
|
74
|
-
when :return
|
|
75
|
-
return(result)
|
|
76
|
-
when :yield
|
|
70
|
+
case response
|
|
71
|
+
when Return
|
|
72
|
+
return response.result
|
|
73
|
+
when Yield
|
|
77
74
|
begin
|
|
78
|
-
result = yield(*result)
|
|
79
|
-
self.write(
|
|
75
|
+
result = yield(*response.result)
|
|
76
|
+
self.write(Next.new(@id, result))
|
|
80
77
|
rescue => error
|
|
81
|
-
self.write(
|
|
78
|
+
self.write(Error.new(@id, error))
|
|
82
79
|
end
|
|
80
|
+
when Error
|
|
81
|
+
raise(response.result)
|
|
83
82
|
end
|
|
84
83
|
end
|
|
85
|
-
|
|
86
|
-
# ensure
|
|
87
|
-
# self.write(:close)
|
|
88
84
|
end
|
|
89
85
|
|
|
90
86
|
# Accept a remote procedure invokation.
|
|
91
|
-
def accept(object, arguments, options,
|
|
92
|
-
if
|
|
87
|
+
def accept(object, arguments, options, block_given)
|
|
88
|
+
if block_given
|
|
93
89
|
result = object.public_send(*arguments, **options) do |*yield_arguments|
|
|
94
|
-
self.write(
|
|
95
|
-
|
|
90
|
+
self.write(Yield.new(@id, yield_arguments))
|
|
91
|
+
|
|
92
|
+
response = self.read
|
|
96
93
|
|
|
97
|
-
case
|
|
98
|
-
when
|
|
99
|
-
result
|
|
100
|
-
when
|
|
101
|
-
|
|
102
|
-
when
|
|
103
|
-
|
|
94
|
+
case response
|
|
95
|
+
when Next
|
|
96
|
+
response.result
|
|
97
|
+
when Error
|
|
98
|
+
raise(response.result)
|
|
99
|
+
when Close
|
|
100
|
+
break
|
|
104
101
|
end
|
|
105
102
|
end
|
|
106
103
|
else
|
|
107
104
|
result = object.public_send(*arguments, **options)
|
|
108
105
|
end
|
|
109
106
|
|
|
110
|
-
self.write(
|
|
107
|
+
self.write(Return.new(@id, result))
|
|
111
108
|
rescue UncaughtThrowError => error
|
|
112
|
-
self.write(
|
|
109
|
+
self.write(Throw.new(@id, error.tag))
|
|
113
110
|
rescue => error
|
|
114
|
-
self.write(
|
|
115
|
-
# ensure
|
|
116
|
-
# self.write(:close)
|
|
111
|
+
self.write(Error.new(@id, error))
|
|
117
112
|
end
|
|
118
113
|
end
|
|
119
114
|
end
|
|
120
115
|
end
|
|
121
|
-
end
|
|
116
|
+
end
|
|
@@ -1,51 +1,91 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
|
22
5
|
|
|
23
|
-
require
|
|
6
|
+
require "msgpack"
|
|
7
|
+
|
|
8
|
+
require_relative "proxy"
|
|
9
|
+
require_relative "invoke"
|
|
10
|
+
require_relative "response"
|
|
11
|
+
require_relative "release"
|
|
12
|
+
|
|
13
|
+
require_relative "../controller"
|
|
24
14
|
|
|
25
15
|
module Async
|
|
26
16
|
module Bus
|
|
27
17
|
module Protocol
|
|
28
18
|
class Wrapper < MessagePack::Factory
|
|
29
|
-
def initialize(bus)
|
|
19
|
+
def initialize(bus, reference_types: [Controller])
|
|
30
20
|
super()
|
|
31
21
|
|
|
32
22
|
@bus = bus
|
|
23
|
+
@reference_types = reference_types
|
|
24
|
+
|
|
25
|
+
# The order here matters.
|
|
26
|
+
|
|
27
|
+
self.register_type(0x00, Invoke, recursive: true,
|
|
28
|
+
packer: ->(invoke, packer){invoke.pack(packer)},
|
|
29
|
+
unpacker: ->(unpacker){Invoke.unpack(unpacker)},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
[Return, Yield, Error, Next, Throw, Close].each_with_index do |klass, index|
|
|
33
|
+
self.register_type(0x01 + index, klass, recursive: true,
|
|
34
|
+
packer: ->(value, packer){value.pack(packer)},
|
|
35
|
+
unpacker: ->(unpacker){klass.unpack(unpacker)},
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Reverse serialize proxies back into proxies:
|
|
40
|
+
# When a Proxy is received, create a proxy pointing back
|
|
41
|
+
self.register_type(0x10, Proxy,
|
|
42
|
+
packer: ->(proxy){proxy.__name__},
|
|
43
|
+
unpacker: @bus.method(:[]),
|
|
44
|
+
)
|
|
33
45
|
|
|
34
|
-
self.register_type(
|
|
35
|
-
packer:
|
|
36
|
-
unpacker:
|
|
46
|
+
self.register_type(0x11, Release, recursive: true,
|
|
47
|
+
packer: ->(release, packer){release.pack(packer)},
|
|
48
|
+
unpacker: ->(unpacker){Release.unpack(unpacker)},
|
|
37
49
|
)
|
|
38
50
|
|
|
39
|
-
self.register_type(
|
|
40
|
-
self.register_type(
|
|
41
|
-
packer:
|
|
42
|
-
unpacker:
|
|
51
|
+
self.register_type(0x20, Symbol)
|
|
52
|
+
self.register_type(0x21, Exception,
|
|
53
|
+
packer: self.method(:pack_exception),
|
|
54
|
+
unpacker: self.method(:unpack_exception),
|
|
55
|
+
recursive: true,
|
|
43
56
|
)
|
|
44
57
|
|
|
45
|
-
self.register_type(
|
|
46
|
-
packer: ->(klass){
|
|
47
|
-
unpacker: ->(
|
|
58
|
+
self.register_type(0x22, Class,
|
|
59
|
+
packer: ->(klass){klass.name},
|
|
60
|
+
unpacker: ->(name){Object.const_get(name)},
|
|
48
61
|
)
|
|
62
|
+
|
|
63
|
+
# Serialize objects into proxies:
|
|
64
|
+
reference_types&.each_with_index do |klass, index|
|
|
65
|
+
self.register_type(0x30 + index, klass,
|
|
66
|
+
packer: @bus.method(:proxy_name),
|
|
67
|
+
unpacker: @bus.method(:[]),
|
|
68
|
+
)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def pack_exception(exception, packer)
|
|
73
|
+
packer.write(exception.class.name)
|
|
74
|
+
packer.write(exception.message)
|
|
75
|
+
packer.write(exception.backtrace)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def unpack_exception(unpacker)
|
|
79
|
+
klass = unpacker.read
|
|
80
|
+
message = unpacker.read
|
|
81
|
+
backtrace = unpacker.read
|
|
82
|
+
|
|
83
|
+
klass = Object.const_get(klass)
|
|
84
|
+
|
|
85
|
+
exception = klass.new(message)
|
|
86
|
+
exception.set_backtrace(backtrace)
|
|
87
|
+
|
|
88
|
+
return exception
|
|
49
89
|
end
|
|
50
90
|
end
|
|
51
91
|
end
|
data/lib/async/bus/server.rb
CHANGED
|
@@ -1,49 +1,27 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
|
22
5
|
|
|
23
|
-
require_relative
|
|
24
|
-
require
|
|
6
|
+
require_relative "protocol/connection"
|
|
7
|
+
require "set"
|
|
25
8
|
|
|
26
9
|
module Async
|
|
27
10
|
module Bus
|
|
28
11
|
class Server
|
|
29
|
-
def initialize(endpoint = nil)
|
|
12
|
+
def initialize(endpoint = nil, **options)
|
|
30
13
|
@endpoint = endpoint || Protocol.local_endpoint
|
|
31
|
-
@
|
|
32
|
-
|
|
33
|
-
@context = {}
|
|
14
|
+
@options = options
|
|
34
15
|
end
|
|
35
16
|
|
|
36
|
-
attr :connected
|
|
37
|
-
|
|
38
17
|
def accept
|
|
39
18
|
@endpoint.accept do |peer|
|
|
40
|
-
connection = Protocol::Connection.server(peer)
|
|
41
|
-
@connected[peer] = connection
|
|
19
|
+
connection = Protocol::Connection.server(peer, **@options)
|
|
42
20
|
|
|
43
21
|
yield connection
|
|
22
|
+
|
|
44
23
|
connection.run
|
|
45
24
|
ensure
|
|
46
|
-
connection = @connected.delete(peer)
|
|
47
25
|
connection&.close
|
|
48
26
|
end
|
|
49
27
|
end
|
data/lib/async/bus/version.rb
CHANGED
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
|
22
5
|
|
|
23
6
|
module Async
|
|
24
7
|
module Bus
|
|
25
|
-
VERSION = "0.
|
|
8
|
+
VERSION = "0.2.0"
|
|
26
9
|
end
|
|
27
10
|
end
|
data/lib/async/bus.rb
CHANGED
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
# furnished to do so, subject to the following conditions:
|
|
11
|
-
#
|
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
|
13
|
-
# all copies or substantial portions of the Software.
|
|
14
|
-
#
|
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
# THE SOFTWARE.
|
|
3
|
+
# Released under the MIT License.
|
|
4
|
+
# Copyright, 2021-2025, by Samuel Williams.
|
|
22
5
|
|
|
23
6
|
require_relative "bus/version"
|
|
7
|
+
require_relative "bus/controller"
|
data/license.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright, 2021-2025, by Samuel Williams.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/readme.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Async::Bus
|
|
2
|
+
|
|
3
|
+
Provides a client and server implementation for asynchronous message buses in Ruby.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/socketry/async-bus/actions?workflow=Test)
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Serialization of (rich) Ruby objects using [MessagePack](https://msgpack.org/).
|
|
10
|
+
- Asynchronous Remote Procedure Calls (RPC) with timeouts.
|
|
11
|
+
- Automatic client and server reconnection handling.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Please see the [project documentation](https://socketry.github.io/async-bus/) for more details.
|
|
16
|
+
|
|
17
|
+
## Releases
|
|
18
|
+
|
|
19
|
+
Please see the [project releases](https://socketry.github.io/async-bus/releases/index) for all releases.
|
|
20
|
+
|
|
21
|
+
### v0.2.0
|
|
22
|
+
|
|
23
|
+
- Fix handling of temporary objects.
|
|
24
|
+
|
|
25
|
+
## Contributing
|
|
26
|
+
|
|
27
|
+
We welcome contributions to this project.
|
|
28
|
+
|
|
29
|
+
1. Fork it.
|
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`).
|
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`).
|
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`).
|
|
33
|
+
5. Create new Pull Request.
|
|
34
|
+
|
|
35
|
+
### Developer Certificate of Origin
|
|
36
|
+
|
|
37
|
+
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.
|
|
38
|
+
|
|
39
|
+
### Community Guidelines
|
|
40
|
+
|
|
41
|
+
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.
|
data/releases.md
ADDED
data.tar.gz.sig
ADDED
|
Binary file
|
metadata
CHANGED
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: async-bus
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|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02 00:00:00.000000000 Z
|
|
12
40
|
dependencies:
|
|
13
41
|
- !ruby/object:Gem::Dependency
|
|
14
42
|
name: async
|
|
@@ -25,7 +53,7 @@ dependencies:
|
|
|
25
53
|
- !ruby/object:Gem::Version
|
|
26
54
|
version: '0'
|
|
27
55
|
- !ruby/object:Gem::Dependency
|
|
28
|
-
name:
|
|
56
|
+
name: io-endpoint
|
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|
|
30
58
|
requirements:
|
|
31
59
|
- - ">="
|
|
@@ -39,13 +67,13 @@ dependencies:
|
|
|
39
67
|
- !ruby/object:Gem::Version
|
|
40
68
|
version: '0'
|
|
41
69
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
70
|
+
name: io-stream
|
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
|
44
72
|
requirements:
|
|
45
73
|
- - ">="
|
|
46
74
|
- !ruby/object:Gem::Version
|
|
47
75
|
version: '0'
|
|
48
|
-
type: :
|
|
76
|
+
type: :runtime
|
|
49
77
|
prerelease: false
|
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
79
|
requirements:
|
|
@@ -53,38 +81,44 @@ dependencies:
|
|
|
53
81
|
- !ruby/object:Gem::Version
|
|
54
82
|
version: '0'
|
|
55
83
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
84
|
+
name: msgpack
|
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
|
58
86
|
requirements:
|
|
59
87
|
- - ">="
|
|
60
88
|
- !ruby/object:Gem::Version
|
|
61
89
|
version: '0'
|
|
62
|
-
type: :
|
|
90
|
+
type: :runtime
|
|
63
91
|
prerelease: false
|
|
64
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
93
|
requirements:
|
|
66
94
|
- - ">="
|
|
67
95
|
- !ruby/object:Gem::Version
|
|
68
96
|
version: '0'
|
|
69
|
-
description:
|
|
70
|
-
email:
|
|
71
97
|
executables: []
|
|
72
98
|
extensions: []
|
|
73
99
|
extra_rdoc_files: []
|
|
74
100
|
files:
|
|
75
101
|
- lib/async/bus.rb
|
|
76
102
|
- lib/async/bus/client.rb
|
|
103
|
+
- lib/async/bus/controller.rb
|
|
77
104
|
- lib/async/bus/protocol/connection.rb
|
|
105
|
+
- lib/async/bus/protocol/invoke.rb
|
|
78
106
|
- lib/async/bus/protocol/proxy.rb
|
|
107
|
+
- lib/async/bus/protocol/release.rb
|
|
108
|
+
- lib/async/bus/protocol/response.rb
|
|
79
109
|
- lib/async/bus/protocol/transaction.rb
|
|
80
110
|
- lib/async/bus/protocol/wrapper.rb
|
|
81
111
|
- lib/async/bus/server.rb
|
|
82
112
|
- lib/async/bus/version.rb
|
|
113
|
+
- license.md
|
|
114
|
+
- readme.md
|
|
115
|
+
- releases.md
|
|
83
116
|
homepage: https://github.com/socketry/async-bus
|
|
84
117
|
licenses:
|
|
85
118
|
- MIT
|
|
86
|
-
metadata:
|
|
87
|
-
|
|
119
|
+
metadata:
|
|
120
|
+
documentation_uri: https://socketry.github.io/async-bus/
|
|
121
|
+
source_code_uri: https://github.com/socketry/async-bus.git
|
|
88
122
|
rdoc_options: []
|
|
89
123
|
require_paths:
|
|
90
124
|
- lib
|
|
@@ -92,15 +126,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
92
126
|
requirements:
|
|
93
127
|
- - ">="
|
|
94
128
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '
|
|
129
|
+
version: '3.2'
|
|
96
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
131
|
requirements:
|
|
98
132
|
- - ">="
|
|
99
133
|
- !ruby/object:Gem::Version
|
|
100
134
|
version: '0'
|
|
101
135
|
requirements: []
|
|
102
|
-
rubygems_version: 3.
|
|
103
|
-
signing_key:
|
|
136
|
+
rubygems_version: 3.6.9
|
|
104
137
|
specification_version: 4
|
|
105
138
|
summary: Transparent Ruby IPC over an asynchronous message bus.
|
|
106
139
|
test_files: []
|
metadata.gz.sig
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
�9z3�a���E����c���0,@C`��% ��y�
|
|
2
|
+
T�K�B��w�Mm���>_s�1�O��v'�����ٓ��E+��r�)�j�]�=i&�<��=hd�A|��&��:8��- �y��g1'#*�,=1Z�2y3'��Zi�-���7Ę�"��|z��SR���L�ؖ4m�o��s^.ybkw������φ���(h8���KL�&��Nn��{�-�
|
|
3
|
+
q6G���FϸG��Μl]�(V������C+#R$�SEo~Xe�Kр���AU��e��Jp��� ۚ��/�hf�C�ۄ}1���?�uS��0�Xq��nv���7���AqЅTV�!l�A��/��>i[i��ٖ��� Z��݂�pd��
|