raptor 0.23.0 → 0.25.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.
@@ -0,0 +1,52 @@
1
+ # Generated from lib/raptor/plugin.rb with RBS::Inline
2
+
3
+ module Raptor
4
+ # An extension, loaded from `raptor/plugin/<name>` or
5
+ # registered explicitly by application code.
6
+ class Plugin
7
+ class UnknownPlugin < LoadError
8
+ end
9
+
10
+ self.@registry: Hash[String, singleton(Plugin)]
11
+
12
+ # Registers a plugin class under a name.
13
+ #
14
+ # @rbs (String | Symbol name, singleton(Plugin) plugin) -> void
15
+ def self.register: (String | Symbol name, singleton(Plugin) plugin) -> void
16
+
17
+ # Defines and registers a plugin without a named subclass.
18
+ #
19
+ # @rbs (String | Symbol name) { () -> void } -> singleton(Plugin)
20
+ def self.create: (String | Symbol name) { () -> void } -> singleton(Plugin)
21
+
22
+ # Loads a registered plugin, requiring its conventional path if needed.
23
+ #
24
+ # @rbs (String | Symbol name) -> Plugin
25
+ def self.load: (String | Symbol name) -> Plugin
26
+
27
+ @threads: Array[Thread]?
28
+
29
+ # Starts in the master before workers fork. Override to open resources
30
+ # and append callbacks to the cluster's lifecycle hook arrays.
31
+ #
32
+ # @rbs (Cluster cluster) -> void
33
+ def start: (Cluster cluster) -> void
34
+
35
+ # Stops in the master after workers exit, including before hot restart.
36
+ # Also called if startup fails, so resources may be only partly opened.
37
+ #
38
+ # @rbs () -> void
39
+ def stop: () -> void
40
+
41
+ # Runs a block on a master-owned thread. Raptor stops and joins these
42
+ # threads after calling `stop`; use `ensure` in the block for cleanup.
43
+ #
44
+ # @rbs () { () -> void } -> Thread
45
+ def in_background: () { () -> void } -> Thread
46
+
47
+ # Calls the plugin's stop callback and joins its background threads.
48
+ #
49
+ # @rbs () -> void
50
+ def shutdown: () -> void
51
+ end
52
+ end
@@ -56,8 +56,6 @@ module Raptor
56
56
 
57
57
  attr_accessor closing: bool
58
58
 
59
- attr_accessor monitor: NIO::Monitor?
60
-
61
59
  attr_accessor timeout: TimeoutClient?
62
60
 
63
61
  attr_reader output: Array[String]
@@ -131,13 +129,17 @@ module Raptor
131
129
  def empty?: () -> bool
132
130
  end
133
131
 
134
- @io_applied: AtomicConditionVariable
135
-
136
132
  @io_queue: AtomicQueue
137
133
 
138
134
  @queue: Queue[TCPSocket]
139
135
 
140
- @selector: NIO::Selector
136
+ @ready: Array[[ TCPSocket, Integer ]]
137
+
138
+ @waiters: Hash[TCPSocket, [ Fiber, Integer ]]
139
+
140
+ @wakeup: Fiber?
141
+
142
+ @selector: untyped
141
143
 
142
144
  @http2_keepalive_timeout: Integer
143
145
 
@@ -159,6 +161,8 @@ module Raptor
159
161
 
160
162
  @http1: Http1
161
163
 
164
+ @io_applied: AtomicConditionVariable
165
+
162
166
  @timeouts: RedBlackTree[TimeoutClient]
163
167
 
164
168
  @id_to_socket: Hash[Integer, TCPSocket]
@@ -422,6 +426,11 @@ module Raptor
422
426
 
423
427
  private
424
428
 
429
+ # Wakes the event loop, including work queued before it starts waiting.
430
+ #
431
+ # @rbs () -> void
432
+ def wakeup: () -> void
433
+
425
434
  # Returns whether shutdown has no registrations or writes left to drain.
426
435
  #
427
436
  # @return [Boolean]
@@ -603,7 +612,12 @@ module Raptor
603
612
  # @return [void]
604
613
  #
605
614
  # @rbs (Integer id, ConnectionIO io) -> void
606
- def update_monitor: (Integer id, ConnectionIO io) -> void
615
+ def update_interests: (Integer id, ConnectionIO io) -> void
616
+
617
+ # Waits for a connection's next readable or writable event.
618
+ #
619
+ # @rbs (TCPSocket socket, Integer events) -> void
620
+ def wait_for_io: (TCPSocket socket, Integer events) -> void
607
621
 
608
622
  # Starts or refreshes one connection's non-blocking write deadline.
609
623
  #
@@ -625,13 +639,12 @@ module Raptor
625
639
  # Removes a socket from selector tracking.
626
640
  #
627
641
  # @param socket [TCPSocket] socket to deregister
628
- # @param io [ConnectionIO, nil] connection I/O state
629
642
  # @return [void]
630
643
  #
631
- # @rbs (TCPSocket socket, ConnectionIO? io) -> void
632
- def deregister: (TCPSocket socket, ConnectionIO? io) -> void
644
+ # @rbs (TCPSocket socket) -> void
645
+ def deregister: (TCPSocket socket) -> void
633
646
 
634
- # Registers a socket with the NIO selector and sets up timeout tracking.
647
+ # Registers a socket for readiness and sets up timeout tracking.
635
648
  #
636
649
  # @param socket [TCPSocket] the socket to register
637
650
  # @return [void]
@@ -661,20 +674,22 @@ module Raptor
661
674
  # Dispatches readable and writable events without allowing application
662
675
  # threads to take ownership of HTTP/2 sockets.
663
676
  #
664
- # @param monitor [NIO::Monitor] ready selector monitor
677
+ # @param socket [TCPSocket] ready client socket
678
+ # @param events [Integer] readiness events
665
679
  # @return [void]
666
680
  #
667
- # @rbs (NIO::Monitor monitor) -> void
668
- def handle_monitor: (NIO::Monitor monitor) -> void
681
+ # @rbs (TCPSocket socket, Integer events) -> void
682
+ def handle_ready: (TCPSocket socket, Integer events) -> void
669
683
 
670
684
  # Handles readiness for an HTTP/1.x detached response.
671
685
  #
672
- # @param monitor [NIO::Monitor] ready selector monitor
686
+ # @param socket [TCPSocket] ready client socket
687
+ # @param events [Integer] readiness events
673
688
  # @param id [Integer] unique connection identifier
674
689
  # @return [void]
675
690
  #
676
- # @rbs (NIO::Monitor monitor, Integer id) -> void
677
- def handle_http1_detached_monitor: (NIO::Monitor monitor, Integer id) -> void
691
+ # @rbs (TCPSocket socket, Integer events, Integer id) -> void
692
+ def handle_http1_detached_ready: (TCPSocket socket, Integer events, Integer id) -> void
678
693
 
679
694
  # Deregisters a readable socket and resumes its idle keep-alive
680
695
  # connection or queues its bytes for parsing.
@@ -4,6 +4,6 @@
4
4
  #
5
5
  # Raptor is a high-performance, preloading, multi-process, multi-threaded Ruby 4+ web server
6
6
  # implementing Rack 3+, leveraging Ractors for parallel HTTP/1.1 and HTTP/2 request processing,
7
- # native C extensions for HTTP parsing and HPACK compression, and NIO for non-blocking I/O.
7
+ # native C extensions for HTTP parsing and HPACK compression, and io-event for non-blocking I/O.
8
8
  module Raptor
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: raptor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.0
4
+ version: 0.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Young
@@ -24,7 +24,7 @@ dependencies:
24
24
  - !ruby/object:Gem::Version
25
25
  version: 3.2.0
26
26
  - !ruby/object:Gem::Dependency
27
- name: nio4r
27
+ name: io-event
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
@@ -141,6 +141,8 @@ files:
141
141
  - LICENSE.txt
142
142
  - README.md
143
143
  - Rakefile
144
+ - docs/assets/profile_picture.png
145
+ - docs/assets/startup_output.svg
144
146
  - docs/raptor-vs-puma.md
145
147
  - docs/talk.md
146
148
  - exe/raptor
@@ -163,6 +165,7 @@ files:
163
165
  - lib/raptor/http1.rb
164
166
  - lib/raptor/http2.rb
165
167
  - lib/raptor/log.rb
168
+ - lib/raptor/plugin.rb
166
169
  - lib/raptor/reactor.rb
167
170
  - lib/raptor/reuseport_bpf.rb
168
171
  - lib/raptor/server.rb
@@ -181,6 +184,7 @@ files:
181
184
  - sig/generated/raptor/http1.rbs
182
185
  - sig/generated/raptor/http2.rbs
183
186
  - sig/generated/raptor/log.rbs
187
+ - sig/generated/raptor/plugin.rbs
184
188
  - sig/generated/raptor/reactor.rbs
185
189
  - sig/generated/raptor/reuseport_bpf.rbs
186
190
  - sig/generated/raptor/server.rbs