oldmoe-neverblock 0.1.6 → 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/lib/never_block.rb +5 -78
  2. data/lib/neverblock.rb +3 -1
  3. data/lib/{never_block/extensions/fiber_extensions.rb → neverblock/core/fiber.rb} +20 -6
  4. data/lib/neverblock/core/pool.rb +72 -0
  5. data/lib/neverblock/core/reactor.rb +50 -0
  6. data/lib/neverblock/core/system/system.rb +38 -0
  7. data/lib/neverblock/core/system/timeout.rb +67 -0
  8. data/lib/{never_block/db/pooled_db_connection.rb → neverblock/io/db/connection.rb} +16 -2
  9. data/lib/neverblock/io/db/drivers/mysql.rb +73 -0
  10. data/lib/neverblock/io/db/drivers/postgres.rb +63 -0
  11. data/lib/neverblock/io/db/fibered_connection_pool.rb +130 -0
  12. data/lib/{never_block → neverblock/io}/db/fibered_mysql_connection.rb +5 -18
  13. data/lib/{never_block/pool/fibered_connection_pool.rb → neverblock/io/db/pool.rb} +25 -40
  14. data/lib/neverblock/io/file.rb +24 -0
  15. data/lib/neverblock/io/io.rb +219 -0
  16. data/lib/neverblock/io/socket.rb +75 -0
  17. data/lib/neverblock_io.rb +6 -0
  18. data/lib/system.rb +4 -0
  19. data/neverblock.gemspec +23 -21
  20. metadata +23 -20
  21. data/lib/active_record/connection_adapters/neverblock_mysql_adapter.rb +0 -68
  22. data/lib/active_record/connection_adapters/neverblock_postgresql_adapter.rb +0 -85
  23. data/lib/never_block/db/fibered_db_connection.rb +0 -72
  24. data/lib/never_block/db/fibered_postgres_connection.rb +0 -64
  25. data/lib/never_block/frameworks/activerecord.rb +0 -37
  26. data/lib/never_block/frameworks/rails.rb +0 -65
  27. data/lib/never_block/pool/fiber_pool.rb +0 -74
  28. data/lib/never_block/servers/mongrel.rb +0 -236
  29. data/lib/never_block/servers/thin.rb +0 -32
  30. data/lib/neverblock-mysql.rb +0 -5
  31. data/lib/neverblock-pg.rb +0 -5
@@ -1,32 +0,0 @@
1
- require 'rubygems'
2
- require 'neverblock' unless defined?(NeverBlock)
3
- require 'thin'
4
-
5
- module Thin
6
-
7
- # Patch the thin server to use NeverBlock::Pool::FiberPool to be able to
8
- # wrap requests in fibers
9
- class Server
10
-
11
- DEFAULT_FIBER_POOL_SIZE = 20
12
-
13
- def fiber_pool
14
- @fiber_pool ||= NB::Pool::FiberPool.new(DEFAULT_FIBER_POOL_SIZE)
15
- end
16
-
17
- end # Server
18
-
19
- # A request is processed by wrapping it in a fiber from the fiber pool.
20
- # If all the fibers are busy the request will wait in a queue to be picked up
21
- # later. Meanwhile, the server will still be processing requests
22
- class Connection < EventMachine::Connection
23
-
24
- def process
25
- @request.threaded = false
26
- @backend.server.fiber_pool.spawn {post_process(pre_process)}
27
- end
28
-
29
- end # Connection
30
-
31
-
32
- end # Thin
@@ -1,5 +0,0 @@
1
- $:.unshift File.expand_path(File.dirname(__FILE__))
2
- require 'neverblock'
3
- require 'never_block/db/fibered_db_connection'
4
- require 'never_block/db/fibered_mysql_connection'
5
- require 'never_block/db/pooled_db_connection'
@@ -1,5 +0,0 @@
1
- $:.unshift File.expand_path(File.dirname(__FILE__))
2
- require 'neverblock'
3
- require 'never_block/db/fibered_db_connection'
4
- require 'never_block/db/pooled_db_connection'
5
- require 'never_block/db/fibered_postgres_connection'