sidekick-client 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. data/VERSION +1 -1
  2. data/lib/sidekick/client/sidekick_client.rb +0 -3
  3. data/lib/sidekick/shared/sidekick_queue_publisher.rb +1 -1
  4. data/sidekick-client.gemspec +1 -158
  5. metadata +1 -158
  6. data/lib/ext/eventmachine-0.12.10/.gitignore +0 -14
  7. data/lib/ext/eventmachine-0.12.10/README +0 -82
  8. data/lib/ext/eventmachine-0.12.10/Rakefile +0 -374
  9. data/lib/ext/eventmachine-0.12.10/docs/COPYING +0 -60
  10. data/lib/ext/eventmachine-0.12.10/docs/ChangeLog +0 -211
  11. data/lib/ext/eventmachine-0.12.10/docs/DEFERRABLES +0 -133
  12. data/lib/ext/eventmachine-0.12.10/docs/EPOLL +0 -141
  13. data/lib/ext/eventmachine-0.12.10/docs/GNU +0 -281
  14. data/lib/ext/eventmachine-0.12.10/docs/INSTALL +0 -13
  15. data/lib/ext/eventmachine-0.12.10/docs/KEYBOARD +0 -38
  16. data/lib/ext/eventmachine-0.12.10/docs/LEGAL +0 -25
  17. data/lib/ext/eventmachine-0.12.10/docs/LIGHTWEIGHT_CONCURRENCY +0 -70
  18. data/lib/ext/eventmachine-0.12.10/docs/PURE_RUBY +0 -75
  19. data/lib/ext/eventmachine-0.12.10/docs/RELEASE_NOTES +0 -94
  20. data/lib/ext/eventmachine-0.12.10/docs/SMTP +0 -2
  21. data/lib/ext/eventmachine-0.12.10/docs/SPAWNED_PROCESSES +0 -89
  22. data/lib/ext/eventmachine-0.12.10/docs/TODO +0 -8
  23. data/lib/ext/eventmachine-0.12.10/eventmachine.gemspec +0 -40
  24. data/lib/ext/eventmachine-0.12.10/examples/ex_channel.rb +0 -43
  25. data/lib/ext/eventmachine-0.12.10/examples/ex_queue.rb +0 -2
  26. data/lib/ext/eventmachine-0.12.10/examples/helper.rb +0 -2
  27. data/lib/ext/eventmachine-0.12.10/ext/binder.cpp +0 -125
  28. data/lib/ext/eventmachine-0.12.10/ext/binder.h +0 -46
  29. data/lib/ext/eventmachine-0.12.10/ext/cmain.cpp +0 -827
  30. data/lib/ext/eventmachine-0.12.10/ext/cplusplus.cpp +0 -202
  31. data/lib/ext/eventmachine-0.12.10/ext/ed.cpp +0 -1893
  32. data/lib/ext/eventmachine-0.12.10/ext/ed.h +0 -424
  33. data/lib/ext/eventmachine-0.12.10/ext/em.cpp +0 -2282
  34. data/lib/ext/eventmachine-0.12.10/ext/em.h +0 -232
  35. data/lib/ext/eventmachine-0.12.10/ext/emwin.cpp +0 -300
  36. data/lib/ext/eventmachine-0.12.10/ext/emwin.h +0 -94
  37. data/lib/ext/eventmachine-0.12.10/ext/epoll.cpp +0 -26
  38. data/lib/ext/eventmachine-0.12.10/ext/epoll.h +0 -25
  39. data/lib/ext/eventmachine-0.12.10/ext/eventmachine.h +0 -122
  40. data/lib/ext/eventmachine-0.12.10/ext/eventmachine_cpp.h +0 -96
  41. data/lib/ext/eventmachine-0.12.10/ext/extconf.rb +0 -148
  42. data/lib/ext/eventmachine-0.12.10/ext/fastfilereader/extconf.rb +0 -83
  43. data/lib/ext/eventmachine-0.12.10/ext/fastfilereader/mapper.cpp +0 -214
  44. data/lib/ext/eventmachine-0.12.10/ext/fastfilereader/mapper.h +0 -59
  45. data/lib/ext/eventmachine-0.12.10/ext/fastfilereader/rubymain.cpp +0 -127
  46. data/lib/ext/eventmachine-0.12.10/ext/files.cpp +0 -94
  47. data/lib/ext/eventmachine-0.12.10/ext/files.h +0 -65
  48. data/lib/ext/eventmachine-0.12.10/ext/kb.cpp +0 -81
  49. data/lib/ext/eventmachine-0.12.10/ext/page.cpp +0 -107
  50. data/lib/ext/eventmachine-0.12.10/ext/page.h +0 -51
  51. data/lib/ext/eventmachine-0.12.10/ext/pipe.cpp +0 -349
  52. data/lib/ext/eventmachine-0.12.10/ext/project.h +0 -151
  53. data/lib/ext/eventmachine-0.12.10/ext/rubymain.cpp +0 -1166
  54. data/lib/ext/eventmachine-0.12.10/ext/sigs.cpp +0 -89
  55. data/lib/ext/eventmachine-0.12.10/ext/sigs.h +0 -32
  56. data/lib/ext/eventmachine-0.12.10/ext/ssl.cpp +0 -460
  57. data/lib/ext/eventmachine-0.12.10/ext/ssl.h +0 -94
  58. data/lib/ext/eventmachine-0.12.10/java/.classpath +0 -8
  59. data/lib/ext/eventmachine-0.12.10/java/.project +0 -17
  60. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/EmReactor.java +0 -570
  61. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/EmReactorException.java +0 -40
  62. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/EventableChannel.java +0 -69
  63. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/EventableDatagramChannel.java +0 -189
  64. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/EventableSocketChannel.java +0 -364
  65. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/Application.java +0 -194
  66. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/Connection.java +0 -74
  67. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/ConnectionFactory.java +0 -37
  68. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/DefaultConnectionFactory.java +0 -46
  69. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/PeriodicTimer.java +0 -38
  70. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/application/Timer.java +0 -54
  71. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/ApplicationTest.java +0 -109
  72. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/ConnectTest.java +0 -148
  73. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/EMTest.java +0 -80
  74. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/TestDatagrams.java +0 -53
  75. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/TestServers.java +0 -75
  76. data/lib/ext/eventmachine-0.12.10/java/src/com/rubyeventmachine/tests/TestTimers.java +0 -90
  77. data/lib/ext/eventmachine-0.12.10/lib/em/buftok.rb +0 -138
  78. data/lib/ext/eventmachine-0.12.10/lib/em/callback.rb +0 -26
  79. data/lib/ext/eventmachine-0.12.10/lib/em/channel.rb +0 -57
  80. data/lib/ext/eventmachine-0.12.10/lib/em/connection.rb +0 -564
  81. data/lib/ext/eventmachine-0.12.10/lib/em/deferrable.rb +0 -192
  82. data/lib/ext/eventmachine-0.12.10/lib/em/file_watch.rb +0 -54
  83. data/lib/ext/eventmachine-0.12.10/lib/em/future.rb +0 -61
  84. data/lib/ext/eventmachine-0.12.10/lib/em/messages.rb +0 -66
  85. data/lib/ext/eventmachine-0.12.10/lib/em/process_watch.rb +0 -44
  86. data/lib/ext/eventmachine-0.12.10/lib/em/processes.rb +0 -119
  87. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/header_and_content.rb +0 -138
  88. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/httpclient.rb +0 -263
  89. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/httpclient2.rb +0 -590
  90. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/line_and_text.rb +0 -125
  91. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/linetext2.rb +0 -161
  92. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/memcache.rb +0 -323
  93. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/object_protocol.rb +0 -45
  94. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/postgres3.rb +0 -247
  95. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/saslauth.rb +0 -175
  96. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/smtpclient.rb +0 -357
  97. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/smtpserver.rb +0 -547
  98. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/socks4.rb +0 -66
  99. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/stomp.rb +0 -200
  100. data/lib/ext/eventmachine-0.12.10/lib/em/protocols/tcptest.rb +0 -53
  101. data/lib/ext/eventmachine-0.12.10/lib/em/protocols.rb +0 -36
  102. data/lib/ext/eventmachine-0.12.10/lib/em/queue.rb +0 -61
  103. data/lib/ext/eventmachine-0.12.10/lib/em/spawnable.rb +0 -85
  104. data/lib/ext/eventmachine-0.12.10/lib/em/streamer.rb +0 -130
  105. data/lib/ext/eventmachine-0.12.10/lib/em/timers.rb +0 -56
  106. data/lib/ext/eventmachine-0.12.10/lib/em/version.rb +0 -3
  107. data/lib/ext/eventmachine-0.12.10/lib/eventmachine.rb +0 -1592
  108. data/lib/ext/eventmachine-0.12.10/lib/evma/callback.rb +0 -32
  109. data/lib/ext/eventmachine-0.12.10/lib/evma/container.rb +0 -75
  110. data/lib/ext/eventmachine-0.12.10/lib/evma/factory.rb +0 -77
  111. data/lib/ext/eventmachine-0.12.10/lib/evma/protocol.rb +0 -87
  112. data/lib/ext/eventmachine-0.12.10/lib/evma/reactor.rb +0 -48
  113. data/lib/ext/eventmachine-0.12.10/lib/evma.rb +0 -32
  114. data/lib/ext/eventmachine-0.12.10/lib/jeventmachine.rb +0 -257
  115. data/lib/ext/eventmachine-0.12.10/lib/pr_eventmachine.rb +0 -1022
  116. data/lib/ext/eventmachine-0.12.10/setup.rb +0 -1585
  117. data/lib/ext/eventmachine-0.12.10/tasks/cpp.rake_example +0 -77
  118. data/lib/ext/eventmachine-0.12.10/tests/client.crt +0 -31
  119. data/lib/ext/eventmachine-0.12.10/tests/client.key +0 -51
  120. data/lib/ext/eventmachine-0.12.10/tests/test_attach.rb +0 -126
  121. data/lib/ext/eventmachine-0.12.10/tests/test_basic.rb +0 -284
  122. data/lib/ext/eventmachine-0.12.10/tests/test_channel.rb +0 -63
  123. data/lib/ext/eventmachine-0.12.10/tests/test_connection_count.rb +0 -35
  124. data/lib/ext/eventmachine-0.12.10/tests/test_defer.rb +0 -47
  125. data/lib/ext/eventmachine-0.12.10/tests/test_epoll.rb +0 -160
  126. data/lib/ext/eventmachine-0.12.10/tests/test_error_handler.rb +0 -35
  127. data/lib/ext/eventmachine-0.12.10/tests/test_errors.rb +0 -82
  128. data/lib/ext/eventmachine-0.12.10/tests/test_exc.rb +0 -55
  129. data/lib/ext/eventmachine-0.12.10/tests/test_file_watch.rb +0 -49
  130. data/lib/ext/eventmachine-0.12.10/tests/test_futures.rb +0 -198
  131. data/lib/ext/eventmachine-0.12.10/tests/test_get_sock_opt.rb +0 -30
  132. data/lib/ext/eventmachine-0.12.10/tests/test_handler_check.rb +0 -37
  133. data/lib/ext/eventmachine-0.12.10/tests/test_hc.rb +0 -218
  134. data/lib/ext/eventmachine-0.12.10/tests/test_httpclient.rb +0 -218
  135. data/lib/ext/eventmachine-0.12.10/tests/test_httpclient2.rb +0 -153
  136. data/lib/ext/eventmachine-0.12.10/tests/test_inactivity_timeout.rb +0 -50
  137. data/lib/ext/eventmachine-0.12.10/tests/test_kb.rb +0 -60
  138. data/lib/ext/eventmachine-0.12.10/tests/test_ltp.rb +0 -182
  139. data/lib/ext/eventmachine-0.12.10/tests/test_ltp2.rb +0 -317
  140. data/lib/ext/eventmachine-0.12.10/tests/test_next_tick.rb +0 -133
  141. data/lib/ext/eventmachine-0.12.10/tests/test_object_protocol.rb +0 -37
  142. data/lib/ext/eventmachine-0.12.10/tests/test_pause.rb +0 -70
  143. data/lib/ext/eventmachine-0.12.10/tests/test_pending_connect_timeout.rb +0 -48
  144. data/lib/ext/eventmachine-0.12.10/tests/test_process_watch.rb +0 -48
  145. data/lib/ext/eventmachine-0.12.10/tests/test_processes.rb +0 -128
  146. data/lib/ext/eventmachine-0.12.10/tests/test_proxy_connection.rb +0 -92
  147. data/lib/ext/eventmachine-0.12.10/tests/test_pure.rb +0 -125
  148. data/lib/ext/eventmachine-0.12.10/tests/test_queue.rb +0 -44
  149. data/lib/ext/eventmachine-0.12.10/tests/test_running.rb +0 -42
  150. data/lib/ext/eventmachine-0.12.10/tests/test_sasl.rb +0 -72
  151. data/lib/ext/eventmachine-0.12.10/tests/test_send_file.rb +0 -242
  152. data/lib/ext/eventmachine-0.12.10/tests/test_servers.rb +0 -76
  153. data/lib/ext/eventmachine-0.12.10/tests/test_smtpclient.rb +0 -83
  154. data/lib/ext/eventmachine-0.12.10/tests/test_smtpserver.rb +0 -85
  155. data/lib/ext/eventmachine-0.12.10/tests/test_spawn.rb +0 -322
  156. data/lib/ext/eventmachine-0.12.10/tests/test_ssl_args.rb +0 -79
  157. data/lib/ext/eventmachine-0.12.10/tests/test_ssl_methods.rb +0 -50
  158. data/lib/ext/eventmachine-0.12.10/tests/test_ssl_verify.rb +0 -82
  159. data/lib/ext/eventmachine-0.12.10/tests/test_timers.rb +0 -162
  160. data/lib/ext/eventmachine-0.12.10/tests/test_ud.rb +0 -36
  161. data/lib/ext/eventmachine-0.12.10/tests/testem.rb +0 -31
  162. data/lib/ext/eventmachine-0.12.10/web/whatis +0 -7
@@ -1,70 +0,0 @@
1
- EventMachine (EM) adds two different formalisms for lightweight concurrency to the Ruby programmer's toolbox: spawned processes and deferrables. This note will show you how to use them.
2
-
3
-
4
- === What is Lightweight Concurrency?
5
-
6
- We use the term "Lightweight Concurrency" (LC) to refer to concurrency mechanisms that are lighter than Ruby threads. By "lighter," we mean: less resource-intensive in one or more dimensions, usually including memory and CPU usage. In general, you turn to LC in the hope of improving the performance and scalability of your programs.
7
-
8
- In addition to the two EventMachine mechanisms we will discuss here, Ruby has at least one other LC construct: Fibers, which are currently under development in Ruby 1.9.
9
-
10
- The technical feature that makes all of these LC mechanisms different from standard Ruby threads is that they are not scheduled automatically.
11
-
12
- When you create and run Ruby threads, you can assume (within certain constraints) that your threads will all be scheduled fairly by Ruby's runtime. Ruby itself is responsible for giving each of your threads its own share of the total runtime.
13
-
14
- But with LC, your program is responsible for causing different execution paths to run. In effect, your program has to act as a "thread scheduler." Scheduled entities in LC run to completion and are never preempted. The runtime system has far less work to do since it has no need to interrupt threads or to schedule them fairly. This is what makes LC lighter and faster.
15
-
16
- You'll learn exactly how LC scheduling works in practice as we work through specific examples.
17
-
18
-
19
- === EventMachine Lightweight Concurrency
20
-
21
- Recall that EM provides a reactor loop that must be running in order for your programs to perform event-driven logic. An EM program typically has a structure like this:
22
-
23
- require 'eventmachine'
24
-
25
- # your initializations
26
-
27
- EM.run {
28
- # perform event-driven I/O here, including network clients,
29
- # servers, timers, and thread-pool operations.
30
- }
31
-
32
- # your cleanup
33
- # end of the program
34
-
35
-
36
- EventMachine#run executes the reactor loop, which causes your code to be called as events of interest to your program occur. The block you pass to EventMachine#run is executed right after the reactor loop starts, and is the right place to start socket acceptors, etc.
37
-
38
- Because the reactor loop runs constantly in an EM program (until it is stopped by a call to EventMachine#stop), it has the ability to schedule blocks of code for asynchronous execution. Unlike a pre-emptive thread scheduler, it's NOT able to interrupt code blocks while they execute. But the scheduling capability it does have is enough to enable lightweight concurrency.
39
-
40
-
41
- For information on Spawned Processes, see the separate document SPAWNED_PROCESSES.
42
-
43
- For information on Deferrables, see the separate document DEFERRABLES.
44
-
45
-
46
- === [SIDEBAR]: I Heard That EventMachine Doesn't Work With Ruby Threads.
47
-
48
- This is incorrect. EM is fully interoperable with all versions of Ruby threads, and has been since its earliest releases.
49
-
50
- It's very true that EM encourages an "evented" (non-threaded) programming style. The specific benefits of event-driven programming are far better performance and scalabiity for well-written programs, and far easier debugging.
51
-
52
- The benefit of using threads for similar applications is a possibly more intuitive programming model, as well as the fact that threads are already familiar to most programmers. Also, bugs in threaded programs often fail to show up until programs go into production. These factors create the illusion that threaded programs are easier to write.
53
-
54
- However, some operations that occur frequently in professional-caliber applications simply can't be done without threads. (The classic example is making calls to database client-libraries that block on network I/O until they complete.)
55
-
56
- EventMachine not only allows the use of Ruby threads in these cases, but it even provides a built-in thread-pool object to make them easier to work with.
57
-
58
- You may have heard a persistent criticism that evented I/O is fundamentally incompatible with Ruby threads. It is true that some well-publicized attempts to incorporate event-handling libraries into Ruby were not successful. But EventMachine was designed from the ground up with Ruby compatibility in mind, so EM never suffered from the problems that defeated the earlier attempts.
59
-
60
-
61
- === [SIDEBAR]: I Heard That EventMachine Doesn't Work Very Well On Windows.
62
-
63
- This too is incorrect. EventMachine is an extension written in C++ and Java, and therefore it requires compilation. Many Windows computers (and some Unix computers, especially in production environments) don't have a build stack. Attempting to install EventMachine on a machine without a compiler usually produces a confusing error.
64
-
65
- In addition, Ruby has a much-debated issue with Windows compiler versions. Ruby on Windows works best with Visual Studio 6, a compiler version that is long out-of-print, no longer supported by Microsoft, and difficult to obtain. (This problem is not specific to EventMachine.)
66
-
67
- Shortly after EventMachine was first released, the compiler issues led to criticism that EM was incompatible with Windows. Since that time, every EventMachine release has been supplied in a precompiled binary form for Windows users, that does not require you to compile the code yourself. EM binary Gems for Windows are compiled using Visual Studio 6.
68
-
69
- EventMachine does supply some advanced features (such as Linux EPOLL support, reduced-privilege operation, UNIX-domain sockets, etc.) that have no meaningful implementation on Windows. Apart from these special cases, all EM functionality (including lightweight concurrency) works perfectly well on Windows.
70
-
@@ -1,75 +0,0 @@
1
- EventMachine is supplied in three alternative versions.
2
-
3
- 1) A version that includes a Ruby extension written in C++. This version requires compilation;
4
- 2) A version for JRuby that contains a precompiled JAR file written in Java;
5
- 3) A pure Ruby version that has no external dependencies and can run in any Ruby environment.
6
-
7
- The Java version of EventMachine is packaged in a distinct manner and must be installed using a
8
- special procedure. This version is described fully in a different document, and not considered
9
- further here.
10
-
11
- The C++ and pure-Ruby versions, however, are shipped in the same distribution. You use the same
12
- files (either tarball or Ruby gem) to install both of these versions.
13
-
14
- If you intend to use the C++ version, you must successfully compile EventMachine after you install it.
15
- (The gem installation attempts to perform this step automatically.)
16
-
17
- If you choose not to compile the EventMachine C++ extension, or if your compilation fails for any
18
- reason, you still have a fully-functional installation of the pure-Ruby version of EM.
19
-
20
- However, for technical reasons, a default EM installation (whether or not the compilation succeeds)
21
- will always assume that the compiled ("extension") implementation should be used.
22
-
23
- If you want your EM program to use the pure Ruby version, you must specifically request it. There
24
- are two ways to do this: by setting either a Ruby global variable, or an environment string.
25
-
26
- The following code will invoke the pure-Ruby implementation of EM:
27
-
28
- $eventmachine_library = :pure_ruby
29
- require 'eventmachine'
30
-
31
- EM.library_type #=> "pure_ruby"
32
-
33
- Notice that this requires a code change and is not the preferred way to select pure Ruby, unless
34
- for some reason you are absolutely sure you will never want the compiled implementation.
35
-
36
- Setting the following environment string has the same effect:
37
-
38
- export EVENTMACHINE_LIBRARY="pure_ruby"
39
-
40
- This technique gives you the flexibility to select either version at runtime with no code changes.
41
-
42
- Support
43
-
44
- The EventMachine development team has committed to support precisely the same APIs for all the
45
- various implementations of EM.
46
-
47
- This means that you can expect any EM program to behave identically, whether you use pure Ruby,
48
- the compiled C++ extension, or JRuby. Deviations from this behavior are to be considered bugs
49
- and should be reported as such.
50
-
51
- There is a small number of exceptions to this rule, which arise from underlying platform
52
- distinctions. Notably, EM#epoll is a silent no-op in the pure Ruby implementation.
53
-
54
-
55
- When Should You Use the Pure-Ruby Implementation of EM?
56
-
57
-
58
- Use the pure Ruby implementation of EM when you must support a platform for which no C++ compiler
59
- is available, or on which the standard EM C++ code can't be compiled.
60
-
61
- Keep in mind that you don't need a C++ compiler in order to deploy EM applications that rely on
62
- the compiled version, so long as appropriate C++ runtime libraries are available on the target platform.
63
-
64
- In extreme cases, you may find that you can develop software with the compiled EM version, but are
65
- not allowed to install required runtime libraries on the deployment system(s). This would be another
66
- case in which the pure Ruby implementation can be useful.
67
-
68
- In general you should avoid the pure Ruby version of EM when performance and scalability are important.
69
- EM in pure Ruby will necessarily run slower than the compiled version. Depending on your application
70
- this may or may not be a key issue.
71
-
72
- Also, since EPOLL is not supported in pure Ruby, your applications will be affected by Ruby's built-in
73
- limit of 1024 file and socket descriptors that may be open in a single process. For maximum scalability
74
- and performance, always use EPOLL if possible.
75
-
@@ -1,94 +0,0 @@
1
- RUBY/EventMachine RELEASE NOTES
2
-
3
- --------------------------------------------------
4
- Version: 0.9.0, released xxXXX07
5
- Added Erlang-like distributed-computing features
6
-
7
- --------------------------------------------------
8
- Version: 0.8.0, released 23Jun07
9
- Added an epoll implementation for Linux 2.6 kernels.
10
- Added evented #popen.
11
-
12
- --------------------------------------------------
13
- Version: 0.7.3, released 22May07
14
- Added a large variety of small features. See the ChangeLog.
15
-
16
- --------------------------------------------------
17
- Version: 0.7.1, released xxNov06
18
- Added protocol handlers for line-oriented protocols.
19
- Various bug fixes.
20
-
21
- --------------------------------------------------
22
- Version: 0.7.0, released 20Nov06
23
- Added a fix in em.cpp/ConnectToServer to fix a fatal exception that
24
- occurred in FreeBSD when connecting successfully to a remote server.
25
-
26
- --------------------------------------------------
27
- Version: 0.6.0, released xxJul06
28
- Added deferred operations, suggested by Don Stocks, amillionhitpoints@yahoo.com.
29
-
30
- --------------------------------------------------
31
- Version: 0.5.4, released xxJun06
32
- Added get_peername support for streams and datagrams.
33
-
34
- --------------------------------------------------
35
- Version: 0.5.3, released 17May06
36
- Fixed bugs in extconf.rb, thanks to Daniel Harple, dharple@generalconsumption.org.
37
- Added proper setup.rb and rake tasks, thanks to Austin Ziegler.
38
- Fixed a handful of reported problems with builds on various platforms.
39
-
40
- --------------------------------------------------
41
- Version: 0.5.2, released 05May06
42
- Made several nonvisible improvements to the Windows
43
- implementation.
44
- Added an exception-handling patch contributed by Jeff Rose, jeff@rosejn.net.
45
- Added a dir-config patch contributed anonymously.
46
- Supported builds on Solaris.
47
-
48
- --------------------------------------------------
49
- Version: 0.5.1, released 05May06
50
- Made it possible to pass a Class rather than a Module
51
- to a protocol handler.
52
- Added Windows port.
53
-
54
- --------------------------------------------------
55
- Version: 0.5.0, released 30Apr06
56
- Added a preliminary SSL/TLS extension. This will probably
57
- change over the next few releases.
58
-
59
- --------------------------------------------------
60
- Version: 0.4.5, released 29Apr06
61
- Changed ext files so the ruby.h is installed after unistd.h
62
- otherwise it doesn't compile on gcc 4.1
63
-
64
- --------------------------------------------------
65
- Version: 0.4.2, released 19Apr06
66
- Changed the Ruby-glue so the extension will play nicer
67
- in the sandbox with Ruby threads.
68
- Added an EventMachine::run_without_threads API to
69
- switch off the thread-awareness for better performance
70
- in programs that do not spin any Ruby threads.
71
-
72
- --------------------------------------------------
73
- Version: 0.4.1, released 15Apr06
74
- Reworked the shared-object interface to make it easier to
75
- use EventMachine from languages other than Ruby.
76
-
77
- --------------------------------------------------
78
- Version: 0.3.2, released 12Apr06
79
- Added support for a user-supplied block in EventMachine#connect.
80
-
81
- --------------------------------------------------
82
- Version: 0.3.1, released 11Apr06
83
- Fixed bug that prevented EventMachine from being run multiple
84
- times in a single process.
85
-
86
- --------------------------------------------------
87
- Version: 0.3.0, released 10Apr06
88
- Added method EventHandler::Connection::post_init
89
-
90
- --------------------------------------------------
91
- Version: 0.2.0, released 10Apr06
92
- Added method EventHandler::stop
93
-
94
-
@@ -1,2 +0,0 @@
1
- This note details the usage of EventMachine's built-in support for SMTP. EM supports both client and server connections, which will be described in separate sections.
2
-
@@ -1,89 +0,0 @@
1
- EventMachine (EM) adds two different formalisms for lightweight concurrency to the Ruby programmer's toolbox: spawned processes and deferrables. This note will show you how to use spawned processes. For more information, see the separate document LIGHTWEIGHT_CONCURRENCY.
2
-
3
-
4
- === What are Spawned Processes?
5
-
6
- Spawned Processes in EventMachine are inspired directly by the "processes" found in the Erlang programming language. EM deliberately borrows much (but not all) of Erlang's terminology. However, EM's spawned processes differ from Erlang's in ways that reflect not only Ruby style, but also the fact that Ruby is not a functional language like Erlang.
7
-
8
- Let's proceed with a complete, working code sample that we will analyze line by line. Here's an EM implementation of the "ping-pong" program that also appears in the Erlang tutorial:
9
-
10
-
11
- require 'eventmachine'
12
-
13
- EM.run {
14
- pong = EM.spawn {|x, ping|
15
- puts "Pong received #{x}"
16
- ping.notify( x-1 )
17
- }
18
-
19
- ping = EM.spawn {|x|
20
- if x > 0
21
- puts "Pinging #{x}"
22
- pong.notify x, self
23
- else
24
- EM.stop
25
- end
26
- }
27
-
28
- ping.notify 3
29
- }
30
-
31
- If you run this program, you'll see the following output:
32
-
33
- Pinging 3
34
- Pong received 3
35
- Pinging 2
36
- Pong received 2
37
- Pinging 1
38
- Pong received 1
39
-
40
- Let's take it step by step.
41
-
42
- EventMachine#spawn works very much like the built-in function spawn in Erlang. It returns a reference to a Ruby object of class EventMachine::SpawnedProcess, which is actually a schedulable entity. In Erlang, the value returned from spawn is called a "process identifier" or "pid." But we'll refer to the Ruby object returned from EM#spawn simply as a "spawned process."
43
-
44
- You pass a Ruby block with zero or more parameters to EventMachine#spawn. Like all Ruby blocks, this one is a closure, so it can refer to variables defined in the local context when you call EM#spawn.
45
-
46
- However, the code block passed to EM#spawn does NOT execute immediately by default. Rather, it will execute only when the Spawned Object is "notified." In Erlang, this process is called "message passing," and is done with the operator !, but in Ruby it's done simply by calling the #notify method of a spawned-process object. The parameters you pass to #notify must match those defined in the block that was originally passed to EM#spawn.
47
-
48
- When you call the #notify method of a spawned-process object, EM's reactor core will execute the code block originally passed to EM#spawn, at some point in the future. (#notify itself merely adds a notification to the object's message queue and ALWAYS returns immediately.)
49
-
50
- When a SpawnedProcess object executes a notification, it does so in the context of the SpawnedProcess object itself. The notified code block can see local context from the point at which EM#spawn was called. However, the value of "self" inside the notified code block is a reference to the SpawnedProcesss object itself.
51
-
52
- An EM spawned process is nothing more than a Ruby object with a message queue attached to it. You can have any number of spawned processes in your program without compromising scalability. You can notify a spawned process any number of times, and each notification will cause a "message" to be placed in the queue of the spawned process. Spawned processes with non-empty message queues are scheduled for execution automatically by the EM reactor. Spawned processes with no visible references are garbage-collected like any other Ruby object.
53
-
54
- Back to our code sample:
55
-
56
- pong = EM.spawn {|x, ping|
57
- puts "Pong received #{x}"
58
- ping.notify( x-1 )
59
- }
60
-
61
- This simply creates a spawned process and assigns it to the local variable pong. You can see that the spawned code block takes a numeric parameter and a reference to another spawned process. When pong is notified, it expects to receive arguments corresponding to these two parameters. It simply prints out the number it receives as the first argument. Then it notifies the spawned process referenced by the second argument, passing it the first argument minus 1.
62
-
63
- And then the block ends, which is crucial because otherwise nothing else can run. (Remember that in LC, scheduled entities run to completion and are never preempted.)
64
-
65
- On to the next bit of the code sample:
66
-
67
- ping = EM.spawn {|x|
68
- if x > 0
69
- puts "Pinging #{x}"
70
- pong.notify x, self
71
- else
72
- EM.stop
73
- end
74
- }
75
-
76
- Here, we're spawning a process that takes a single (numeric) parameter. If the parameter is greater than zero, the block writes it to the console. It then notifies the spawned process referenced by the pong local variable, passing as arguments its number argument, and a reference to itself. The latter reference, as you saw above, is used by pong to send a return notification.
77
-
78
- If the ping process receives a zero value, it will stop the reactor loop and end the program.
79
-
80
- Now we've created a pair of spawned processes, but nothing else has happened. If we stop now, the program will spin in the EM reactor loop, doing nothing at all. Our spawned processes will never be scheduled for execution.
81
-
82
- But look at the next line in the code sample:
83
-
84
- ping.notify 3
85
-
86
- This line gets the ping-pong ball rolling. We call ping's #notify method, passing the argument 3. This causes a message to be sent to the ping spawned process. The message contains the single argument, and it causes the EM reactor to schedule the ping process. And this in turn results in the execution of the Ruby code block passed to EM#spawn when ping was created. Everything else proceeds as a result of the messages that are subsequently passed to each other by the spawned processes.
87
-
88
- [TODO, present the outbound network i/o use case, and clarify that spawned processes are interleaved with normal i/o operations and don't interfere with them at all. Also, blame Erlang for the confusing term "process"]
89
-
@@ -1,8 +0,0 @@
1
- TODO List:
2
-
3
- 12Aug06: Noticed by Don Stocks. A TCP connect-request that results
4
- in a failed DNS resolution fires a fatal error back to user code.
5
- Uuuuuugly. We should probably cause an unbind event to get fired
6
- instead, and add some parameterization so the caller can detect
7
- the nature of the failure.
8
-
@@ -1,40 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- Gem::Specification.new do |s|
4
- s.name = %q{eventmachine}
5
- s.version = "0.12.10"
6
-
7
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Francis Cianfrocca"]
9
- s.date = %q{2009-10-24}
10
- s.description = %q{EventMachine implements a fast, single-threaded engine for arbitrary network
11
- communications. It's extremely easy to use in Ruby. EventMachine wraps all
12
- interactions with IP sockets, allowing programs to concentrate on the
13
- implementation of network protocols. It can be used to create both network
14
- servers and clients. To create a server or client, a Ruby program only needs
15
- to specify the IP address and port, and provide a Module that implements the
16
- communications protocol. Implementations of several standard network protocols
17
- are provided with the package, primarily to serve as examples. The real goal
18
- of EventMachine is to enable programs to easily interface with other programs
19
- using TCP/IP, especially if custom protocols are required.
20
- }
21
- s.email = %q{garbagecat10@gmail.com}
22
- s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"]
23
- s.files = [".gitignore", "README", "Rakefile", "docs/COPYING", "docs/ChangeLog", "docs/DEFERRABLES", "docs/EPOLL", "docs/GNU", "docs/INSTALL", "docs/KEYBOARD", "docs/LEGAL", "docs/LIGHTWEIGHT_CONCURRENCY", "docs/PURE_RUBY", "docs/RELEASE_NOTES", "docs/SMTP", "docs/SPAWNED_PROCESSES", "docs/TODO", "eventmachine.gemspec", "examples/ex_channel.rb", "examples/ex_queue.rb", "examples/helper.rb", "ext/binder.cpp", "ext/binder.h", "ext/cmain.cpp", "ext/cplusplus.cpp", "ext/ed.cpp", "ext/ed.h", "ext/em.cpp", "ext/em.h", "ext/emwin.cpp", "ext/emwin.h", "ext/epoll.cpp", "ext/epoll.h", "ext/eventmachine.h", "ext/eventmachine_cpp.h", "ext/extconf.rb", "ext/fastfilereader/extconf.rb", "ext/fastfilereader/mapper.cpp", "ext/fastfilereader/mapper.h", "ext/fastfilereader/rubymain.cpp", "ext/files.cpp", "ext/files.h", "ext/kb.cpp", "ext/page.cpp", "ext/page.h", "ext/pipe.cpp", "ext/project.h", "ext/rubymain.cpp", "ext/sigs.cpp", "ext/sigs.h", "ext/ssl.cpp", "ext/ssl.h", "java/.classpath", "java/.project", "java/src/com/rubyeventmachine/EmReactor.java", "java/src/com/rubyeventmachine/EmReactorException.java", "java/src/com/rubyeventmachine/EventableChannel.java", "java/src/com/rubyeventmachine/EventableDatagramChannel.java", "java/src/com/rubyeventmachine/EventableSocketChannel.java", "java/src/com/rubyeventmachine/application/Application.java", "java/src/com/rubyeventmachine/application/Connection.java", "java/src/com/rubyeventmachine/application/ConnectionFactory.java", "java/src/com/rubyeventmachine/application/DefaultConnectionFactory.java", "java/src/com/rubyeventmachine/application/PeriodicTimer.java", "java/src/com/rubyeventmachine/application/Timer.java", "java/src/com/rubyeventmachine/tests/ApplicationTest.java", "java/src/com/rubyeventmachine/tests/ConnectTest.java", "java/src/com/rubyeventmachine/tests/EMTest.java", "java/src/com/rubyeventmachine/tests/TestDatagrams.java", "java/src/com/rubyeventmachine/tests/TestServers.java", "java/src/com/rubyeventmachine/tests/TestTimers.java", "lib/em/buftok.rb", "lib/em/callback.rb", "lib/em/channel.rb", "lib/em/connection.rb", "lib/em/deferrable.rb", "lib/em/file_watch.rb", "lib/em/future.rb", "lib/em/messages.rb", "lib/em/process_watch.rb", "lib/em/processes.rb", "lib/em/protocols.rb", "lib/em/protocols/header_and_content.rb", "lib/em/protocols/httpclient.rb", "lib/em/protocols/httpclient2.rb", "lib/em/protocols/line_and_text.rb", "lib/em/protocols/linetext2.rb", "lib/em/protocols/memcache.rb", "lib/em/protocols/object_protocol.rb", "lib/em/protocols/postgres3.rb", "lib/em/protocols/saslauth.rb", "lib/em/protocols/smtpclient.rb", "lib/em/protocols/smtpserver.rb", "lib/em/protocols/socks4.rb", "lib/em/protocols/stomp.rb", "lib/em/protocols/tcptest.rb", "lib/em/queue.rb", "lib/em/spawnable.rb", "lib/em/streamer.rb", "lib/em/timers.rb", "lib/em/version.rb", "lib/eventmachine.rb", "lib/evma.rb", "lib/evma/callback.rb", "lib/evma/container.rb", "lib/evma/factory.rb", "lib/evma/protocol.rb", "lib/evma/reactor.rb", "lib/jeventmachine.rb", "lib/pr_eventmachine.rb", "setup.rb", "tasks/cpp.rake_example", "tests/client.crt", "tests/client.key", "tests/test_attach.rb", "tests/test_basic.rb", "tests/test_channel.rb", "tests/test_connection_count.rb", "tests/test_defer.rb", "tests/test_epoll.rb", "tests/test_error_handler.rb", "tests/test_errors.rb", "tests/test_exc.rb", "tests/test_file_watch.rb", "tests/test_futures.rb", "tests/test_get_sock_opt.rb", "tests/test_handler_check.rb", "tests/test_hc.rb", "tests/test_httpclient.rb", "tests/test_httpclient2.rb", "tests/test_inactivity_timeout.rb", "tests/test_kb.rb", "tests/test_ltp.rb", "tests/test_ltp2.rb", "tests/test_next_tick.rb", "tests/test_object_protocol.rb", "tests/test_pause.rb", "tests/test_pending_connect_timeout.rb", "tests/test_process_watch.rb", "tests/test_processes.rb", "tests/test_proxy_connection.rb", "tests/test_pure.rb", "tests/test_queue.rb", "tests/test_running.rb", "tests/test_sasl.rb", "tests/test_send_file.rb", "tests/test_servers.rb", "tests/test_smtpclient.rb", "tests/test_smtpserver.rb", "tests/test_spawn.rb", "tests/test_ssl_args.rb", "tests/test_ssl_methods.rb", "tests/test_ssl_verify.rb", "tests/test_timers.rb", "tests/test_ud.rb", "tests/testem.rb", "web/whatis"]
24
- s.homepage = %q{http://rubyeventmachine.com}
25
- s.rdoc_options = ["--title", "EventMachine", "--main", "README", "--line-numbers", "-x", "lib/em/version", "-x", "lib/emva", "-x", "lib/evma/", "-x", "lib/pr_eventmachine", "-x", "lib/jeventmachine"]
26
- s.require_paths = ["lib"]
27
- s.rubyforge_project = %q{eventmachine}
28
- s.rubygems_version = %q{1.3.5}
29
- s.summary = %q{Ruby/EventMachine library}
30
-
31
- if s.respond_to? :specification_version then
32
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
33
- s.specification_version = 3
34
-
35
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
36
- else
37
- end
38
- else
39
- end
40
- end
@@ -1,43 +0,0 @@
1
- require File.dirname(__FILE__) + '/helper'
2
-
3
- EM.run do
4
-
5
- # Create a channel to push data to, this could be stocks...
6
- RandChannel = EM::Channel.new
7
-
8
- # The server simply subscribes client connections to the channel on connect,
9
- # and unsubscribes them on disconnect.
10
- class Server < EM::Connection
11
- def self.start(host = '127.0.0.1', port = 8000)
12
- EM.start_server(host, port, self)
13
- end
14
-
15
- def post_init
16
- @sid = RandChannel.subscribe { |m| send_data "#{m.inspect}\n" }
17
- end
18
-
19
- def unbind
20
- RandChannel.unsubscribe @sid
21
- end
22
- end
23
- Server.start
24
-
25
- # Two client connections, that just print what they receive.
26
- 2.times do
27
- EM.connect('127.0.0.1', 8000) do |c|
28
- c.extend EM::P::LineText2
29
- def c.receive_line(line)
30
- puts "Subscriber: #{signature} got #{line}"
31
- end
32
- EM.add_timer(2) { c.close_connection }
33
- end
34
- end
35
-
36
- # This part of the example is more fake, but imagine sleep was in fact a
37
- # long running calculation to achieve the value.
38
- 40.times do
39
- EM.defer lambda { v = sleep(rand * 2); RandChannel << [Time.now, v] }
40
- end
41
-
42
- EM.add_timer(5) { EM.stop }
43
- end
@@ -1,2 +0,0 @@
1
- require File.dirname(__FILE__) + '/helper'
2
-
@@ -1,2 +0,0 @@
1
- $:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
2
- require 'eventmachine'
@@ -1,125 +0,0 @@
1
- /*****************************************************************************
2
-
3
- $Id$
4
-
5
- File: binder.cpp
6
- Date: 07Apr06
7
-
8
- Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
9
- Gmail: blackhedd
10
-
11
- This program is free software; you can redistribute it and/or modify
12
- it under the terms of either: 1) the GNU General Public License
13
- as published by the Free Software Foundation; either version 2 of the
14
- License, or (at your option) any later version; or 2) Ruby's License.
15
-
16
- See the file COPYING for complete licensing information.
17
-
18
- *****************************************************************************/
19
-
20
- #include "project.h"
21
-
22
- #define DEV_URANDOM "/dev/urandom"
23
-
24
-
25
- map<unsigned long, Bindable_t*> Bindable_t::BindingBag;
26
-
27
-
28
- /********************************
29
- STATIC Bindable_t::CreateBinding
30
- ********************************/
31
-
32
- unsigned long Bindable_t::CreateBinding()
33
- {
34
- // XXX use atomic_t to prevent thread-safety issues
35
- static unsigned long num = 0;
36
- while(BindingBag[++num]);
37
- return num;
38
- }
39
-
40
- #if 0
41
- string Bindable_t::CreateBinding()
42
- {
43
- static int index = 0;
44
- static string seed;
45
-
46
- if ((index >= 1000000) || (seed.length() == 0)) {
47
- #ifdef OS_UNIX
48
- int fd = open (DEV_URANDOM, O_RDONLY);
49
- if (fd < 0)
50
- throw std::runtime_error ("No entropy device");
51
-
52
- unsigned char u[16];
53
- size_t r = read (fd, u, sizeof(u));
54
- if (r < sizeof(u))
55
- throw std::runtime_error ("Unable to read entropy device");
56
-
57
- unsigned char *u1 = (unsigned char*)u;
58
- char u2 [sizeof(u) * 2 + 1];
59
-
60
- for (size_t i=0; i < sizeof(u); i++)
61
- sprintf (u2 + (i * 2), "%02x", u1[i]);
62
-
63
- seed = string (u2);
64
- #endif
65
-
66
-
67
- #ifdef OS_WIN32
68
- UUID uuid;
69
- UuidCreate (&uuid);
70
- unsigned char *uuidstring = NULL;
71
- UuidToString (&uuid, &uuidstring);
72
- if (!uuidstring)
73
- throw std::runtime_error ("Unable to read uuid");
74
- seed = string ((const char*)uuidstring);
75
-
76
- RpcStringFree (&uuidstring);
77
- #endif
78
-
79
- index = 0;
80
-
81
-
82
- }
83
-
84
- stringstream ss;
85
- ss << seed << (++index);
86
- return ss.str();
87
- }
88
- #endif
89
-
90
- /*****************************
91
- STATIC: Bindable_t::GetObject
92
- *****************************/
93
-
94
- Bindable_t *Bindable_t::GetObject (const unsigned long binding)
95
- {
96
- map<unsigned long, Bindable_t*>::const_iterator i = BindingBag.find (binding);
97
- if (i != BindingBag.end())
98
- return i->second;
99
- else
100
- return NULL;
101
- }
102
-
103
-
104
- /**********************
105
- Bindable_t::Bindable_t
106
- **********************/
107
-
108
- Bindable_t::Bindable_t()
109
- {
110
- Binding = Bindable_t::CreateBinding();
111
- BindingBag [Binding] = this;
112
- }
113
-
114
-
115
-
116
- /***********************
117
- Bindable_t::~Bindable_t
118
- ***********************/
119
-
120
- Bindable_t::~Bindable_t()
121
- {
122
- BindingBag.erase (Binding);
123
- }
124
-
125
-
@@ -1,46 +0,0 @@
1
- /*****************************************************************************
2
-
3
- $Id$
4
-
5
- File: binder.h
6
- Date: 07Apr06
7
-
8
- Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved.
9
- Gmail: blackhedd
10
-
11
- This program is free software; you can redistribute it and/or modify
12
- it under the terms of either: 1) the GNU General Public License
13
- as published by the Free Software Foundation; either version 2 of the
14
- License, or (at your option) any later version; or 2) Ruby's License.
15
-
16
- See the file COPYING for complete licensing information.
17
-
18
- *****************************************************************************/
19
-
20
- #ifndef __ObjectBindings__H_
21
- #define __ObjectBindings__H_
22
-
23
-
24
- class Bindable_t
25
- {
26
- public:
27
- static unsigned long CreateBinding();
28
- static Bindable_t *GetObject (const unsigned long);
29
- static map<unsigned long, Bindable_t*> BindingBag;
30
-
31
- public:
32
- Bindable_t();
33
- virtual ~Bindable_t();
34
-
35
- const unsigned long GetBinding() {return Binding;}
36
-
37
- private:
38
- unsigned long Binding;
39
- };
40
-
41
-
42
-
43
-
44
-
45
- #endif // __ObjectBindings__H_
46
-