Module: ZMachine
- Defined in:
- lib/zmachine/deferrable.rb,
lib/zmachine.rb,
lib/zmachine/timers.rb,
lib/zmachine/channel.rb,
lib/zmachine/acceptor.rb,
lib/zmachine/connection.rb,
lib/zmachine/tcp_channel.rb,
lib/zmachine/zmq_channel.rb,
lib/zmachine/hashed_wheel.rb,
lib/zmachine/connection_manager.rb
Overview
–
- Author
-
Francis Cianfrocca (gmail: blackhedd)
- Homepage
-
rubyeventmachine.com
- Date
-
16 Jul 2006
See ZMachine and ZMachine::Connection for documentation and usage examples.
Copyright © 2006-07 by Francis Cianfrocca. All Rights Reserved. Gmail: blackhedd
This program is free software; you can redistribute it and/or modify it under the terms of either: 1) the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version; or 2) Ruby’s License.
See the file COPYING for complete licensing information.
Defined Under Namespace
Modules: Deferrable
Classes: Acceptor, Channel, Connection, ConnectionError, ConnectionManager, ConnectionNotBound, DefaultDeferrable, HashedWheel, HashedWheelTimeout, PeriodicTimer, TCPChannel, Timer, UnknownTimerFired, Unsupported, ZMQChannel
Class Attribute Summary collapse
Class Method Summary
collapse
-
._not_implemented ⇒ Object
-
.add_periodic_timer(*args, &block) ⇒ Object
-
.add_shutdown_hook(&block) ⇒ Object
-
.add_timer(*args, &block) ⇒ Object
-
.attach(io, handler = nil, *args, &blk) ⇒ Object
-
.bind_connect(bind_addr, bind_port, server, port = nil, handler = nil, *args) ⇒ Object
-
.Callback(object = nil, method = nil, &blk) ⇒ Object
-
.cancel_timer(timer_or_sig) ⇒ Object
-
.clear_current_reactor ⇒ Object
-
.close_connection(connection) ⇒ Object
-
.connect(server, port_or_type = nil, handler = nil, *args, &block) ⇒ Object
-
.connect_unix_domain(socketname, *args, &blk) ⇒ Object
-
.connection_count ⇒ Object
-
.context ⇒ Object
TODO: move to ZMQChannel.
-
.defer(op = nil, callback = nil, &blk) ⇒ Object
-
.defers_finished? ⇒ Boolean
-
.disable_proxy(from) ⇒ Object
-
.enable_proxy(from, to, bufsize = 0, length = 0) ⇒ Object
-
.error_handler(callback = nil, &block) ⇒ Object
-
.fork_reactor(&block) ⇒ Object
-
.get_max_timers ⇒ Object
-
.heartbeat_interval ⇒ Object
-
.heartbeat_interval=(time) ⇒ Object
-
.next_tick(callback = nil, &block) ⇒ Object
-
.open_datagram_socket(address, port, handler = nil, *args) ⇒ Object
-
.popen(cmd, handler = nil, *args) ⇒ Object
-
.reactor ⇒ Object
-
.reactor_running? ⇒ Boolean
-
.reactor_thread? ⇒ Boolean
-
.reconnect(server, port, handler) ⇒ Object
-
.run(callback = nil, shutdown_hook = nil, &block) ⇒ Object
-
.run_block(&block) ⇒ Object
-
.schedule(*a, &b) ⇒ Object
-
.set_descriptor_table_size(n_descriptors = nil) ⇒ Object
-
.set_effective_user(username) ⇒ Object
-
.set_max_timers(ct) ⇒ Object
-
.set_quantum(mills) ⇒ Object
-
.spawn(&block) ⇒ Object
-
.start_server(server, port_or_type = nil, handler = nil, *args, &block) ⇒ Object
-
.start_unix_domain_server(filename, *args, &block) ⇒ Object
-
.stop ⇒ Object
-
.stop_event_loop ⇒ Object
-
.stop_server(signature) ⇒ Object
-
.system(cmd, *args, &cb) ⇒ Object
-
.tick_loop(*a, &b) ⇒ Object
-
.watch(io, handler = nil, *args, &blk) ⇒ Object
-
.watch_file(filename, handler = nil, *args) ⇒ Object
-
.watch_process(pid, handler = nil, *args) ⇒ Object
Class Attribute Details
.debug ⇒ Object
Returns the value of attribute debug.
19
20
21
|
# File 'lib/zmachine.rb', line 19
def debug
@debug
end
|
.logger ⇒ Object
Returns the value of attribute logger.
18
19
20
|
# File 'lib/zmachine.rb', line 18
def logger
@logger
end
|
Class Method Details
._not_implemented ⇒ Object
35
36
37
|
# File 'lib/zmachine.rb', line 35
def self._not_implemented
raise RuntimeError.new("API call not implemented! #{caller[0]}")
end
|
.add_periodic_timer(*args, &block) ⇒ Object
39
40
41
42
43
|
# File 'lib/zmachine.rb', line 39
def self.add_periodic_timer(*args, &block)
interval = args.shift
callback = args.shift || block
PeriodicTimer.new(interval, callback)
end
|
.add_shutdown_hook(&block) ⇒ Object
45
46
47
|
# File 'lib/zmachine.rb', line 45
def self.add_shutdown_hook(&block)
reactor.add_shutdown_hook(&block)
end
|
.add_timer(*args, &block) ⇒ Object
49
50
51
|
# File 'lib/zmachine.rb', line 49
def self.add_timer(*args, &block)
reactor.add_timer(*args, &block)
end
|
.attach(io, handler = nil, *args, &blk) ⇒ Object
53
54
55
|
# File 'lib/zmachine.rb', line 53
def self.attach(io, handler = nil, *args, &blk)
_not_implemented
end
|
.bind_connect(bind_addr, bind_port, server, port = nil, handler = nil, *args) ⇒ Object
57
58
59
|
# File 'lib/zmachine.rb', line 57
def self.bind_connect(bind_addr, bind_port, server, port = nil, handler = nil, *args)
_not_implemented
end
|
.Callback(object = nil, method = nil, &blk) ⇒ Object
61
62
63
|
# File 'lib/zmachine.rb', line 61
def self.Callback(object = nil, method = nil, &blk)
_not_implemented
end
|
.cancel_timer(timer_or_sig) ⇒ Object
65
66
67
|
# File 'lib/zmachine.rb', line 65
def self.cancel_timer(timer_or_sig)
timer_or_sig.cancel end
|
.clear_current_reactor ⇒ Object
22
23
24
|
# File 'lib/zmachine.rb', line 22
def self.clear_current_reactor
Thread.current[:reactor] = nil
end
|
.close_connection(connection) ⇒ Object
69
70
71
|
# File 'lib/zmachine.rb', line 69
def self.close_connection(connection)
reactor.close_connection(connection)
end
|
.connect(server, port_or_type = nil, handler = nil, *args, &block) ⇒ Object
73
74
75
|
# File 'lib/zmachine.rb', line 73
def self.connect(server, port_or_type=nil, handler=nil, *args, &block)
reactor.connect(server, port_or_type, handler, *args, &block)
end
|
.connect_unix_domain(socketname, *args, &blk) ⇒ Object
77
78
79
|
# File 'lib/zmachine.rb', line 77
def self.connect_unix_domain(socketname, *args, &blk)
_not_implemented
end
|
.connection_count ⇒ Object
81
82
83
|
# File 'lib/zmachine.rb', line 81
def self.connection_count
reactor.connections.size
end
|
.context ⇒ Object
31
32
33
|
# File 'lib/zmachine.rb', line 31
def self.context
Thread.current[:context] ||= ZContext.new
end
|
.defer(op = nil, callback = nil, &blk) ⇒ Object
85
86
87
|
# File 'lib/zmachine.rb', line 85
def self.defer(op = nil, callback = nil, &blk)
_not_implemented
end
|
.defers_finished? ⇒ Boolean
89
90
91
|
# File 'lib/zmachine.rb', line 89
def self.defers_finished?
_not_implemented
end
|
.disable_proxy(from) ⇒ Object
93
94
95
|
# File 'lib/zmachine.rb', line 93
def self.disable_proxy(from)
_not_implemented
end
|
.enable_proxy(from, to, bufsize = 0, length = 0) ⇒ Object
97
98
99
|
# File 'lib/zmachine.rb', line 97
def self.enable_proxy(from, to, bufsize = 0, length = 0)
_not_implemented
end
|
.error_handler(callback = nil, &block) ⇒ Object
101
102
103
|
# File 'lib/zmachine.rb', line 101
def self.error_handler(callback = nil, &block)
_not_implemented
end
|
.fork_reactor(&block) ⇒ Object
105
106
107
|
# File 'lib/zmachine.rb', line 105
def self.fork_reactor(&block)
_not_implemented
end
|
.get_max_timers ⇒ Object
109
110
111
|
# File 'lib/zmachine.rb', line 109
def self.get_max_timers
_not_implemented
end
|
.heartbeat_interval ⇒ Object
113
114
115
|
# File 'lib/zmachine.rb', line 113
def self.heartbeat_interval
reactor.heartbeat_interval
end
|
.heartbeat_interval=(time) ⇒ Object
117
118
119
|
# File 'lib/zmachine.rb', line 117
def self.heartbeat_interval=(time)
reactor.heartbeat_interval = time
end
|
.next_tick(callback = nil, &block) ⇒ Object
121
122
123
|
# File 'lib/zmachine.rb', line 121
def self.next_tick(callback=nil, &block)
reactor.next_tick(callback, &block)
end
|
.open_datagram_socket(address, port, handler = nil, *args) ⇒ Object
125
126
127
|
# File 'lib/zmachine.rb', line 125
def self.open_datagram_socket(address, port, handler = nil, *args)
_not_implemented
end
|
.popen(cmd, handler = nil, *args) ⇒ Object
129
130
131
|
# File 'lib/zmachine.rb', line 129
def self.popen(cmd, handler = nil, *args)
_not_implemented
end
|
.reactor ⇒ Object
26
27
28
|
# File 'lib/zmachine.rb', line 26
def self.reactor
Thread.current[:reactor] ||= Reactor.new
end
|
.reactor_running? ⇒ Boolean
133
134
135
|
# File 'lib/zmachine.rb', line 133
def self.reactor_running?
reactor.running?
end
|
.reactor_thread? ⇒ Boolean
137
138
139
|
# File 'lib/zmachine.rb', line 137
def self.reactor_thread?
_not_implemented
end
|
.reconnect(server, port, handler) ⇒ Object
141
142
143
|
# File 'lib/zmachine.rb', line 141
def self.reconnect(server, port, handler)
reactor.reconnect(server, port, handler)
end
|
.run(callback = nil, shutdown_hook = nil, &block) ⇒ Object
145
146
147
|
# File 'lib/zmachine.rb', line 145
def self.run(callback=nil, shutdown_hook=nil, &block)
reactor.run(callback, shutdown_hook, &block)
end
|
.run_block(&block) ⇒ Object
149
150
151
152
153
154
155
|
# File 'lib/zmachine.rb', line 149
def self.run_block(&block)
pr = proc {
block.call
ZMachine::stop_event_loop
}
run(&pr)
end
|
.schedule(*a, &b) ⇒ Object
157
158
159
|
# File 'lib/zmachine.rb', line 157
def self.schedule(*a, &b)
_not_implemented
end
|
.set_descriptor_table_size(n_descriptors = nil) ⇒ Object
161
162
163
|
# File 'lib/zmachine.rb', line 161
def self.set_descriptor_table_size(n_descriptors = nil)
_not_implemented
end
|
.set_effective_user(username) ⇒ Object
165
166
167
|
# File 'lib/zmachine.rb', line 165
def self.set_effective_user(username)
_not_implemented
end
|
.set_max_timers(ct) ⇒ Object
169
170
171
|
# File 'lib/zmachine.rb', line 169
def self.set_max_timers(ct)
_not_implemented
end
|
.set_quantum(mills) ⇒ Object
173
174
175
|
# File 'lib/zmachine.rb', line 173
def self.set_quantum(mills)
_not_implemented
end
|
.spawn(&block) ⇒ Object
177
178
179
|
# File 'lib/zmachine.rb', line 177
def self.spawn(&block)
_not_implemented
end
|
.start_server(server, port_or_type = nil, handler = nil, *args, &block) ⇒ Object
181
182
183
|
# File 'lib/zmachine.rb', line 181
def self.start_server(server, port_or_type=nil, handler=nil, *args, &block)
reactor.bind(server, port_or_type, handler, *args, &block)
end
|
.start_unix_domain_server(filename, *args, &block) ⇒ Object
185
186
187
|
# File 'lib/zmachine.rb', line 185
def self.start_unix_domain_server(filename, *args, &block)
_not_implemented
end
|
.stop ⇒ Object
197
198
199
|
# File 'lib/zmachine.rb', line 197
def self.stop
Reactor.terminate_all_reactors
end
|
.stop_event_loop ⇒ Object
189
190
191
|
# File 'lib/zmachine.rb', line 189
def self.stop_event_loop
reactor.stop_event_loop
end
|
.stop_server(signature) ⇒ Object
193
194
195
|
# File 'lib/zmachine.rb', line 193
def self.stop_server(signature)
reactor.stop_server(signature)
end
|
.system(cmd, *args, &cb) ⇒ Object
201
202
203
|
# File 'lib/zmachine.rb', line 201
def self.system(cmd, *args, &cb)
_not_implemented
end
|
.tick_loop(*a, &b) ⇒ Object
205
206
207
|
# File 'lib/zmachine.rb', line 205
def self.tick_loop(*a, &b)
_not_implemented
end
|
.watch(io, handler = nil, *args, &blk) ⇒ Object
209
210
211
|
# File 'lib/zmachine.rb', line 209
def self.watch(io, handler = nil, *args, &blk)
_not_implemented
end
|
.watch_file(filename, handler = nil, *args) ⇒ Object
213
214
215
|
# File 'lib/zmachine.rb', line 213
def self.watch_file(filename, handler = nil, *args)
_not_implemented
end
|
.watch_process(pid, handler = nil, *args) ⇒ Object
217
218
219
|
# File 'lib/zmachine.rb', line 217
def self.watch_process(pid, handler = nil, *args)
_not_implemented
end
|