nio4r 2.5.8 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/workflow.yml +33 -19
- data/.mailmap +16 -0
- data/Gemfile +5 -4
- data/{CHANGES.md → changes.md} +37 -0
- data/examples/echo_server.rb +7 -0
- data/ext/nio4r/bytebuffer.c +75 -38
- data/ext/nio4r/extconf.rb +19 -1
- data/ext/nio4r/monitor.c +47 -22
- data/ext/nio4r/nio4r.h +1 -5
- data/ext/nio4r/org/nio4r/ByteBuffer.java +1 -1
- data/ext/nio4r/org/nio4r/Monitor.java +2 -2
- data/ext/nio4r/org/nio4r/Selector.java +2 -2
- data/ext/nio4r/selector.c +72 -48
- data/lib/nio/bytebuffer.rb +6 -0
- data/lib/nio/monitor.rb +7 -0
- data/lib/nio/selector.rb +15 -0
- data/lib/nio/version.rb +6 -1
- data/lib/nio.rb +9 -0
- data/lib/nio4r.rb +5 -0
- data/license.md +77 -0
- data/nio4r.gemspec +4 -3
- data/rakelib/extension.rake +1 -2
- data/readme.md +95 -0
- data/spec/nio/acceptables_spec.rb +4 -0
- data/spec/nio/bytebuffer_spec.rb +6 -0
- data/spec/nio/monitor_spec.rb +7 -0
- data/spec/nio/selectables/pipe_spec.rb +6 -0
- data/spec/nio/selectables/ssl_socket_spec.rb +8 -3
- data/spec/nio/selectables/tcp_socket_spec.rb +7 -0
- data/spec/nio/selectables/udp_socket_spec.rb +7 -0
- data/spec/nio/selector_spec.rb +12 -0
- data/spec/spec_helper.rb +5 -2
- data/spec/support/selectable_examples.rb +8 -0
- metadata +12 -7
- data/README.md +0 -133
data/license.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright, 2011-2020, by Tony Arcieri.
|
4
|
+
Copyright, 2012, by Bernd Ahlers.
|
5
|
+
Copyright, 2012, by Logan Bowers.
|
6
|
+
Copyright, 2012, by Dirkjan Bussink.
|
7
|
+
Copyright, 2013, by Sadayuki Furuhashi.
|
8
|
+
Copyright, 2013, by Shannon Skipper.
|
9
|
+
Copyright, 2013, by Stephen von Takach.
|
10
|
+
Copyright, 2013, by Tim Carey-Smith.
|
11
|
+
Copyright, 2013, by Per Lundberg.
|
12
|
+
Copyright, 2013, by Ravil Bayramgalin.
|
13
|
+
Copyright, 2013, by Luis Lavena.
|
14
|
+
Copyright, 2014, by Anatol Pomozov.
|
15
|
+
Copyright, 2014, by Hiroshi Shibata.
|
16
|
+
Copyright, 2014, by Marek Kowalcze.
|
17
|
+
Copyright, 2014, by Sergey Avseyev.
|
18
|
+
Copyright, 2014, by John Thornton.
|
19
|
+
Copyright, 2015-2017, by Tiago Cardoso.
|
20
|
+
Copyright, 2015, by Daniel Berger.
|
21
|
+
Copyright, 2015-2016, by Upekshe Jayasekera.
|
22
|
+
Copyright, 2015, by Vladimir Kochnev.
|
23
|
+
Copyright, 2016-2018, by Jun Aruga.
|
24
|
+
Copyright, 2016, by Omer Katz.
|
25
|
+
Copyright, 2016, by Denis Washington.
|
26
|
+
Copyright, 2016-2021, by Olle Jonsson.
|
27
|
+
Copyright, 2017, by Tao Luo.
|
28
|
+
Copyright, 2017, by Usaku Nakamura.
|
29
|
+
Copyright, 2017-2022, by Gregory Longtin.
|
30
|
+
Copyright, 2017, by Lars Kanis.
|
31
|
+
Copyright, 2017, by Tomoya Ishida.
|
32
|
+
Copyright, 2018-2023, by Samuel Williams.
|
33
|
+
Copyright, 2019, by Cédric Boutillier.
|
34
|
+
Copyright, 2019-2020, by Benoit Daloze.
|
35
|
+
Copyright, 2019, by Jesús Burgos Maciá.
|
36
|
+
Copyright, 2019, by Thomas Kuntz.
|
37
|
+
Copyright, 2019, by Orien Madgwick.
|
38
|
+
Copyright, 2019, by Zhang Kang.
|
39
|
+
Copyright, 2020, by Thomas Dziedzic.
|
40
|
+
Copyright, 2020, by Elad Eyal.
|
41
|
+
Copyright, 2020, by Pedro Paiva.
|
42
|
+
Copyright, 2020, by Boaz Segev.
|
43
|
+
Copyright, 2020, by Charles Oliver Nutter.
|
44
|
+
Copyright, 2020-2021, by Joao Fernandes.
|
45
|
+
Copyright, 2021, by Jun Jiang.
|
46
|
+
Copyright, 2021, by Pavel Lobashov.
|
47
|
+
Copyright, 2021, by Jeffrey Martin.
|
48
|
+
Copyright, 2023, by Pavel Rosický.
|
49
|
+
Copyright, 2023, by Tsimnuj Hawj.
|
50
|
+
Copyright, 2023, by Phillip Aldridge.
|
51
|
+
|
52
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
53
|
+
of this software and associated documentation files (the "Software"), to deal
|
54
|
+
in the Software without restriction, including without limitation the rights
|
55
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
56
|
+
copies of the Software, and to permit persons to whom the Software is
|
57
|
+
furnished to do so, subject to the following conditions:
|
58
|
+
|
59
|
+
The above copyright notice and this permission notice shall be included in all
|
60
|
+
copies or substantial portions of the Software.
|
61
|
+
|
62
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
63
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
64
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
65
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
66
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
67
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
68
|
+
SOFTWARE.
|
69
|
+
|
70
|
+
## libev
|
71
|
+
|
72
|
+
Released under the BSD-2-Clause OR GPL-2.0-or-later license.
|
73
|
+
See [ext/libev/LICENSE] for details.
|
74
|
+
|
75
|
+
Copyright, 2007-2019, by Marc Alexander Lehmann.
|
76
|
+
|
77
|
+
[ext/libev/LICENSE]: https://github.com/socketry/nio4r/blob/master/ext/libev/LICENSE
|
data/nio4r.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.authors = ["Tony Arcieri"]
|
7
7
|
spec.email = ["bascule@gmail.com"]
|
8
8
|
spec.homepage = "https://github.com/socketry/nio4r"
|
9
|
-
spec.
|
9
|
+
spec.licenses = ["MIT", "BSD-2-Clause"]
|
10
10
|
spec.summary = "New IO for Ruby"
|
11
11
|
spec.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
|
12
12
|
Cross-platform asynchronous I/O primitives for scalable network clients
|
@@ -22,10 +22,11 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.metadata = {
|
24
24
|
"bug_tracker_uri" => "https://github.com/socketry/nio4r/issues",
|
25
|
-
"changelog_uri" => "https://github.com/socketry/nio4r/blob/
|
25
|
+
"changelog_uri" => "https://github.com/socketry/nio4r/blob/main/changes.md",
|
26
26
|
"documentation_uri" => "https://www.rubydoc.info/gems/nio4r/#{spec.version}",
|
27
27
|
"source_code_uri" => "https://github.com/socketry/nio4r/tree/v#{spec.version}",
|
28
|
-
"wiki_uri" => "https://github.com/socketry/nio4r/wiki"
|
28
|
+
"wiki_uri" => "https://github.com/socketry/nio4r/wiki",
|
29
|
+
"funding_uri" => "https://github.com/sponsors/ioquatix/",
|
29
30
|
}
|
30
31
|
|
31
32
|
spec.required_ruby_version = ">= 2.4"
|
data/rakelib/extension.rake
CHANGED
data/readme.md
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
# ![nio4r](https://raw.github.com/socketry/nio4r/master/logo.png)
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/nio4r.svg)](http://rubygems.org/gems/nio4r)
|
4
|
+
[![Build Status](https://github.com/socketry/nio4r/workflows/nio4r/badge.svg?branch=master&event=push)](https://github.com/socketry/nio4r/actions?query=workflow:nio4r)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/socketry/nio4r.svg)](https://codeclimate.com/github/socketry/nio4r)
|
6
|
+
[![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/nio4r/2.2.0)
|
7
|
+
|
8
|
+
**New I/O for Ruby (nio4r)**: cross-platform asynchronous I/O primitives for
|
9
|
+
scalable network clients and servers. Modeled after the Java NIO API, but
|
10
|
+
simplified for ease-of-use.
|
11
|
+
|
12
|
+
**nio4r** provides an abstract, cross-platform stateful I/O selector API for Ruby.
|
13
|
+
I/O selectors are the heart of "reactor"-based event loops, and monitor
|
14
|
+
multiple I/O objects for various types of readiness, e.g. ready for reading or
|
15
|
+
writing.
|
16
|
+
|
17
|
+
## Projects using nio4r
|
18
|
+
|
19
|
+
- [ActionCable](https://rubygems.org/gems/actioncable): Rails 5 WebSocket protocol, uses nio4r for a WebSocket server
|
20
|
+
- [Celluloid](https://github.com/celluloid/celluloid-io): Actor-based concurrency framework, uses nio4r for async I/O
|
21
|
+
- [Async](https://github.com/socketry/async): Asynchronous I/O framework for Ruby
|
22
|
+
- [Puma](https://github.com/puma/puma): Ruby/Rack web server built for concurrency
|
23
|
+
|
24
|
+
## Goals
|
25
|
+
|
26
|
+
- Expose high-level interfaces for stateful IO selectors
|
27
|
+
- Keep the API small to maximize both portability and performance across many
|
28
|
+
different OSes and Ruby VMs
|
29
|
+
- Provide inherently thread-safe facilities for working with IO objects
|
30
|
+
|
31
|
+
## Supported platforms
|
32
|
+
|
33
|
+
- Ruby 2.4
|
34
|
+
- Ruby 2.5
|
35
|
+
- Ruby 2.6
|
36
|
+
- Ruby 2.7
|
37
|
+
- Ruby 3.0
|
38
|
+
- [JRuby](https://github.com/jruby/jruby)
|
39
|
+
- [TruffleRuby](https://github.com/oracle/truffleruby)
|
40
|
+
|
41
|
+
## Supported backends
|
42
|
+
|
43
|
+
- **libev**: MRI C extension targeting multiple native IO selector APIs (e.g epoll, kqueue)
|
44
|
+
- **Java NIO**: JRuby extension which wraps the Java NIO subsystem
|
45
|
+
- **Pure Ruby**: `Kernel.select`-based backend that should work on any Ruby interpreter
|
46
|
+
|
47
|
+
## Documentation
|
48
|
+
|
49
|
+
[Please see the nio4r wiki](https://github.com/socketry/nio4r/wiki)
|
50
|
+
for more detailed documentation and usage notes:
|
51
|
+
|
52
|
+
- [Getting Started](https://github.com/socketry/nio4r/wiki/Getting-Started): Introduction to nio4r's components
|
53
|
+
- [Selectors](https://github.com/socketry/nio4r/wiki/Selectors): monitor multiple `IO` objects for readiness events
|
54
|
+
- [Monitors](https://github.com/socketry/nio4r/wiki/Monitors): control interests and inspect readiness for specific `IO` objects
|
55
|
+
- [Byte Buffers](https://github.com/socketry/nio4r/wiki/Byte-Buffers): fixed-size native buffers for high-performance I/O
|
56
|
+
|
57
|
+
See also:
|
58
|
+
|
59
|
+
- [YARD API documentation](http://www.rubydoc.info/gems/nio4r/frames)
|
60
|
+
|
61
|
+
## Non-goals
|
62
|
+
|
63
|
+
**nio4r** is not a full-featured event framework like [EventMachine](https://github.com/eventmachine/eventmachine) or [Cool.io](https://coolio.github.io/).
|
64
|
+
Instead, nio4r is the sort of thing you might write a library like that on
|
65
|
+
top of. nio4r provides a minimal API such that individual Ruby implementers
|
66
|
+
may choose to produce optimized versions for their platform, without having
|
67
|
+
to maintain a large codebase.
|
68
|
+
|
69
|
+
## Releases
|
70
|
+
|
71
|
+
Bump the version first:
|
72
|
+
|
73
|
+
bundle exec bake gem:release:version:patch
|
74
|
+
|
75
|
+
### CRuby
|
76
|
+
|
77
|
+
rake clean
|
78
|
+
rake release
|
79
|
+
|
80
|
+
### JRuby
|
81
|
+
|
82
|
+
You might need to delete `Gemfile.lock` before trying to `bundle install`.
|
83
|
+
|
84
|
+
# Ensure you have the correct JDK:
|
85
|
+
pacman -Syu jdk-openjdk
|
86
|
+
archlinux-java set java-19-openjdk
|
87
|
+
|
88
|
+
# Ensure you are using jruby:
|
89
|
+
chruby jruby
|
90
|
+
bundle update
|
91
|
+
|
92
|
+
# Build the package:
|
93
|
+
rake clean
|
94
|
+
rake compile
|
95
|
+
rake release
|
data/spec/nio/bytebuffer_spec.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2016, by Upekshe Jayasekera.
|
5
|
+
# Copyright, 2016-2017, by Tony Arcieri.
|
6
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
7
|
+
# Copyright, 2020, by Thomas Dziedzic.
|
8
|
+
|
3
9
|
require "spec_helper"
|
4
10
|
|
5
11
|
RSpec.describe NIO::ByteBuffer do
|
data/spec/nio/monitor_spec.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2011-2018, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Logan Bowers.
|
6
|
+
# Copyright, 2015, by Tiago Cardoso.
|
7
|
+
# Copyright, 2015, by Upekshe Jayasekera.
|
8
|
+
# Copyright, 2018-2023, by Samuel Williams.
|
9
|
+
|
3
10
|
require "spec_helper"
|
4
11
|
require "socket"
|
5
12
|
|
@@ -1,5 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2012-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Logan Bowers.
|
6
|
+
# Copyright, 2017, by Gregory Longtin.
|
7
|
+
# Copyright, 2023, by Samuel Williams.
|
8
|
+
|
3
9
|
require "spec_helper"
|
4
10
|
|
5
11
|
RSpec.describe "IO.pipe" do
|
@@ -1,11 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2012-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Logan Bowers.
|
6
|
+
# Copyright, 2017-2020, by Gregory Longtin.
|
7
|
+
# Copyright, 2019, by Cédric Boutillier.
|
8
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
9
|
+
|
3
10
|
require "spec_helper"
|
11
|
+
require "openssl"
|
4
12
|
|
5
13
|
RSpec.describe OpenSSL::SSL::SSLSocket do
|
6
|
-
|
7
|
-
require "openssl"
|
8
|
-
|
9
14
|
before(:all) do
|
10
15
|
@tls = []
|
11
16
|
end
|
@@ -1,5 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2012-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Bernd Ahlers.
|
6
|
+
# Copyright, 2012, by Logan Bowers.
|
7
|
+
# Copyright, 2013, by Tim Carey-Smith.
|
8
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
9
|
+
|
3
10
|
require "spec_helper"
|
4
11
|
|
5
12
|
RSpec.describe TCPSocket do
|
@@ -1,5 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2012-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2017, by Gregory Longtin.
|
6
|
+
# Copyright, 2017, by Olle Jonsson.
|
7
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
8
|
+
# Copyright, 2020, by Thomas Dziedzic.
|
9
|
+
|
3
10
|
require "spec_helper"
|
4
11
|
|
5
12
|
RSpec.describe UDPSocket, if: !defined?(JRUBY_VERSION) do
|
data/spec/nio/selector_spec.rb
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2011-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Logan Bowers.
|
6
|
+
# Copyright, 2013, by Ravil Bayramgalin.
|
7
|
+
# Copyright, 2013, by Tim Carey-Smith.
|
8
|
+
# Copyright, 2015, by Vladimir Kochnev.
|
9
|
+
# Copyright, 2016, by Tiago Cardoso.
|
10
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
11
|
+
# Copyright, 2019, by Jesús Burgos Maciá.
|
12
|
+
# Copyright, 2020, by Thomas Dziedzic.
|
13
|
+
# Copyright, 2021, by Joao Fernandes.
|
14
|
+
|
3
15
|
require "spec_helper"
|
4
16
|
require "timeout"
|
5
17
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2011-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2017, by Gregory Longtin.
|
6
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
7
|
+
# Copyright, 2021, by Joao Fernandes.
|
5
8
|
|
6
9
|
require "nio"
|
7
10
|
require "support/selectable_examples"
|
@@ -1,5 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2012-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Logan Bowers.
|
6
|
+
# Copyright, 2013, by Tim Carey-Smith.
|
7
|
+
# Copyright, 2017-2019, by Gregory Longtin.
|
8
|
+
# Copyright, 2017, by Tiago Cardoso.
|
9
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
10
|
+
|
3
11
|
RSpec.shared_context NIO::Selector do
|
4
12
|
let(:selector) {@selector = NIO::Selector.new}
|
5
13
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nio4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -49,12 +49,12 @@ extra_rdoc_files: []
|
|
49
49
|
files:
|
50
50
|
- ".github/workflows/workflow.yml"
|
51
51
|
- ".gitignore"
|
52
|
+
- ".mailmap"
|
52
53
|
- ".rspec"
|
53
54
|
- ".rubocop.yml"
|
54
|
-
- CHANGES.md
|
55
55
|
- Gemfile
|
56
|
-
- README.md
|
57
56
|
- Rakefile
|
57
|
+
- changes.md
|
58
58
|
- examples/echo_server.rb
|
59
59
|
- ext/libev/Changes
|
60
60
|
- ext/libev/LICENSE
|
@@ -88,11 +88,14 @@ files:
|
|
88
88
|
- lib/nio/monitor.rb
|
89
89
|
- lib/nio/selector.rb
|
90
90
|
- lib/nio/version.rb
|
91
|
+
- lib/nio4r.rb
|
92
|
+
- license.md
|
91
93
|
- logo.png
|
92
94
|
- nio4r.gemspec
|
93
95
|
- rakelib/extension.rake
|
94
96
|
- rakelib/rspec.rake
|
95
97
|
- rakelib/rubocop.rake
|
98
|
+
- readme.md
|
96
99
|
- spec/nio/acceptables_spec.rb
|
97
100
|
- spec/nio/bytebuffer_spec.rb
|
98
101
|
- spec/nio/monitor_spec.rb
|
@@ -106,12 +109,14 @@ files:
|
|
106
109
|
homepage: https://github.com/socketry/nio4r
|
107
110
|
licenses:
|
108
111
|
- MIT
|
112
|
+
- BSD-2-Clause
|
109
113
|
metadata:
|
110
114
|
bug_tracker_uri: https://github.com/socketry/nio4r/issues
|
111
|
-
changelog_uri: https://github.com/socketry/nio4r/blob/
|
112
|
-
documentation_uri: https://www.rubydoc.info/gems/nio4r/2.
|
113
|
-
source_code_uri: https://github.com/socketry/nio4r/tree/v2.
|
115
|
+
changelog_uri: https://github.com/socketry/nio4r/blob/main/changes.md
|
116
|
+
documentation_uri: https://www.rubydoc.info/gems/nio4r/2.7.1
|
117
|
+
source_code_uri: https://github.com/socketry/nio4r/tree/v2.7.1
|
114
118
|
wiki_uri: https://github.com/socketry/nio4r/wiki
|
119
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
115
120
|
post_install_message:
|
116
121
|
rdoc_options: []
|
117
122
|
require_paths:
|
data/README.md
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
# ![nio4r](https://raw.github.com/socketry/nio4r/master/logo.png)
|
2
|
-
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/nio4r.svg)](http://rubygems.org/gems/nio4r)
|
4
|
-
[![Build Status](https://github.com/socketry/nio4r/workflows/nio4r/badge.svg?branch=master&event=push)](https://github.com/socketry/nio4r/actions?query=workflow:nio4r)
|
5
|
-
[![Code Climate](https://codeclimate.com/github/socketry/nio4r.svg)](https://codeclimate.com/github/socketry/nio4r)
|
6
|
-
[![Coverage Status](https://coveralls.io/repos/socketry/nio4r/badge.svg?branch=master)](https://coveralls.io/r/socketry/nio4r)
|
7
|
-
[![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/nio4r/2.2.0)
|
8
|
-
|
9
|
-
**New I/O for Ruby (nio4r)**: cross-platform asynchronous I/O primitives for
|
10
|
-
scalable network clients and servers. Modeled after the Java NIO API, but
|
11
|
-
simplified for ease-of-use.
|
12
|
-
|
13
|
-
**nio4r** provides an abstract, cross-platform stateful I/O selector API for Ruby.
|
14
|
-
I/O selectors are the heart of "reactor"-based event loops, and monitor
|
15
|
-
multiple I/O objects for various types of readiness, e.g. ready for reading or
|
16
|
-
writing.
|
17
|
-
|
18
|
-
## Projects using nio4r
|
19
|
-
|
20
|
-
* [ActionCable]: Rails 5 WebSocket protocol, uses nio4r for a WebSocket server
|
21
|
-
* [Celluloid]: Actor-based concurrency framework, uses nio4r for async I/O
|
22
|
-
* [Async]: Asynchronous I/O framework for Ruby
|
23
|
-
* [Puma]: Ruby/Rack web server built for concurrency
|
24
|
-
|
25
|
-
[ActionCable]: https://rubygems.org/gems/actioncable
|
26
|
-
[Celluloid]: https://github.com/celluloid/celluloid-io
|
27
|
-
[Async]: https://github.com/socketry/async
|
28
|
-
[Puma]: https://github.com/puma/puma
|
29
|
-
|
30
|
-
## Goals
|
31
|
-
|
32
|
-
* Expose high-level interfaces for stateful IO selectors
|
33
|
-
* Keep the API small to maximize both portability and performance across many
|
34
|
-
different OSes and Ruby VMs
|
35
|
-
* Provide inherently thread-safe facilities for working with IO objects
|
36
|
-
|
37
|
-
## Supported platforms
|
38
|
-
|
39
|
-
* Ruby 2.4
|
40
|
-
* Ruby 2.5
|
41
|
-
* Ruby 2.6
|
42
|
-
* Ruby 2.7
|
43
|
-
* Ruby 3.0
|
44
|
-
* [JRuby](https://github.com/jruby/jruby)
|
45
|
-
* [TruffleRuby](https://github.com/oracle/truffleruby)
|
46
|
-
|
47
|
-
## Supported backends
|
48
|
-
|
49
|
-
* **libev**: MRI C extension targeting multiple native IO selector APIs (e.g epoll, kqueue)
|
50
|
-
* **Java NIO**: JRuby extension which wraps the Java NIO subsystem
|
51
|
-
* **Pure Ruby**: `Kernel.select`-based backend that should work on any Ruby interpreter
|
52
|
-
|
53
|
-
## Documentation
|
54
|
-
|
55
|
-
[Please see the nio4r wiki](https://github.com/socketry/nio4r/wiki)
|
56
|
-
for more detailed documentation and usage notes:
|
57
|
-
|
58
|
-
* [Getting Started]: Introduction to nio4r's components
|
59
|
-
* [Selectors]: monitor multiple `IO` objects for readiness events
|
60
|
-
* [Monitors]: control interests and inspect readiness for specific `IO` objects
|
61
|
-
* [Byte Buffers]: fixed-size native buffers for high-performance I/O
|
62
|
-
|
63
|
-
[Getting Started]: https://github.com/socketry/nio4r/wiki/Getting-Started
|
64
|
-
[Selectors]: https://github.com/socketry/nio4r/wiki/Selectors
|
65
|
-
[Monitors]: https://github.com/socketry/nio4r/wiki/Monitors
|
66
|
-
[Byte Buffers]: https://github.com/socketry/nio4r/wiki/Byte-Buffers
|
67
|
-
|
68
|
-
See also:
|
69
|
-
|
70
|
-
* [YARD API documentation](http://www.rubydoc.info/gems/nio4r/frames)
|
71
|
-
|
72
|
-
## Non-goals
|
73
|
-
|
74
|
-
**nio4r** is not a full-featured event framework like [EventMachine] or [Cool.io].
|
75
|
-
Instead, nio4r is the sort of thing you might write a library like that on
|
76
|
-
top of. nio4r provides a minimal API such that individual Ruby implementers
|
77
|
-
may choose to produce optimized versions for their platform, without having
|
78
|
-
to maintain a large codebase.
|
79
|
-
|
80
|
-
[EventMachine]: https://github.com/eventmachine/eventmachine
|
81
|
-
[Cool.io]: https://coolio.github.io/
|
82
|
-
|
83
|
-
## Releases
|
84
|
-
|
85
|
-
### CRuby
|
86
|
-
|
87
|
-
```
|
88
|
-
rake clean
|
89
|
-
rake release
|
90
|
-
```
|
91
|
-
|
92
|
-
### JRuby
|
93
|
-
|
94
|
-
You might need to delete `Gemfile.lock` before trying to `bundle install`.
|
95
|
-
|
96
|
-
```
|
97
|
-
rake clean
|
98
|
-
rake compile
|
99
|
-
rake release
|
100
|
-
```
|
101
|
-
|
102
|
-
## License
|
103
|
-
|
104
|
-
Released under the MIT license.
|
105
|
-
|
106
|
-
Copyright, 2019, by Tony Arcieri.
|
107
|
-
Copyright, 2019, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
108
|
-
|
109
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
110
|
-
of this software and associated documentation files (the "Software"), to deal
|
111
|
-
in the Software without restriction, including without limitation the rights
|
112
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
113
|
-
copies of the Software, and to permit persons to whom the Software is
|
114
|
-
furnished to do so, subject to the following conditions:
|
115
|
-
|
116
|
-
The above copyright notice and this permission notice shall be included in
|
117
|
-
all copies or substantial portions of the Software.
|
118
|
-
|
119
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
120
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
121
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
122
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
123
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
124
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
125
|
-
THE SOFTWARE.
|
126
|
-
|
127
|
-
### libev
|
128
|
-
|
129
|
-
Released under the BSD license. See [ext/libev/LICENSE] for details.
|
130
|
-
|
131
|
-
Copyright, 2007-2019, by Marc Alexander Lehmann.
|
132
|
-
|
133
|
-
[ext/libev/LICENSE]: https://github.com/socketry/nio4r/blob/master/ext/libev/LICENSE
|