omq 0.12.0 → 0.14.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +84 -1
  3. data/README.md +27 -0
  4. data/lib/omq/drop_queue.rb +3 -0
  5. data/lib/omq/engine/connection_setup.rb +70 -0
  6. data/lib/omq/engine/heartbeat.rb +40 -0
  7. data/lib/omq/engine/maintenance.rb +35 -0
  8. data/lib/omq/engine/reconnect.rb +82 -0
  9. data/lib/omq/engine/recv_pump.rb +119 -0
  10. data/lib/omq/engine.rb +139 -304
  11. data/lib/omq/options.rb +44 -0
  12. data/lib/omq/pair.rb +6 -0
  13. data/lib/omq/pub_sub.rb +25 -0
  14. data/lib/omq/push_pull.rb +17 -0
  15. data/lib/omq/queue_interface.rb +1 -0
  16. data/lib/omq/readable.rb +2 -0
  17. data/lib/omq/req_rep.rb +13 -0
  18. data/lib/omq/router_dealer.rb +12 -0
  19. data/lib/omq/routing/conn_send_pump.rb +36 -0
  20. data/lib/omq/routing/dealer.rb +15 -10
  21. data/lib/omq/routing/fair_queue.rb +172 -0
  22. data/lib/omq/routing/fair_recv.rb +27 -0
  23. data/lib/omq/routing/fan_out.rb +127 -74
  24. data/lib/omq/routing/pair.rb +47 -20
  25. data/lib/omq/routing/pub.rb +12 -6
  26. data/lib/omq/routing/pull.rb +12 -4
  27. data/lib/omq/routing/push.rb +3 -12
  28. data/lib/omq/routing/rep.rb +41 -51
  29. data/lib/omq/routing/req.rb +15 -10
  30. data/lib/omq/routing/round_robin.rb +82 -63
  31. data/lib/omq/routing/router.rb +32 -48
  32. data/lib/omq/routing/sub.rb +18 -5
  33. data/lib/omq/routing/xpub.rb +15 -3
  34. data/lib/omq/routing/xsub.rb +53 -27
  35. data/lib/omq/routing.rb +29 -11
  36. data/lib/omq/socket.rb +25 -7
  37. data/lib/omq/transport/inproc/direct_pipe.rb +173 -0
  38. data/lib/omq/transport/inproc.rb +41 -217
  39. data/lib/omq/transport/ipc.rb +7 -1
  40. data/lib/omq/transport/tcp.rb +12 -7
  41. data/lib/omq/version.rb +1 -1
  42. data/lib/omq/writable.rb +2 -0
  43. data/lib/omq.rb +4 -1
  44. metadata +14 -5
@@ -37,12 +37,7 @@ module OMQ
37
37
  Listener.new(resolved, servers, actual_port)
38
38
  end
39
39
 
40
- # Connects to a TCP endpoint.
41
- #
42
- # @param endpoint [String] e.g. "tcp://127.0.0.1:5555"
43
- # @param engine [Engine]
44
- # @return [void]
45
- #
40
+
46
41
  # Validates that the endpoint's host can be resolved.
47
42
  #
48
43
  # @param endpoint [String]
@@ -54,12 +49,19 @@ module OMQ
54
49
  end
55
50
 
56
51
 
52
+ # Connects to a TCP endpoint.
53
+ #
54
+ # @param endpoint [String] e.g. "tcp://127.0.0.1:5555"
55
+ # @param engine [Engine]
56
+ # @return [void]
57
+ #
57
58
  def connect(endpoint, engine)
58
59
  host, port = self.parse_endpoint(endpoint)
59
60
  sock = TCPSocket.new(host, port)
60
61
  engine.handle_connected(IO::Stream::Buffered.wrap(sock), endpoint: endpoint)
61
62
  end
62
63
 
64
+
63
65
  # Parses a TCP endpoint URI into host and port.
64
66
  #
65
67
  # @param endpoint [String]
@@ -71,6 +73,7 @@ module OMQ
71
73
  end
72
74
  end
73
75
 
76
+
74
77
  # A bound TCP listener.
75
78
  #
76
79
  class Listener
@@ -122,7 +125,9 @@ module OMQ
122
125
  end
123
126
 
124
127
 
125
- # Stops the listener.
128
+ # Stops the listener and closes all server sockets.
129
+ #
130
+ # @return [void]
126
131
  #
127
132
  def stop
128
133
  @tasks.each(&:stop)
data/lib/omq/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OMQ
4
- VERSION = "0.12.0"
4
+ VERSION = "0.14.0"
5
5
  end
data/lib/omq/writable.rb CHANGED
@@ -19,6 +19,7 @@ module OMQ
19
19
  self
20
20
  end
21
21
 
22
+
22
23
  # Sends a message (chainable).
23
24
  #
24
25
  # @param message [String, Array<String>]
@@ -46,6 +47,7 @@ module OMQ
46
47
  parts.freeze
47
48
  end
48
49
 
50
+
49
51
  def frozen_binary(str)
50
52
  s = str.to_str
51
53
  return s if s.frozen? && s.encoding == Encoding::BINARY
data/lib/omq.rb CHANGED
@@ -16,7 +16,9 @@ module OMQ
16
16
  # Raised when an internal pump task crashes unexpectedly.
17
17
  # The socket is no longer usable; the original error is available via #cause.
18
18
  #
19
- class SocketDeadError < RuntimeError; end
19
+ class SocketDeadError < RuntimeError
20
+ end
21
+
20
22
 
21
23
  # Errors raised when a peer disconnects or resets the connection.
22
24
  # Not frozen at load time — transport plugins append to this before
@@ -42,6 +44,7 @@ module OMQ
42
44
  ]
43
45
  end
44
46
 
47
+
45
48
  # Transport
46
49
  require_relative "omq/transport/inproc"
47
50
  require_relative "omq/transport/tcp"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Wenger
@@ -13,16 +13,16 @@ dependencies:
13
13
  name: protocol-zmtp
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - ">="
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: '0'
18
+ version: '0.3'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
- - - ">="
23
+ - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: '0'
25
+ version: '0.3'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: async
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -67,6 +67,11 @@ files:
67
67
  - lib/omq.rb
68
68
  - lib/omq/drop_queue.rb
69
69
  - lib/omq/engine.rb
70
+ - lib/omq/engine/connection_setup.rb
71
+ - lib/omq/engine/heartbeat.rb
72
+ - lib/omq/engine/maintenance.rb
73
+ - lib/omq/engine/reconnect.rb
74
+ - lib/omq/engine/recv_pump.rb
70
75
  - lib/omq/monitor_event.rb
71
76
  - lib/omq/options.rb
72
77
  - lib/omq/pair.rb
@@ -78,7 +83,10 @@ files:
78
83
  - lib/omq/req_rep.rb
79
84
  - lib/omq/router_dealer.rb
80
85
  - lib/omq/routing.rb
86
+ - lib/omq/routing/conn_send_pump.rb
81
87
  - lib/omq/routing/dealer.rb
88
+ - lib/omq/routing/fair_queue.rb
89
+ - lib/omq/routing/fair_recv.rb
82
90
  - lib/omq/routing/fan_out.rb
83
91
  - lib/omq/routing/pair.rb
84
92
  - lib/omq/routing/pub.rb
@@ -93,6 +101,7 @@ files:
93
101
  - lib/omq/routing/xsub.rb
94
102
  - lib/omq/socket.rb
95
103
  - lib/omq/transport/inproc.rb
104
+ - lib/omq/transport/inproc/direct_pipe.rb
96
105
  - lib/omq/transport/ipc.rb
97
106
  - lib/omq/transport/tcp.rb
98
107
  - lib/omq/version.rb