Aggregate support via POSIX message queues
[raindrops.git] / lib / raindrops.rb
bloba35a15888f2b3c58b70ab486874fde7bfa54a8b6
1 # -*- encoding: binary -*-
2 class Raindrops
4   # Raindrops is currently at version 0.4.1
5   VERSION = '0.4.1'
7   # Used to represent the number of +active+ and +queued+ sockets for
8   # a single listen socket across all threads and processes on a
9   # machine.
10   #
11   # For TCP listeners, only sockets in the TCP_ESTABLISHED state are
12   # accounted for.  For Unix domain listeners, only CONNECTING and
13   # CONNECTED Unix domain sockets are accounted for.
14   #
15   # +active+ connections is the number of accept()-ed but not-yet-closed
16   # sockets in all threads/processes sharing the given listener.
17   #
18   # +queued+ connections is the number of un-accept()-ed sockets in the
19   # queue of a given listen socket.
20   #
21   # These stats are currently only available under Linux
22   class ListenStats < Struct.new(:active, :queued)
24     # the sum of +active+ and +queued+ sockets
25     def total
26       active + queued
27     end
28   end
30   autoload :Linux, 'raindrops/linux'
31   autoload :Struct, 'raindrops/struct'
32   autoload :Middleware, 'raindrops/middleware'
33   autoload :Aggregate, 'raindrops/aggregate'
34 end
35 require 'raindrops_ext'