e621stream 0.0.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.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +35 -0
  4. data/lib/e621stream/client/options.rb +20 -0
  5. data/lib/e621stream/client.rb +211 -0
  6. data/lib/e621stream/close_codes.rb +23 -0
  7. data/lib/e621stream/event.rb +24 -0
  8. data/lib/e621stream/events.rb +29 -0
  9. data/lib/e621stream/stream_error.rb +18 -0
  10. data/lib/e621stream/version.rb +5 -0
  11. data/lib/e621stream.rb +18 -0
  12. data/sorbet/config +6 -0
  13. data/sorbet/rbi/annotations/.gitattributes +1 -0
  14. data/sorbet/rbi/annotations/minitest.rbi +120 -0
  15. data/sorbet/rbi/annotations/rainbow.rbi +269 -0
  16. data/sorbet/rbi/gems/.gitattributes +1 -0
  17. data/sorbet/rbi/gems/ast@2.4.3.rbi +550 -0
  18. data/sorbet/rbi/gems/async-http@0.105.0.rbi +1649 -0
  19. data/sorbet/rbi/gems/async-pool@0.12.0.rbi +219 -0
  20. data/sorbet/rbi/gems/async-websocket@0.30.2.rbi +271 -0
  21. data/sorbet/rbi/gems/async@2.46.0.rbi +2193 -0
  22. data/sorbet/rbi/gems/benchmark@0.5.0.rbi +495 -0
  23. data/sorbet/rbi/gems/console@1.38.0.rbi +1552 -0
  24. data/sorbet/rbi/gems/erb@6.0.7.rbi +1581 -0
  25. data/sorbet/rbi/gems/erubi@1.13.1.rbi +153 -0
  26. data/sorbet/rbi/gems/fiber-annotation@0.2.0.rbi +62 -0
  27. data/sorbet/rbi/gems/fiber-local@1.1.0.rbi +36 -0
  28. data/sorbet/rbi/gems/fiber-storage@1.0.1.rbi +43 -0
  29. data/sorbet/rbi/gems/io-console@0.9.5.rbi +9 -0
  30. data/sorbet/rbi/gems/io-endpoint@0.19.0.rbi +1079 -0
  31. data/sorbet/rbi/gems/io-event@1.22.3.rbi +971 -0
  32. data/sorbet/rbi/gems/io-stream@0.14.0.rbi +805 -0
  33. data/sorbet/rbi/gems/json@3.1.0.rbi +1929 -0
  34. data/sorbet/rbi/gems/language_server-protocol@3.17.0.6.rbi +9 -0
  35. data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +189 -0
  36. data/sorbet/rbi/gems/logger@1.7.0.rbi +896 -0
  37. data/sorbet/rbi/gems/minitest@5.27.0.rbi +1499 -0
  38. data/sorbet/rbi/gems/netrc@0.11.0.rbi +147 -0
  39. data/sorbet/rbi/gems/openssl@4.0.2.rbi +4366 -0
  40. data/sorbet/rbi/gems/parallel@2.3.0.rbi +332 -0
  41. data/sorbet/rbi/gems/parser@3.3.13.0.rbi +5146 -0
  42. data/sorbet/rbi/gems/pp@0.6.4.rbi +373 -0
  43. data/sorbet/rbi/gems/prettyprint@0.2.1.rbi +476 -0
  44. data/sorbet/rbi/gems/prism@1.9.0.rbi +42213 -0
  45. data/sorbet/rbi/gems/protocol-hpack@1.5.1.rbi +418 -0
  46. data/sorbet/rbi/gems/protocol-http1@0.41.1.rbi +894 -0
  47. data/sorbet/rbi/gems/protocol-http2@0.29.2.rbi +2277 -0
  48. data/sorbet/rbi/gems/protocol-http@0.72.1.rbi +3801 -0
  49. data/sorbet/rbi/gems/protocol-rack@0.23.0.rbi +9 -0
  50. data/sorbet/rbi/gems/protocol-url@0.19.0.rbi +9 -0
  51. data/sorbet/rbi/gems/protocol-websocket@0.21.3.rbi +1087 -0
  52. data/sorbet/rbi/gems/racc@1.8.1.rbi +169 -0
  53. data/sorbet/rbi/gems/rack@3.2.8.rbi +9 -0
  54. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +362 -0
  55. data/sorbet/rbi/gems/rake@13.4.2.rbi +3127 -0
  56. data/sorbet/rbi/gems/rbi@0.5.0.rbi +5875 -0
  57. data/sorbet/rbi/gems/rbs@4.2.0.rbi +7133 -0
  58. data/sorbet/rbi/gems/rdoc@8.1.0.rbi +9 -0
  59. data/sorbet/rbi/gems/regexp_parser@2.13.1.rbi +3500 -0
  60. data/sorbet/rbi/gems/reline@0.7.0.rbi +2449 -0
  61. data/sorbet/rbi/gems/require-hooks@0.5.1.rbi +152 -0
  62. data/sorbet/rbi/gems/rexml@3.4.4.rbi +4905 -0
  63. data/sorbet/rbi/gems/rubocop-ast@1.51.0.rbi +7230 -0
  64. data/sorbet/rbi/gems/rubocop-rake@0.7.1.rbi +314 -0
  65. data/sorbet/rbi/gems/rubocop@1.92.2.rbi +69094 -0
  66. data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +988 -0
  67. data/sorbet/rbi/gems/rubydex@0.4.4.rbi +1620 -0
  68. data/sorbet/rbi/gems/spoom@1.8.13.rbi +7380 -0
  69. data/sorbet/rbi/gems/tapioca@0.20.0.rbi +3752 -0
  70. data/sorbet/rbi/gems/thor@1.5.0.rbi +3870 -0
  71. data/sorbet/rbi/gems/tsort@0.2.0.rbi +389 -0
  72. data/sorbet/rbi/gems/unicode-display_width@3.3.0.rbi +130 -0
  73. data/sorbet/rbi/gems/unicode-emoji@4.3.0.rbi +254 -0
  74. data/sorbet/rbi/gems/zeitwerk@2.8.3.rbi +1178 -0
  75. data/sorbet/tapioca/config.yml +13 -0
  76. data/sorbet/tapioca/require.rb +4 -0
  77. metadata +175 -0
@@ -0,0 +1,971 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `io-event` gem.
5
+ # Please instead update this file by running `bin/tapioca gem io-event`.
6
+
7
+
8
+ # Released under the MIT License.
9
+ # Copyright, 2021, by Wander Hillen.
10
+ # Copyright, 2021-2026, by Samuel Williams.
11
+ # Released under the MIT License.
12
+ # Copyright, 2022-2026, by Samuel Williams.
13
+ # @namespace
14
+ #
15
+ # pkg:gem/io-event#lib/io/event/version.rb:7
16
+ class IO
17
+ include ::Enumerable
18
+ include ::File::Constants
19
+ end
20
+
21
+ class IO::Buffer
22
+ include ::Comparable
23
+
24
+ def initialize(*_arg0); end
25
+
26
+ def &(_arg0); end
27
+ def <=>(_arg0); end
28
+ def ^(_arg0); end
29
+ def and!(_arg0); end
30
+ def clear(*_arg0); end
31
+ def copy(*_arg0); end
32
+ def each(*_arg0); end
33
+ def each_byte(*_arg0); end
34
+ def empty?; end
35
+ def external?; end
36
+ def free; end
37
+ def get_string(*_arg0); end
38
+ def get_value(_arg0, _arg1); end
39
+ def get_values(_arg0, _arg1); end
40
+ def hexdump(*_arg0); end
41
+ def inspect; end
42
+ def internal?; end
43
+ def locked; end
44
+ def locked?; end
45
+ def mapped?; end
46
+ def not!; end
47
+ def null?; end
48
+ def or!(_arg0); end
49
+ def pread(*_arg0); end
50
+ def private?; end
51
+ def pwrite(*_arg0); end
52
+ def read(*_arg0); end
53
+ def readonly?; end
54
+ def resize(_arg0); end
55
+ def set_string(*_arg0); end
56
+ def set_value(_arg0, _arg1, _arg2); end
57
+ def set_values(_arg0, _arg1, _arg2); end
58
+ def shared?; end
59
+ def size; end
60
+ def slice(*_arg0); end
61
+ def to_s; end
62
+ def transfer; end
63
+ def valid?; end
64
+ def values(*_arg0); end
65
+ def write(*_arg0); end
66
+ def xor!(_arg0); end
67
+ def |(_arg0); end
68
+ def ~; end
69
+
70
+ private
71
+
72
+ def initialize_copy(_arg0); end
73
+
74
+ class << self
75
+ def for(_arg0); end
76
+ def map(*_arg0); end
77
+ def size_of(_arg0); end
78
+ def string(_arg0); end
79
+ end
80
+ end
81
+
82
+ class IO::Buffer::AccessError < ::RuntimeError; end
83
+ class IO::Buffer::AllocationError < ::RuntimeError; end
84
+ IO::Buffer::BIG_ENDIAN = T.let(T.unsafe(nil), Integer)
85
+ IO::Buffer::DEFAULT_SIZE = T.let(T.unsafe(nil), Integer)
86
+ IO::Buffer::EXTERNAL = T.let(T.unsafe(nil), Integer)
87
+ IO::Buffer::HOST_ENDIAN = T.let(T.unsafe(nil), Integer)
88
+ IO::Buffer::INTERNAL = T.let(T.unsafe(nil), Integer)
89
+ class IO::Buffer::InvalidatedError < ::RuntimeError; end
90
+ IO::Buffer::LITTLE_ENDIAN = T.let(T.unsafe(nil), Integer)
91
+ IO::Buffer::LOCKED = T.let(T.unsafe(nil), Integer)
92
+ class IO::Buffer::LockedError < ::RuntimeError; end
93
+ IO::Buffer::MAPPED = T.let(T.unsafe(nil), Integer)
94
+ class IO::Buffer::MaskError < ::ArgumentError; end
95
+ IO::Buffer::NETWORK_ENDIAN = T.let(T.unsafe(nil), Integer)
96
+ IO::Buffer::PAGE_SIZE = T.let(T.unsafe(nil), Integer)
97
+ IO::Buffer::PRIVATE = T.let(T.unsafe(nil), Integer)
98
+ IO::Buffer::READONLY = T.let(T.unsafe(nil), Integer)
99
+ IO::Buffer::SHARED = T.let(T.unsafe(nil), Integer)
100
+
101
+ class IO::EAGAINWaitReadable < ::Errno::EAGAIN
102
+ include ::IO::WaitReadable
103
+ end
104
+
105
+ class IO::EAGAINWaitWritable < ::Errno::EAGAIN
106
+ include ::IO::WaitWritable
107
+ end
108
+
109
+ class IO::EINPROGRESSWaitReadable < ::Errno::EINPROGRESS
110
+ include ::IO::WaitReadable
111
+ end
112
+
113
+ class IO::EINPROGRESSWaitWritable < ::Errno::EINPROGRESS
114
+ include ::IO::WaitWritable
115
+ end
116
+
117
+ IO::EWOULDBLOCKWaitReadable = IO::EAGAINWaitReadable
118
+ IO::EWOULDBLOCKWaitWritable = IO::EAGAINWaitWritable
119
+
120
+ # Released under the MIT License.
121
+ # Copyright, 2021-2026, by Samuel Williams.
122
+ # @namespace
123
+ #
124
+ # pkg:gem/io-event#lib/io/event/version.rb:9
125
+ module IO::Event; end
126
+
127
+ # @namespace
128
+ #
129
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:8
130
+ module IO::Event::Debug; end
131
+
132
+ # Enforces the selector interface and delegates operations to a wrapped selector instance.
133
+ #
134
+ # You can enable this in the default selector by setting the `IO_EVENT_DEBUG_SELECTOR` environment variable. In addition, you can log all selector operations to a file by setting the `IO_EVENT_DEBUG_SELECTOR_LOG` environment variable. This is useful for debugging and understanding the behavior of the event loop.
135
+ #
136
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:12
137
+ class IO::Event::Debug::Selector
138
+ # Initialize the debug selector with the given selector and optional log.
139
+ #
140
+ # @parameter selector [Selector] The selector to wrap.
141
+ # @parameter log [IO] The log to write debug messages to.
142
+ #
143
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:54
144
+ def initialize(selector, log: T.unsafe(nil)); end
145
+
146
+ # Run the given blocking operation and wait for its completion.
147
+ #
148
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:174
149
+ def blocking_operation_wait(operation); end
150
+
151
+ # Close the selector.
152
+ #
153
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:113
154
+ def close; end
155
+
156
+ # @returns [Boolean] Whether the wrapped selector is closed.
157
+ #
158
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:127
159
+ def closed?; end
160
+
161
+ # The idle duration of the underlying selector.
162
+ #
163
+ # @returns [Numeric] The idle duration.
164
+ #
165
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:85
166
+ def idle_duration; end
167
+
168
+ # Read from the given IO, forwarded to the underlying selector.
169
+ #
170
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:192
171
+ def io_read(fiber, io, buffer, *arguments); end
172
+
173
+ # Wait for the given IO, forwarded to the underlying selector.
174
+ #
175
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:186
176
+ def io_wait(fiber, io, events); end
177
+
178
+ # Write to the given IO, forwarded to the underlying selector.
179
+ #
180
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:198
181
+ def io_write(fiber, io, buffer, *arguments); end
182
+
183
+ # Log the given message.
184
+ #
185
+ # @asynchronous Will block the calling fiber and the entire event loop.
186
+ #
187
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:99
188
+ def log(message); end
189
+
190
+ # The current time.
191
+ #
192
+ # @returns [Numeric] The current time.
193
+ #
194
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:92
195
+ def now; end
196
+
197
+ # Wait for the given process, forwarded to the underlying selector.
198
+ #
199
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:180
200
+ def process_wait(*arguments); end
201
+
202
+ # Push the given fiber to the selector ready list, such that it will be resumed on the next call to {select}.
203
+ #
204
+ # @parameter fiber [Fiber] The fiber that is ready.
205
+ #
206
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:152
207
+ def push(fiber); end
208
+
209
+ # Raise the given exception on the given fiber.
210
+ #
211
+ # @parameter fiber [Fiber] The fiber to raise the exception on.
212
+ # @parameter arguments [Array] The arguments to use when raising the exception.
213
+ #
214
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:161
215
+ def raise(fiber, *arguments, **options); end
216
+
217
+ # Check if the selector is ready.
218
+ #
219
+ # @returns [Boolean] Whether the selector is ready.
220
+ #
221
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:169
222
+ def ready?; end
223
+
224
+ # Forward the given method to the underlying selector.
225
+ #
226
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:204
227
+ def respond_to?(name, include_private = T.unsafe(nil)); end
228
+
229
+ # Resume the given fiber with the given arguments.
230
+ #
231
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:138
232
+ def resume(*arguments); end
233
+
234
+ # Select for the given duration, forwarded to the underlying selector.
235
+ #
236
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:209
237
+ def select(duration = T.unsafe(nil)); end
238
+
239
+ # Transfer from the calling fiber to the selector.
240
+ #
241
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:132
242
+ def transfer; end
243
+
244
+ # Wakeup the the selector.
245
+ #
246
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:108
247
+ def wakeup; end
248
+
249
+ # Yield to the selector.
250
+ #
251
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:144
252
+ def yield; end
253
+
254
+ private
255
+
256
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:70
257
+ def install_optional_forwarders(selector); end
258
+
259
+ class << self
260
+ # Wrap the given selector with debugging.
261
+ #
262
+ # @parameter selector [Selector] The selector to wrap.
263
+ # @parameter env [Hash] The environment to read configuration from.
264
+ #
265
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:40
266
+ def wrap(selector, env = T.unsafe(nil)); end
267
+ end
268
+ end
269
+
270
+ # Forwarders for optional selector hooks that not every backing selector implements (e.g. `io_close` is only provided by `URing`). Each method here is mixed into the wrapper's singleton class only when the wrapped selector actually defines a method of the same name, so feature detection via `respond_to?` continues to reflect the real backend.
271
+ #
272
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:14
273
+ module IO::Event::Debug::Selector::Forwarders
274
+ # Wait for a futex value to change, forwarded to the underlying selector.
275
+ #
276
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:24
277
+ def futex_wait(fiber, futex, expected); end
278
+
279
+ # Wait for any futex value to change, forwarded to the underlying selector.
280
+ #
281
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:30
282
+ def futex_waitv(fiber, entries); end
283
+
284
+ # Close a file descriptor, forwarded to the underlying selector. Ruby invokes this hook with a raw integer descriptor (Ruby 4.0+).
285
+ #
286
+ # @parameter descriptor [Integer] The raw file descriptor being closed.
287
+ #
288
+ # pkg:gem/io-event#lib/io/event/debug/selector.rb:18
289
+ def io_close(descriptor); end
290
+ end
291
+
292
+ # A thread safe synchronisation primative.
293
+ #
294
+ # pkg:gem/io-event#lib/io/event/interrupt.rb:8
295
+ class IO::Event::Interrupt
296
+ # pkg:gem/io-event#lib/io/event/interrupt.rb:13
297
+ def initialize(selector); end
298
+
299
+ # pkg:gem/io-event#lib/io/event/interrupt.rb:39
300
+ def close; end
301
+
302
+ # Send a single byte interrupt.
303
+ #
304
+ # pkg:gem/io-event#lib/io/event/interrupt.rb:33
305
+ def signal; end
306
+
307
+ class << self
308
+ # pkg:gem/io-event#lib/io/event/interrupt.rb:9
309
+ def attach(selector); end
310
+ end
311
+ end
312
+
313
+ # A priority queue implementation using a standard binary minheap. It uses straight comparison
314
+ # of its contents to determine priority.
315
+ # See <https://en.wikipedia.org/wiki/Binary_heap> for explanations of the main methods.
316
+ #
317
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:12
318
+ class IO::Event::PriorityHeap
319
+ # Initializes the heap.
320
+ #
321
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:16
322
+ def initialize; end
323
+
324
+ # Empties out the heap, discarding all elements
325
+ #
326
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:118
327
+ def clear!; end
328
+
329
+ # Add multiple elements to the heap efficiently.
330
+ #
331
+ # @parameter elements [Array] The elements to add to the heap.
332
+ # @returns [self] Returns self for method chaining.
333
+ #
334
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:88
335
+ def concat(elements); end
336
+
337
+ # Remove a specific element from the heap.
338
+ #
339
+ # O(n) where n is the number of elements in the heap.
340
+ #
341
+ # @parameter element [Object] The element to remove.
342
+ # @returns [Object | Nil] The removed element, or nil if not found.
343
+ #
344
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:128
345
+ def delete(element); end
346
+
347
+ # Remove elements matching the given block condition by rebuilding the heap.
348
+ #
349
+ # This is more efficient than multiple delete operations when removing many elements.
350
+ #
351
+ # O(n) where n is the number of elements in the heap.
352
+ #
353
+ # @yields [Object] Each element in the heap for testing
354
+ # @returns [Integer] The number of elements removed
355
+ #
356
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:167
357
+ def delete_if; end
358
+
359
+ # @returns [Boolean] true if the heap is empty, false otherwise.
360
+ #
361
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:34
362
+ def empty?; end
363
+
364
+ # Mutate the heap contents directly, then rebuild the heap property.
365
+ #
366
+ # This supports batched operations that can be completed with a single `O(n)` heapify instead of multiple `O(log n)` heap operations.
367
+ #
368
+ # @yields {|contents| ...} The heap contents array.
369
+ # @returns [self] Returns self for method chaining.
370
+ #
371
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:108
372
+ def heapify; end
373
+
374
+ # @returns [Object | Nil] the smallest element in the heap without removing it, or nil if the heap is empty.
375
+ #
376
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:24
377
+ def peek; end
378
+
379
+ # Removes and returns the smallest element in the heap, or nil if the heap is empty.
380
+ #
381
+ # @returns [Object | Nil] The smallest element in the heap, or nil if the heap is empty.
382
+ #
383
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:41
384
+ def pop; end
385
+
386
+ # Add a new element to the heap, then rearrange elements until the heap invariant is true again.
387
+ #
388
+ # @parameter element [Object] The element to add to the heap.
389
+ #
390
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:72
391
+ def push(element); end
392
+
393
+ # @returns [Integer] the number of elements in the heap.
394
+ #
395
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:29
396
+ def size; end
397
+
398
+ # Validate the heap invariant. Every element except the root must not be smaller than its parent element. Note that it MAY be equal.
399
+ #
400
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:185
401
+ def valid?; end
402
+
403
+ private
404
+
405
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:224
406
+ def bubble_down(index); end
407
+
408
+ # Left here for reference, but unused.
409
+ # def swap(i, j)
410
+ # @contents[i], @contents[j] = @contents[j], @contents[i]
411
+ # end
412
+ #
413
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:211
414
+ def bubble_up(index); end
415
+
416
+ # Rebuild the heap property from an arbitrary array in O(n) time.
417
+ # Uses bottom-up heapify algorithm starting from the last non-leaf node.
418
+ #
419
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:194
420
+ def heapify!; end
421
+ end
422
+
423
+ # pkg:gem/io-event#lib/io/event/priority_heap.rb:13
424
+ IO::Event::PriorityHeap::HEAPIFY_INSERT_RATIO = T.let(T.unsafe(nil), Integer)
425
+
426
+ # @namespace
427
+ #
428
+ # pkg:gem/io-event#lib/io/event/native.rb:7
429
+ module IO::Event::Selector
430
+ class << self
431
+ # The default selector implementation, which is chosen based on the environment and available implementations.
432
+ #
433
+ # @parameter env [Hash] The environment to read configuration from.
434
+ # @returns [Class] The default selector implementation.
435
+ #
436
+ # pkg:gem/io-event#lib/io/event/selector.rb:21
437
+ def default(env = T.unsafe(nil)); end
438
+
439
+ # Create a new selector instance, according to the best available implementation.
440
+ #
441
+ # @parameter loop [Fiber] The event loop fiber.
442
+ # @parameter env [Hash] The environment to read configuration from.
443
+ # @returns [Selector] The new selector instance.
444
+ #
445
+ # pkg:gem/io-event#lib/io/event/selector.rb:34
446
+ def new(loop, env = T.unsafe(nil)); end
447
+
448
+ # Execute the given block in non-blocking mode.
449
+ #
450
+ # @parameter io [IO] The IO object to operate on.
451
+ # @yields {...} The block to execute.
452
+ #
453
+ # pkg:gem/io-event#lib/io/event/native.rb:7
454
+ def nonblock(_arg0); end
455
+
456
+ # Wait for a process to change state, for the cases a selector cannot represent natively (e.g. `pid <= 0`: any child, or a process group). The native selectors integrate process waiting with the event loop using per-process primitives (`pidfd_open`, `EVFILT_PROC`) which can only refer to a single, specific process, and delegate here otherwise.
457
+ #
458
+ # The wait is performed on a separate thread, which has no fiber scheduler and therefore blocks. Joining it via `Thread#value` is fiber-scheduler aware, so the calling fiber yields to the event loop and the reactor keeps running other fibers.
459
+ #
460
+ # @parameter pid [Integer] The process ID (or process group) to wait for.
461
+ # @parameter flags [Integer] Flags to pass to `Process::Status.wait`.
462
+ # @returns [Process::Status] The status of the waited process.
463
+ #
464
+ # pkg:gem/io-event#lib/io/event/selector.rb:51
465
+ def process_wait(pid, flags); end
466
+ end
467
+ end
468
+
469
+ # pkg:gem/io-event#lib/io/event/selector.rb:14
470
+ IO::Event::Selector::BEST = IO::Event::Selector::URing
471
+
472
+ # pkg:gem/io-event#lib/io/event/native.rb:7
473
+ class IO::Event::Selector::EPoll
474
+ # pkg:gem/io-event#lib/io/event/native.rb:7
475
+ def initialize(_arg0); end
476
+
477
+ # pkg:gem/io-event#lib/io/event/native.rb:7
478
+ def close; end
479
+
480
+ # pkg:gem/io-event#lib/io/event/native.rb:7
481
+ def closed?; end
482
+
483
+ # pkg:gem/io-event#lib/io/event/native.rb:7
484
+ def idle_duration; end
485
+
486
+ # pkg:gem/io-event#lib/io/event/native.rb:7
487
+ def io_read(*_arg0); end
488
+
489
+ # pkg:gem/io-event#lib/io/event/native.rb:7
490
+ def io_wait(_arg0, _arg1, _arg2); end
491
+
492
+ # pkg:gem/io-event#lib/io/event/native.rb:7
493
+ def io_write(*_arg0); end
494
+
495
+ # pkg:gem/io-event#lib/io/event/native.rb:7
496
+ def loop; end
497
+
498
+ # pkg:gem/io-event#lib/io/event/native.rb:7
499
+ def process_wait(_arg0, _arg1, _arg2); end
500
+
501
+ # pkg:gem/io-event#lib/io/event/native.rb:7
502
+ def push(_arg0); end
503
+
504
+ # pkg:gem/io-event#lib/io/event/native.rb:7
505
+ def raise(*_arg0); end
506
+
507
+ # pkg:gem/io-event#lib/io/event/native.rb:7
508
+ def ready?; end
509
+
510
+ # pkg:gem/io-event#lib/io/event/native.rb:7
511
+ def resume(*_arg0); end
512
+
513
+ # pkg:gem/io-event#lib/io/event/native.rb:7
514
+ def select(_arg0); end
515
+
516
+ # pkg:gem/io-event#lib/io/event/native.rb:7
517
+ def transfer; end
518
+
519
+ # pkg:gem/io-event#lib/io/event/native.rb:7
520
+ def wakeup; end
521
+
522
+ # pkg:gem/io-event#lib/io/event/native.rb:7
523
+ def yield; end
524
+ end
525
+
526
+ # A pure-Ruby implementation of the event selector.
527
+ #
528
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:12
529
+ class IO::Event::Selector::Select
530
+ # Initialize the selector with the given event loop fiber.
531
+ #
532
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:14
533
+ def initialize(loop); end
534
+
535
+ # Close the selector and release any resources.
536
+ #
537
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:49
538
+ def close; end
539
+
540
+ # @returns [Boolean] Whether the selector is closed or belongs to a different process.
541
+ #
542
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:57
543
+ def closed?; end
544
+
545
+ # @attribute [Float] This is the amount of time the event loop was idle during the last select call.
546
+ #
547
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:35
548
+ def idle_duration; end
549
+
550
+ # Read at most `length` bytes from the given IO to the buffer in one operation.
551
+ #
552
+ # @parameter offset [Integer] The offset into the buffer to read to.
553
+ # @parameter length [Integer] The maximum number of bytes to read.
554
+ # Read from the given IO to the buffer.
555
+ #
556
+ # @parameter length [Integer] The minimum number of bytes to read.
557
+ # @parameter offset [Integer] The offset into the buffer to read to.
558
+ #
559
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:237
560
+ def io_read(fiber, io, buffer, length, offset = T.unsafe(nil)); end
561
+
562
+ # Wait for multiple IO objects to become readable or writable.
563
+ #
564
+ # @parameter readable [Array(IO)] The list of IO objects to wait for readability.
565
+ # @parameter writable [Array(IO)] The list of IO objects to wait for writability.
566
+ # @parameter priority [Array(IO)] The list of IO objects to wait for priority events.
567
+ #
568
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:186
569
+ def io_select(readable, writable, priority, timeout); end
570
+
571
+ # Wait for the given IO to become readable or writable.
572
+ #
573
+ # @parameter fiber [Fiber] The fiber that is waiting.
574
+ # @parameter io [IO] The IO object to wait on.
575
+ # @parameter events [Integer] The events to wait for.
576
+ #
577
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:173
578
+ def io_wait(fiber, io, events); end
579
+
580
+ # Write at most `length` bytes to the given IO from the buffer in one operation.
581
+ #
582
+ # @parameter offset [Integer] The offset into the buffer to write from.
583
+ # @parameter length [Integer] The maximum number of bytes to write.
584
+ # Write to the given IO from the buffer.
585
+ #
586
+ # @parameter length [Integer] The minimum number of bytes to write.
587
+ # @parameter offset [Integer] The offset into the buffer to write from.
588
+ #
589
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:274
590
+ def io_write(fiber, io, buffer, length, offset = T.unsafe(nil)); end
591
+
592
+ # @attribute [Fiber] The event loop fiber.
593
+ #
594
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:32
595
+ def loop; end
596
+
597
+ # Wait for a process to change state.
598
+ #
599
+ # @parameter fiber [Fiber] The fiber to resume after waiting.
600
+ # @parameter pid [Integer] The process ID to wait for.
601
+ # @parameter flags [Integer] Flags to pass to Process::Status.wait.
602
+ # @returns [Process::Status] The status of the waited process.
603
+ #
604
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:314
605
+ def process_wait(fiber, pid, flags); end
606
+
607
+ # Append the given fiber into the ready list.
608
+ #
609
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:105
610
+ def push(fiber); end
611
+
612
+ # Transfer to the given fiber and raise an exception. Put the current fiber into the ready list.
613
+ #
614
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:110
615
+ def raise(fiber, *arguments, **options); end
616
+
617
+ # @returns [Boolean] Whether the ready list is not empty, i.e. there are fibers ready to be resumed.
618
+ #
619
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:120
620
+ def ready?; end
621
+
622
+ # Transfer from the current fiber to the specified fiber. Put the current fiber into the ready list.
623
+ #
624
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:85
625
+ def resume(fiber, *arguments); end
626
+
627
+ # Wait for IO events or a timeout.
628
+ #
629
+ # @parameter duration [Numeric | Nil] The maximum time to wait, or nil for no timeout.
630
+ # @returns [Integer] The number of ready IO objects.
631
+ #
632
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:335
633
+ def select(duration = T.unsafe(nil)); end
634
+
635
+ # Transfer control to the fiber if it is still available.
636
+ # Transfer from the current fiber to the event loop.
637
+ #
638
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:80
639
+ def transfer; end
640
+
641
+ # Wake up the event loop if it is currently sleeping.
642
+ #
643
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:38
644
+ def wakeup; end
645
+
646
+ # Yield from the current fiber back to the event loop. Put the current fiber into the ready list.
647
+ #
648
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:95
649
+ def yield; end
650
+
651
+ protected
652
+
653
+ # Whether the given error code indicates that the operation should be retried.
654
+ #
655
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:196
656
+ def again?(errno); end
657
+
658
+ private
659
+
660
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:318
661
+ def pop_ready; end
662
+ end
663
+
664
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:192
665
+ IO::Event::Selector::Select::EAGAIN = T.let(T.unsafe(nil), Integer)
666
+
667
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:193
668
+ IO::Event::Selector::Select::EWOULDBLOCK = T.let(T.unsafe(nil), Integer)
669
+
670
+ # An optional reference to a fiber which can be cleared before it is resumed.
671
+ #
672
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:62
673
+ class IO::Event::Selector::Select::Optional < ::Struct
674
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:69
675
+ def alive?; end
676
+
677
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:62
678
+ def fiber; end
679
+
680
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:62
681
+ def fiber=(_); end
682
+
683
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:74
684
+ def nullify; end
685
+
686
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:64
687
+ def transfer(*arguments); end
688
+
689
+ class << self
690
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:62
691
+ def [](*_arg0); end
692
+
693
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:62
694
+ def inspect; end
695
+
696
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:62
697
+ def keyword_init?; end
698
+
699
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:62
700
+ def members; end
701
+
702
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:62
703
+ def new(*_arg0); end
704
+ end
705
+ end
706
+
707
+ # A linked list node used to track fibers waiting for IO events.
708
+ #
709
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
710
+ class IO::Event::Selector::Select::Waiter < ::Struct
711
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:127
712
+ def alive?; end
713
+
714
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:132
715
+ def dispatch(events, &reactivate); end
716
+
717
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:159
718
+ def each(&block); end
719
+
720
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
721
+ def events; end
722
+
723
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
724
+ def events=(_); end
725
+
726
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
727
+ def fiber; end
728
+
729
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
730
+ def fiber=(_); end
731
+
732
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:154
733
+ def invalidate; end
734
+
735
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
736
+ def tail; end
737
+
738
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
739
+ def tail=(_); end
740
+
741
+ class << self
742
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
743
+ def [](*_arg0); end
744
+
745
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
746
+ def inspect; end
747
+
748
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
749
+ def keyword_init?; end
750
+
751
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
752
+ def members; end
753
+
754
+ # pkg:gem/io-event#lib/io/event/selector/select.rb:125
755
+ def new(*_arg0); end
756
+ end
757
+ end
758
+
759
+ # pkg:gem/io-event#lib/io/event/native.rb:7
760
+ class IO::Event::Selector::URing
761
+ # pkg:gem/io-event#lib/io/event/native.rb:7
762
+ def initialize(_arg0); end
763
+
764
+ # pkg:gem/io-event#lib/io/event/native.rb:7
765
+ def close; end
766
+
767
+ # pkg:gem/io-event#lib/io/event/native.rb:7
768
+ def closed?; end
769
+
770
+ # pkg:gem/io-event#lib/io/event/native.rb:7
771
+ def idle_duration; end
772
+
773
+ # pkg:gem/io-event#lib/io/event/native.rb:7
774
+ def io_close(_arg0); end
775
+
776
+ # pkg:gem/io-event#lib/io/event/native.rb:7
777
+ def io_pread(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5); end
778
+
779
+ # pkg:gem/io-event#lib/io/event/native.rb:7
780
+ def io_pwrite(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5); end
781
+
782
+ # pkg:gem/io-event#lib/io/event/native.rb:7
783
+ def io_read(*_arg0); end
784
+
785
+ # pkg:gem/io-event#lib/io/event/native.rb:7
786
+ def io_wait(_arg0, _arg1, _arg2); end
787
+
788
+ # pkg:gem/io-event#lib/io/event/native.rb:7
789
+ def io_write(*_arg0); end
790
+
791
+ # pkg:gem/io-event#lib/io/event/native.rb:7
792
+ def loop; end
793
+
794
+ # pkg:gem/io-event#lib/io/event/native.rb:7
795
+ def process_wait(_arg0, _arg1, _arg2); end
796
+
797
+ # pkg:gem/io-event#lib/io/event/native.rb:7
798
+ def push(_arg0); end
799
+
800
+ # pkg:gem/io-event#lib/io/event/native.rb:7
801
+ def raise(*_arg0); end
802
+
803
+ # pkg:gem/io-event#lib/io/event/native.rb:7
804
+ def ready?; end
805
+
806
+ # pkg:gem/io-event#lib/io/event/native.rb:7
807
+ def resume(*_arg0); end
808
+
809
+ # pkg:gem/io-event#lib/io/event/native.rb:7
810
+ def select(_arg0); end
811
+
812
+ # pkg:gem/io-event#lib/io/event/native.rb:7
813
+ def transfer; end
814
+
815
+ # pkg:gem/io-event#lib/io/event/native.rb:7
816
+ def wakeup; end
817
+
818
+ # pkg:gem/io-event#lib/io/event/native.rb:7
819
+ def yield; end
820
+ end
821
+
822
+ # @namespace
823
+ #
824
+ # pkg:gem/io-event#lib/io/event/support.rb:9
825
+ module IO::Event::Support
826
+ class << self
827
+ # Check if the `IO::Buffer` class is available.
828
+ #
829
+ # pkg:gem/io-event#lib/io/event/support.rb:11
830
+ def buffer?; end
831
+ end
832
+ end
833
+
834
+ # An efficient sorted set of timers.
835
+ #
836
+ # pkg:gem/io-event#lib/io/event/timers.rb:11
837
+ class IO::Event::Timers
838
+ # Initialize the timers.
839
+ #
840
+ # pkg:gem/io-event#lib/io/event/timers.rb:82
841
+ def initialize; end
842
+
843
+ # Schedule a block to be called after a specific time offset, relative to the current time as returned by {#now}.
844
+ #
845
+ # @parameter offset [#to_f] The time offset from the current time at which the block should be called.
846
+ # @yields {|now| ...} When the timer fires.
847
+ #
848
+ # pkg:gem/io-event#lib/io/event/timers.rb:115
849
+ def after(offset, &block); end
850
+
851
+ # Track cancelled timers that are still retained in the heap.
852
+ #
853
+ # pkg:gem/io-event#lib/io/event/timers.rb:215
854
+ def cancelled!(handle); end
855
+
856
+ # Fire all timers that are ready to fire.
857
+ #
858
+ # @parameter now [Float] The current time.
859
+ #
860
+ # pkg:gem/io-event#lib/io/event/timers.rb:145
861
+ def fire(now = T.unsafe(nil)); end
862
+
863
+ # @returns [Float] The current time.
864
+ #
865
+ # pkg:gem/io-event#lib/io/event/timers.rb:138
866
+ def now; end
867
+
868
+ # Schedule a block to be called at a specific time in the future.
869
+ #
870
+ # @parameter time [Float] The time at which the block should be called, relative to {#now}.
871
+ # @parameter block [Proc] The block to call.
872
+ #
873
+ # pkg:gem/io-event#lib/io/event/timers.rb:99
874
+ def schedule(time, block); end
875
+
876
+ # @returns [Integer] The number of timers in the heap.
877
+ #
878
+ # pkg:gem/io-event#lib/io/event/timers.rb:89
879
+ def size; end
880
+
881
+ # Compute the time interval until the next timer fires.
882
+ #
883
+ # @parameter now [Float] The current time.
884
+ # @returns [Float | Nil] The time interval until the next timer fires, if any.
885
+ #
886
+ # pkg:gem/io-event#lib/io/event/timers.rb:123
887
+ def wait_interval(now = T.unsafe(nil)); end
888
+
889
+ protected
890
+
891
+ # Flush all scheduled timers into the heap.
892
+ #
893
+ # Scheduling appends to `@scheduled` and cancellation is `O(1)`. We pay the cost of filtering and heap repair here, where we can batch work and choose between incremental insertion and one `heapify` pass.
894
+ #
895
+ # pkg:gem/io-event#lib/io/event/timers.rb:171
896
+ def flush!; end
897
+ end
898
+
899
+ # pkg:gem/io-event#lib/io/event/timers.rb:12
900
+ IO::Event::Timers::COMPACT_MINIMUM_COUNT = T.let(T.unsafe(nil), Integer)
901
+
902
+ # A handle to a scheduled timer.
903
+ #
904
+ # pkg:gem/io-event#lib/io/event/timers.rb:15
905
+ class IO::Event::Timers::Handle
906
+ # Initialize the handle with the given time and block.
907
+ #
908
+ # @parameter time [Float] The time at which the block should be called.
909
+ # @parameter block [Proc] The block to call.
910
+ #
911
+ # pkg:gem/io-event#lib/io/event/timers.rb:20
912
+ def initialize(time, block); end
913
+
914
+ # Compare the handle with another handle.
915
+ #
916
+ # @parameter other [Handle] The other handle to compare with.
917
+ # @returns [Boolean] Whether the handle is less than the other handle.
918
+ #
919
+ # pkg:gem/io-event#lib/io/event/timers.rb:46
920
+ def <(other); end
921
+
922
+ # Compare the handle with another handle.
923
+ #
924
+ # @parameter other [Handle] The other handle to compare with.
925
+ # @returns [Boolean] Whether the handle is greater than the other handle.
926
+ #
927
+ # pkg:gem/io-event#lib/io/event/timers.rb:54
928
+ def >(other); end
929
+
930
+ # @attribute [Proc | Nil] The block to call when the timer fires.
931
+ #
932
+ # pkg:gem/io-event#lib/io/event/timers.rb:30
933
+ def block; end
934
+
935
+ # Invoke the block.
936
+ #
937
+ # pkg:gem/io-event#lib/io/event/timers.rb:59
938
+ def call(*, **, &); end
939
+
940
+ # Cancel the timer.
941
+ #
942
+ # pkg:gem/io-event#lib/io/event/timers.rb:64
943
+ def cancel!; end
944
+
945
+ # @returns [Boolean] Whether the timer has been cancelled.
946
+ #
947
+ # pkg:gem/io-event#lib/io/event/timers.rb:76
948
+ def cancelled?; end
949
+
950
+ # Mark the timer as removed from the heap.
951
+ #
952
+ # pkg:gem/io-event#lib/io/event/timers.rb:38
953
+ def removed!; end
954
+
955
+ # Mark the timer as inserted into the heap.
956
+ #
957
+ # pkg:gem/io-event#lib/io/event/timers.rb:33
958
+ def schedule!(timers); end
959
+
960
+ # @attribute [Float] The time at which the block should be called.
961
+ #
962
+ # pkg:gem/io-event#lib/io/event/timers.rb:27
963
+ def time; end
964
+ end
965
+
966
+ # pkg:gem/io-event#lib/io/event/version.rb:10
967
+ IO::Event::VERSION = T.let(T.unsafe(nil), String)
968
+
969
+ IO::PRIORITY = T.let(T.unsafe(nil), Integer)
970
+ IO::READABLE = T.let(T.unsafe(nil), Integer)
971
+ IO::WRITABLE = T.let(T.unsafe(nil), Integer)