async-bus 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 354c43b3ef6922366c369eb209cede56b7bbca16d896b718ebfbe222eb7a4d97
4
+ data.tar.gz: 856c7c3cd32189b912d3115a3c218a1210215d4850391b18b7d0960be0686de9
5
+ SHA512:
6
+ metadata.gz: a38c42252effdbadbacd1d15da7d1e76f2632085430e3954668d0cef74b18404462b3c51ed6303598510679707c75d0bdbce7b1cc622a1abd2d70d126e5d457b
7
+ data.tar.gz: da3e7ccca7be7eb09180aa85d62412393056c36a38aee64b418feaef02dd244367f636c7d6a4bbb4a2a88b3aa993b7ab8447885c2c14b8dda25a47f13725c713
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
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.
22
+
23
+ require_relative 'protocol/connection'
24
+ require 'async/queue'
25
+
26
+ module Async
27
+ module Bus
28
+ class Client
29
+ def initialize(endpoint = nil)
30
+ @endpoint = endpoint || Protocol.local_endpoint
31
+ @queue = Async::Queue.new
32
+ end
33
+
34
+ def connect
35
+ @endpoint.connect do |peer|
36
+ connection = Protocol::Connection.client(peer)
37
+
38
+ connection_task = Async do
39
+ connection.run
40
+ end
41
+
42
+ return yield(connection)
43
+ ensure
44
+ connection_task&.stop
45
+ end
46
+ end
47
+
48
+ protected
49
+
50
+ def handle(connection, message)
51
+ # No default implementation.
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,61 @@
1
+ # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative 'proxy'
22
+
23
+ module Async
24
+ module Bus
25
+ class Local
26
+ def initialize
27
+ @instances = {}
28
+ end
29
+
30
+ def close
31
+ @instances.clear
32
+ end
33
+
34
+ def []= name, instance
35
+ @instances[name] = instance
36
+
37
+ Proxy.new(self, name, instance)
38
+ end
39
+
40
+ def [] name
41
+ Proxy.new(self, name, @instances[name])
42
+ end
43
+
44
+ class Proxy < Bus::Proxy
45
+ def initialize(name, bus, instance)
46
+ super(name, bus)
47
+
48
+ @instance = instance
49
+ end
50
+
51
+ def method_missing(name, *args, &block)
52
+ @instance.send(name, *args, &block)
53
+ end
54
+
55
+ def respond_to?(*args)
56
+ @instance.respond_to?(*args)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,139 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
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.
22
+
23
+ require 'async'
24
+ require 'async/io/unix_endpoint'
25
+
26
+ require_relative 'wrapper'
27
+ require_relative 'transaction'
28
+ require_relative 'proxy'
29
+
30
+ module Async
31
+ module Bus
32
+ module Protocol
33
+ def self.local_endpoint(path = "bus.ipc")
34
+ Async::IO::Endpoint.unix(path)
35
+ end
36
+
37
+ class Connection
38
+ def self.client(peer)
39
+ self.new(peer, 1)
40
+ end
41
+
42
+ def self.server(peer)
43
+ self.new(peer, 2)
44
+ end
45
+
46
+ def initialize(peer, id)
47
+ @peer = peer
48
+
49
+ @wrapper = Wrapper.new(self)
50
+ @unpacker = @wrapper.unpacker(peer)
51
+ @packer = @wrapper.packer(peer)
52
+
53
+ @transactions = {}
54
+ @id = id
55
+
56
+ @objects = {}
57
+ end
58
+
59
+ attr :unpacker
60
+ attr :packer
61
+
62
+ def next_id
63
+ id = @id
64
+ @id += 2
65
+
66
+ return id
67
+ end
68
+
69
+ attr :transactions
70
+
71
+ def proxy(object)
72
+ name = "proxy:#{object_id}"
73
+
74
+ bind(name, object)
75
+
76
+ return name
77
+ end
78
+
79
+ def bind(name, object)
80
+ @objects[name] = object
81
+ end
82
+
83
+ def [](name)
84
+ Proxy.new(self, name)
85
+ end
86
+
87
+ def invoke(name, arguments, options, &block)
88
+ id = self.next_id
89
+
90
+ transaction = Transaction.new(self, id)
91
+ @transactions[id] = transaction
92
+
93
+ transaction.invoke(name, arguments, options, &block)
94
+ end
95
+
96
+ def run
97
+ # @unpacker.each do |message|
98
+ @unpacker.each do |message|
99
+ id = message.shift
100
+
101
+ if transaction = @transactions[id]
102
+ transaction.received.enqueue(message)
103
+ elsif message.first == :invoke
104
+ message.shift
105
+
106
+ transaction = Transaction.new(self, id)
107
+ @transactions[id] = transaction
108
+
109
+ name = message.shift
110
+ object = @objects[name]
111
+
112
+ Async do
113
+ transaction.accept(object, *message)
114
+ ensure
115
+ transaction.close
116
+ end
117
+ else
118
+ raise "Out of order message: #{message}"
119
+ end
120
+ end
121
+ ensure
122
+ @transactions.each do |id, transaction|
123
+ transaction.close
124
+ end
125
+
126
+ @transactions.clear
127
+ end
128
+
129
+ def close
130
+ @transactions.each do |id, transaction|
131
+ transaction.close
132
+ end
133
+
134
+ @peer.close
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
@@ -0,0 +1,44 @@
1
+ # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ module Async
22
+ module Bus
23
+ module Protocol
24
+ class Proxy < BasicObject
25
+ def initialize(bus, name)
26
+ @bus = bus
27
+ @name = name
28
+ end
29
+
30
+ def inspect
31
+ "[Proxy #{method_missing(:inspect)}]"
32
+ end
33
+
34
+ def method_missing(*arguments, **options, &block)
35
+ @bus.invoke(@name, arguments, options, &block)
36
+ end
37
+
38
+ def respond_to?(name, include_all = false)
39
+ @bus.invoke(@name, [:respond_to?, name, include_all])
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,119 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
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.
22
+
23
+ require 'async/queue'
24
+
25
+ module Async
26
+ module Bus
27
+ module Protocol
28
+ class Transaction
29
+ def initialize(connection, id)
30
+ @connection = connection
31
+ @id = id
32
+
33
+ @received = Async::Queue.new
34
+ @accept = nil
35
+ end
36
+
37
+ attr :id
38
+ attr :received
39
+
40
+ def read
41
+ if @received.empty?
42
+ @connection.packer.flush
43
+ end
44
+
45
+ @received.dequeue
46
+ end
47
+
48
+ def write(*arguments)
49
+ @connection.packer.write([id, *arguments])
50
+ @connection.packer.flush
51
+ end
52
+
53
+ def close
54
+ if @connection
55
+ connection = @connection
56
+ @connection = nil
57
+
58
+ connection.transactions.delete(@id)
59
+ end
60
+ end
61
+
62
+ # Invoke a remote procedure.
63
+ def invoke(name, arguments, options, &block)
64
+ self.write(:invoke, name, arguments, options, block_given?)
65
+
66
+ while response = self.read
67
+ what, result = response
68
+
69
+ case what
70
+ when :error
71
+ raise(result)
72
+ when :return
73
+ return(result)
74
+ when :yield
75
+ begin
76
+ result = yield(*result)
77
+ self.write(:next, result)
78
+ rescue => error
79
+ self.write(:error, error)
80
+ end
81
+ end
82
+ end
83
+
84
+ # ensure
85
+ # self.write(:close)
86
+ end
87
+
88
+ # Accept a remote procedure invokation.
89
+ def accept(object, arguments, options, block)
90
+ if block
91
+ result = object.public_send(*arguments, **options) do |*yield_arguments|
92
+ self.write(:yield, yield_arguments)
93
+ what, result = self.read
94
+
95
+ case what
96
+ when :next
97
+ result
98
+ when :close
99
+ return
100
+ when :error
101
+ raise(result)
102
+ end
103
+ end
104
+ else
105
+ result = object.public_send(*arguments, **options)
106
+ end
107
+
108
+ self.write(:return, result)
109
+ rescue UncaughtThrowError => error
110
+ self.write(:throw, error.tag)
111
+ rescue => error
112
+ self.write(:error, error)
113
+ # ensure
114
+ # self.write(:close)
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
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.
22
+
23
+ require 'msgpack'
24
+
25
+ module Async
26
+ module Bus
27
+ module Protocol
28
+ class Wrapper < MessagePack::Factory
29
+ def initialize(bus)
30
+ super()
31
+
32
+ @bus = bus
33
+
34
+ self.register_type(0x00, Object,
35
+ packer: @bus.method(:proxy),
36
+ unpacker: @bus.method(:[])
37
+ )
38
+
39
+ self.register_type(0x01, Symbol)
40
+ self.register_type(0x02, Exception,
41
+ packer: ->(exception){Marshal.dump(exception)},
42
+ unpacker: ->(data){Marshal.load(data)},
43
+ )
44
+
45
+ self.register_type(0x03, Class,
46
+ packer: ->(klass){Marshal.dump(klass)},
47
+ unpacker: ->(data){Marshal.load(data)},
48
+ )
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,69 @@
1
+ # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative 'proxy'
22
+
23
+ module Async
24
+ module Bus
25
+ class Remote
26
+ def initialize(connection)
27
+ @connection = connection
28
+ end
29
+
30
+ def close
31
+ @instances.clear
32
+ end
33
+
34
+ def []= name, instance
35
+ @instances[name] = instance
36
+
37
+ @connection.
38
+
39
+ Proxy.new(self, name, instance)
40
+ end
41
+
42
+ def [] name
43
+ Proxy.new(self, name, @instances[name])
44
+ end
45
+
46
+ def invoke(name, *arguments, **options, &block)
47
+ @connection.invoke(name, arguments, options, block_given?) do |transaction|
48
+ while response = transaction.read
49
+ what, *arguments = response
50
+
51
+ case what
52
+ when :error
53
+ raise(*arguments)
54
+ when :return
55
+ return(*arguments)
56
+ when :yield
57
+ begin
58
+ result = yield(*arguments)
59
+ transaction.write(:next, result)
60
+ rescue => error
61
+ transaction.write(:error, error)
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2020, by Samuel G. D. Williams. <http://www.codeotaku.com>
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.
22
+
23
+ require_relative 'protocol/connection'
24
+ require 'set'
25
+
26
+ module Async
27
+ module Bus
28
+ class Server
29
+ def initialize(endpoint = nil)
30
+ @endpoint = endpoint || Protocol.local_endpoint
31
+ @connected = {}
32
+
33
+ @context = {}
34
+ end
35
+
36
+ attr :connected
37
+
38
+ def accept
39
+ @endpoint.accept do |peer|
40
+ connection = Protocol::Connection.server(peer)
41
+ @connected[peer] = connection
42
+
43
+ yield connection
44
+ connection.run
45
+ ensure
46
+ connection = @connected.delete(peer)
47
+ connection&.close
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
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.
22
+
23
+ module Async
24
+ module Bus
25
+ VERSION = "0.1.0"
26
+ end
27
+ end
data/lib/async/bus.rb ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
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.
22
+
23
+ require_relative "bus/version"
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: async-bus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Samuel Williams
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-08-30 00:00:00.000000000 Z
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: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: msgpack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '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'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: async-rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ executables: []
72
+ extensions: []
73
+ extra_rdoc_files: []
74
+ files:
75
+ - lib/async/bus.rb
76
+ - lib/async/bus/client.rb
77
+ - lib/async/bus/local.rb
78
+ - lib/async/bus/protocol/connection.rb
79
+ - lib/async/bus/protocol/proxy.rb
80
+ - lib/async/bus/protocol/transaction.rb
81
+ - lib/async/bus/protocol/wrapper.rb
82
+ - lib/async/bus/remote.rb
83
+ - lib/async/bus/server.rb
84
+ - lib/async/bus/version.rb
85
+ homepage: https://github.com/socketry/async-bus
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubygems_version: 3.2.22
105
+ signing_key:
106
+ specification_version: 4
107
+ summary: Transparent Ruby IPC over an asynchronous message bus.
108
+ test_files: []