nio4r 2.5.7 → 2.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +2 -0
- data/{CHANGES.md → changes.md} +48 -0
- data/ext/libev/ev_iouring.c +2 -2
- 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 +7 -0
- data/license.md +80 -0
- data/readme.md +91 -0
- data.tar.gz.sig +0 -0
- metadata +95 -74
- metadata.gz.sig +0 -0
- data/.github/workflows/workflow.yml +0 -47
- data/.gitignore +0 -21
- data/.rspec +0 -4
- data/.rubocop.yml +0 -100
- data/Gemfile +0 -19
- data/README.md +0 -133
- data/Rakefile +0 -8
- data/examples/echo_server.rb +0 -47
- data/logo.png +0 -0
- data/nio4r.gemspec +0 -42
- data/rakelib/extension.rake +0 -15
- data/rakelib/rspec.rake +0 -9
- data/rakelib/rubocop.rake +0 -5
- data/spec/nio/acceptables_spec.rb +0 -32
- data/spec/nio/bytebuffer_spec.rb +0 -354
- data/spec/nio/monitor_spec.rb +0 -162
- data/spec/nio/selectables/pipe_spec.rb +0 -47
- data/spec/nio/selectables/ssl_socket_spec.rb +0 -194
- data/spec/nio/selectables/tcp_socket_spec.rb +0 -101
- data/spec/nio/selectables/udp_socket_spec.rb +0 -48
- data/spec/nio/selector_spec.rb +0 -240
- data/spec/spec_helper.rb +0 -20
- data/spec/support/selectable_examples.rb +0 -85
metadata
CHANGED
@@ -1,61 +1,102 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nio4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
|
+
- Samuel Williams
|
9
|
+
- Olle Jonsson
|
10
|
+
- Gregory Longtin
|
11
|
+
- Tiago Cardoso
|
12
|
+
- Joao Fernandes
|
13
|
+
- Thomas Dziedzic
|
14
|
+
- Boaz Segev
|
15
|
+
- Logan Bowers
|
16
|
+
- Pedro Paiva
|
17
|
+
- Jun Aruga
|
18
|
+
- Omer Katz
|
19
|
+
- Upekshe Jayasekera
|
20
|
+
- Tim Carey-Smith
|
21
|
+
- Benoit Daloze
|
22
|
+
- Sergey Avseyev
|
23
|
+
- Tomoya Ishida
|
24
|
+
- Usaku Nakamura
|
25
|
+
- Cédric Boutillier
|
26
|
+
- Daniel Berger
|
27
|
+
- Dirkjan Bussink
|
28
|
+
- Hiroshi Shibata
|
29
|
+
- Jesús Burgos Maciá
|
30
|
+
- Luis Lavena
|
31
|
+
- Pavel Rosický
|
32
|
+
- Sadayuki Furuhashi
|
33
|
+
- Stephen von Takach
|
34
|
+
- Vladimir Kochnev
|
35
|
+
- Vít Ondruch
|
36
|
+
- Anatol Pomozov
|
37
|
+
- Bernd Ahlers
|
38
|
+
- Charles Oliver Nutter
|
39
|
+
- Denis Washington
|
40
|
+
- Elad Eyal
|
41
|
+
- Jean byroot Boussier
|
42
|
+
- Jeffrey Martin
|
43
|
+
- John Thornton
|
44
|
+
- Jun Jiang
|
45
|
+
- Lars Kanis
|
46
|
+
- Marek Kowalcze
|
47
|
+
- Maxime Demolin
|
48
|
+
- Orien Madgwick
|
49
|
+
- Pavel Lobashov
|
50
|
+
- Per Lundberg
|
51
|
+
- Phillip Aldridge
|
52
|
+
- Ravil Bayramgalin
|
53
|
+
- Shannon Skipper
|
54
|
+
- Tao Luo
|
55
|
+
- Thomas Kuntz
|
56
|
+
- Tsimnuj Hawj
|
57
|
+
- Zhang Kang
|
8
58
|
autorequire:
|
9
59
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
60
|
+
cert_chain:
|
61
|
+
- |
|
62
|
+
-----BEGIN CERTIFICATE-----
|
63
|
+
MIIE2DCCA0CgAwIBAgIBATANBgkqhkiG9w0BAQsFADBhMRgwFgYDVQQDDA9zYW11
|
64
|
+
ZWwud2lsbGlhbXMxHTAbBgoJkiaJk/IsZAEZFg1vcmlvbnRyYW5zZmVyMRIwEAYK
|
65
|
+
CZImiZPyLGQBGRYCY28xEjAQBgoJkiaJk/IsZAEZFgJuejAeFw0yMjA4MDYwNDUz
|
66
|
+
MjRaFw0zMjA4MDMwNDUzMjRaMGExGDAWBgNVBAMMD3NhbXVlbC53aWxsaWFtczEd
|
67
|
+
MBsGCgmSJomT8ixkARkWDW9yaW9udHJhbnNmZXIxEjAQBgoJkiaJk/IsZAEZFgJj
|
68
|
+
bzESMBAGCgmSJomT8ixkARkWAm56MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIB
|
69
|
+
igKCAYEAomvSopQXQ24+9DBB6I6jxRI2auu3VVb4nOjmmHq7XWM4u3HL+pni63X2
|
70
|
+
9qZdoq9xt7H+RPbwL28LDpDNflYQXoOhoVhQ37Pjn9YDjl8/4/9xa9+NUpl9XDIW
|
71
|
+
sGkaOY0eqsQm1pEWkHJr3zn/fxoKPZPfaJOglovdxf7dgsHz67Xgd/ka+Wo1YqoE
|
72
|
+
e5AUKRwUuvaUaumAKgPH+4E4oiLXI4T1Ff5Q7xxv6yXvHuYtlMHhYfgNn8iiW8WN
|
73
|
+
XibYXPNP7NtieSQqwR/xM6IRSoyXKuS+ZNGDPUUGk8RoiV/xvVN4LrVm9upSc0ss
|
74
|
+
RZ6qwOQmXCo/lLcDUxJAgG95cPw//sI00tZan75VgsGzSWAOdjQpFM0l4dxvKwHn
|
75
|
+
tUeT3ZsAgt0JnGqNm2Bkz81kG4A2hSyFZTFA8vZGhp+hz+8Q573tAR89y9YJBdYM
|
76
|
+
zp0FM4zwMNEUwgfRzv1tEVVUEXmoFCyhzonUUw4nE4CFu/sE3ffhjKcXcY//qiSW
|
77
|
+
xm4erY3XAgMBAAGjgZowgZcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
78
|
+
BBYEFO9t7XWuFf2SKLmuijgqR4sGDlRsMC4GA1UdEQQnMCWBI3NhbXVlbC53aWxs
|
79
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MC4GA1UdEgQnMCWBI3NhbXVlbC53aWxs
|
80
|
+
aWFtc0BvcmlvbnRyYW5zZmVyLmNvLm56MA0GCSqGSIb3DQEBCwUAA4IBgQB5sxkE
|
81
|
+
cBsSYwK6fYpM+hA5B5yZY2+L0Z+27jF1pWGgbhPH8/FjjBLVn+VFok3CDpRqwXCl
|
82
|
+
xCO40JEkKdznNy2avOMra6PFiQyOE74kCtv7P+Fdc+FhgqI5lMon6tt9rNeXmnW/
|
83
|
+
c1NaMRdxy999hmRGzUSFjozcCwxpy/LwabxtdXwXgSay4mQ32EDjqR1TixS1+smp
|
84
|
+
8C/NCWgpIfzpHGJsjvmH2wAfKtTTqB9CVKLCWEnCHyCaRVuKkrKjqhYCdmMBqCws
|
85
|
+
JkxfQWC+jBVeG9ZtPhQgZpfhvh+6hMhraUYRQ6XGyvBqEUe+yo6DKIT3MtGE2+CP
|
86
|
+
eX9i9ZWBydWb8/rvmwmX2kkcBbX0hZS1rcR593hGc61JR6lvkGYQ2MYskBveyaxt
|
87
|
+
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
88
|
+
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
89
|
+
-----END CERTIFICATE-----
|
90
|
+
date: 2024-05-07 00:00:00.000000000 Z
|
91
|
+
dependencies: []
|
92
|
+
description:
|
43
93
|
email:
|
44
|
-
- bascule@gmail.com
|
45
94
|
executables: []
|
46
95
|
extensions:
|
47
96
|
- ext/nio4r/extconf.rb
|
48
97
|
extra_rdoc_files: []
|
49
98
|
files:
|
50
|
-
-
|
51
|
-
- ".gitignore"
|
52
|
-
- ".rspec"
|
53
|
-
- ".rubocop.yml"
|
54
|
-
- CHANGES.md
|
55
|
-
- Gemfile
|
56
|
-
- README.md
|
57
|
-
- Rakefile
|
58
|
-
- examples/echo_server.rb
|
99
|
+
- changes.md
|
59
100
|
- ext/libev/Changes
|
60
101
|
- ext/libev/LICENSE
|
61
102
|
- ext/libev/README
|
@@ -88,29 +129,19 @@ files:
|
|
88
129
|
- lib/nio/monitor.rb
|
89
130
|
- lib/nio/selector.rb
|
90
131
|
- lib/nio/version.rb
|
91
|
-
-
|
92
|
-
-
|
93
|
-
-
|
94
|
-
- rakelib/rspec.rake
|
95
|
-
- rakelib/rubocop.rake
|
96
|
-
- spec/nio/acceptables_spec.rb
|
97
|
-
- spec/nio/bytebuffer_spec.rb
|
98
|
-
- spec/nio/monitor_spec.rb
|
99
|
-
- spec/nio/selectables/pipe_spec.rb
|
100
|
-
- spec/nio/selectables/ssl_socket_spec.rb
|
101
|
-
- spec/nio/selectables/tcp_socket_spec.rb
|
102
|
-
- spec/nio/selectables/udp_socket_spec.rb
|
103
|
-
- spec/nio/selector_spec.rb
|
104
|
-
- spec/spec_helper.rb
|
105
|
-
- spec/support/selectable_examples.rb
|
132
|
+
- lib/nio4r.rb
|
133
|
+
- license.md
|
134
|
+
- readme.md
|
106
135
|
homepage: https://github.com/socketry/nio4r
|
107
136
|
licenses:
|
108
137
|
- MIT
|
138
|
+
- BSD-2-Clause
|
109
139
|
metadata:
|
110
140
|
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
|
113
|
-
|
141
|
+
changelog_uri: https://github.com/socketry/nio4r/blob/main/changes.md
|
142
|
+
documentation_uri: https://www.rubydoc.info/gems/nio4r
|
143
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
144
|
+
source_code_uri: https://github.com/socketry/nio4r.git
|
114
145
|
wiki_uri: https://github.com/socketry/nio4r/wiki
|
115
146
|
post_install_message:
|
116
147
|
rdoc_options: []
|
@@ -127,18 +158,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
158
|
- !ruby/object:Gem::Version
|
128
159
|
version: '0'
|
129
160
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
161
|
+
rubygems_version: 3.5.9
|
131
162
|
signing_key:
|
132
163
|
specification_version: 4
|
133
164
|
summary: New IO for Ruby
|
134
|
-
test_files:
|
135
|
-
- spec/nio/acceptables_spec.rb
|
136
|
-
- spec/nio/bytebuffer_spec.rb
|
137
|
-
- spec/nio/monitor_spec.rb
|
138
|
-
- spec/nio/selectables/pipe_spec.rb
|
139
|
-
- spec/nio/selectables/ssl_socket_spec.rb
|
140
|
-
- spec/nio/selectables/tcp_socket_spec.rb
|
141
|
-
- spec/nio/selectables/udp_socket_spec.rb
|
142
|
-
- spec/nio/selector_spec.rb
|
143
|
-
- spec/spec_helper.rb
|
144
|
-
- spec/support/selectable_examples.rb
|
165
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|
@@ -1,47 +0,0 @@
|
|
1
|
-
name: nio4r
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
name: >-
|
8
|
-
${{matrix.os}}, ${{matrix.ruby}}
|
9
|
-
env:
|
10
|
-
CI: true
|
11
|
-
TESTOPTS: -v
|
12
|
-
|
13
|
-
runs-on: ${{matrix.os}}
|
14
|
-
strategy:
|
15
|
-
fail-fast: false
|
16
|
-
matrix:
|
17
|
-
os: [ ubuntu-20.04, ubuntu-18.04, macos-10.15, windows-2019 ]
|
18
|
-
ruby: [ head, 3.0, 2.7, 2.6, 2.5, 2.4, jruby, truffleruby-head ]
|
19
|
-
include:
|
20
|
-
- { os: ubuntu-16.04, ruby: 3.0 }
|
21
|
-
- { os: ubuntu-16.04, ruby: 2.4 }
|
22
|
-
exclude:
|
23
|
-
- { os: windows-2019, ruby: head }
|
24
|
-
- { os: windows-2019, ruby: jruby }
|
25
|
-
- { os: windows-2019, ruby: truffleruby-head }
|
26
|
-
|
27
|
-
steps:
|
28
|
-
- name: repo checkout
|
29
|
-
uses: actions/checkout@v2
|
30
|
-
|
31
|
-
- name: load ruby
|
32
|
-
uses: ruby/setup-ruby@v1
|
33
|
-
with:
|
34
|
-
ruby-version: ${{matrix.ruby}}
|
35
|
-
|
36
|
-
- name: RubyGems, Bundler Update
|
37
|
-
run: gem update --system --no-document --conservative
|
38
|
-
|
39
|
-
- name: bundle install
|
40
|
-
run: bundle install --path .bundle/gems --without development
|
41
|
-
|
42
|
-
- name: compile
|
43
|
-
run: bundle exec rake compile
|
44
|
-
|
45
|
-
- name: test
|
46
|
-
run: bundle exec rake spec
|
47
|
-
timeout-minutes: 10
|
data/.gitignore
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
|
-
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
|
-
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
lib/nio4r_ext.*
|
19
|
-
ext/**/*.o
|
20
|
-
ext/**/nio4r_ext.*
|
21
|
-
.rspec_status
|
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: 2.4
|
3
|
-
DisplayCopNames: true
|
4
|
-
|
5
|
-
Layout/HashAlignment:
|
6
|
-
Enabled: false
|
7
|
-
|
8
|
-
Layout/LineLength:
|
9
|
-
Max: 128
|
10
|
-
|
11
|
-
Layout/SpaceAroundMethodCallOperator:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
Layout/SpaceInsideBlockBraces:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
Style/IfUnlessModifier:
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
Style/UnpackFirst:
|
21
|
-
Enabled: false
|
22
|
-
|
23
|
-
#
|
24
|
-
# Lint
|
25
|
-
#
|
26
|
-
|
27
|
-
Lint/SuppressedException:
|
28
|
-
Enabled: false
|
29
|
-
|
30
|
-
Lint/Loop:
|
31
|
-
Enabled: false
|
32
|
-
|
33
|
-
Lint/RaiseException:
|
34
|
-
Enabled: false
|
35
|
-
|
36
|
-
Lint/StructNewOverride:
|
37
|
-
Enabled: false
|
38
|
-
#
|
39
|
-
# Metrics
|
40
|
-
#
|
41
|
-
|
42
|
-
Metrics/AbcSize:
|
43
|
-
Max: 35
|
44
|
-
|
45
|
-
Metrics/BlockLength:
|
46
|
-
Max: 128
|
47
|
-
Enabled: false
|
48
|
-
|
49
|
-
Metrics/ClassLength:
|
50
|
-
Max: 128
|
51
|
-
|
52
|
-
Metrics/MethodLength:
|
53
|
-
CountComments: false
|
54
|
-
Max: 50
|
55
|
-
|
56
|
-
Metrics/CyclomaticComplexity:
|
57
|
-
Max: 15
|
58
|
-
|
59
|
-
Metrics/PerceivedComplexity:
|
60
|
-
Max: 15
|
61
|
-
|
62
|
-
#
|
63
|
-
# Style
|
64
|
-
#
|
65
|
-
|
66
|
-
Style/ExponentialNotation:
|
67
|
-
Enabled: false
|
68
|
-
|
69
|
-
Style/FormatStringToken:
|
70
|
-
Enabled: false
|
71
|
-
|
72
|
-
Style/FrozenStringLiteralComment:
|
73
|
-
Enabled: true
|
74
|
-
|
75
|
-
Style/GlobalVars:
|
76
|
-
Enabled: false
|
77
|
-
|
78
|
-
Style/HashEachMethods:
|
79
|
-
Enabled: false
|
80
|
-
|
81
|
-
Style/HashTransformKeys:
|
82
|
-
Enabled: false
|
83
|
-
|
84
|
-
Style/HashTransformValues:
|
85
|
-
Enabled: false
|
86
|
-
|
87
|
-
Style/NumericPredicate:
|
88
|
-
Enabled: false
|
89
|
-
|
90
|
-
Style/RescueModifier:
|
91
|
-
Enabled: false
|
92
|
-
|
93
|
-
Style/SafeNavigation:
|
94
|
-
Enabled: false
|
95
|
-
|
96
|
-
Style/StringLiterals:
|
97
|
-
EnforcedStyle: double_quotes
|
98
|
-
|
99
|
-
Style/TrivialAccessors:
|
100
|
-
Enabled: false
|
data/Gemfile
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gemspec
|
6
|
-
|
7
|
-
gem "jruby-openssl" if defined? JRUBY_VERSION
|
8
|
-
|
9
|
-
group :development do
|
10
|
-
gem "guard-rspec", require: false
|
11
|
-
gem "pry", require: false
|
12
|
-
end
|
13
|
-
|
14
|
-
group :development, :test do
|
15
|
-
gem "coveralls", require: false
|
16
|
-
gem "rake-compiler", require: false
|
17
|
-
gem "rspec", "~> 3.7", require: false
|
18
|
-
gem "rubocop", "0.82.0", require: false
|
19
|
-
end
|
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
|
data/Rakefile
DELETED
data/examples/echo_server.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
$LOAD_PATH.push File.expand_path("../lib", __dir__)
|
5
|
-
require "nio"
|
6
|
-
require "socket"
|
7
|
-
|
8
|
-
# Echo server example written with nio4r
|
9
|
-
class EchoServer
|
10
|
-
def initialize(host, port)
|
11
|
-
@selector = NIO::Selector.new
|
12
|
-
|
13
|
-
puts "Listening on #{host}:#{port}"
|
14
|
-
@server = TCPServer.new(host, port)
|
15
|
-
|
16
|
-
monitor = @selector.register(@server, :r)
|
17
|
-
monitor.value = proc { accept }
|
18
|
-
end
|
19
|
-
|
20
|
-
def run
|
21
|
-
loop do
|
22
|
-
@selector.select { |monitor| monitor.value.call }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def accept
|
27
|
-
socket = @server.accept
|
28
|
-
_, port, host = socket.peeraddr
|
29
|
-
puts "*** #{host}:#{port} connected"
|
30
|
-
|
31
|
-
monitor = @selector.register(socket, :r)
|
32
|
-
monitor.value = proc { read(socket) }
|
33
|
-
end
|
34
|
-
|
35
|
-
def read(socket)
|
36
|
-
data = socket.read_nonblock(4096)
|
37
|
-
socket.write_nonblock(data)
|
38
|
-
rescue EOFError
|
39
|
-
_, port, host = socket.peeraddr
|
40
|
-
puts "*** #{host}:#{port} disconnected"
|
41
|
-
|
42
|
-
@selector.deregister(socket)
|
43
|
-
socket.close
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
EchoServer.new("localhost", 1234).run if $PROGRAM_NAME == __FILE__
|
data/logo.png
DELETED
Binary file
|
data/nio4r.gemspec
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require File.expand_path("lib/nio/version", __dir__)
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.authors = ["Tony Arcieri"]
|
7
|
-
spec.email = ["bascule@gmail.com"]
|
8
|
-
spec.homepage = "https://github.com/socketry/nio4r"
|
9
|
-
spec.license = "MIT"
|
10
|
-
spec.summary = "New IO for Ruby"
|
11
|
-
spec.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
|
12
|
-
Cross-platform asynchronous I/O primitives for scalable network clients
|
13
|
-
and servers. Inspired by the Java NIO API, but simplified for ease-of-use.
|
14
|
-
DESCRIPTION
|
15
|
-
|
16
|
-
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
17
|
-
spec.files = `git ls-files`.split("\n")
|
18
|
-
spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
-
spec.name = "nio4r"
|
20
|
-
spec.require_paths = ["lib"]
|
21
|
-
spec.version = NIO::VERSION
|
22
|
-
|
23
|
-
spec.metadata = {
|
24
|
-
"bug_tracker_uri" => "https://github.com/socketry/nio4r/issues",
|
25
|
-
"changelog_uri" => "https://github.com/socketry/nio4r/blob/master/CHANGES.md",
|
26
|
-
"documentation_uri" => "https://www.rubydoc.info/gems/nio4r/#{spec.version}",
|
27
|
-
"source_code_uri" => "https://github.com/socketry/nio4r/tree/v#{spec.version}",
|
28
|
-
"wiki_uri" => "https://github.com/socketry/nio4r/wiki"
|
29
|
-
}
|
30
|
-
|
31
|
-
spec.required_ruby_version = ">= 2.4"
|
32
|
-
|
33
|
-
if defined? JRUBY_VERSION
|
34
|
-
spec.files << "lib/nio4r_ext.jar"
|
35
|
-
spec.platform = "java"
|
36
|
-
else
|
37
|
-
spec.extensions = ["ext/nio4r/extconf.rb"]
|
38
|
-
end
|
39
|
-
|
40
|
-
spec.add_development_dependency "bundler"
|
41
|
-
spec.add_development_dependency "rake"
|
42
|
-
end
|
data/rakelib/extension.rake
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
if defined? JRUBY_VERSION
|
4
|
-
require "rake/javaextensiontask"
|
5
|
-
Rake::JavaExtensionTask.new("nio4r_ext") do |ext|
|
6
|
-
ext.ext_dir = "ext/nio4r"
|
7
|
-
ext.source_version = "1.8"
|
8
|
-
ext.target_version = "1.8"
|
9
|
-
end
|
10
|
-
else
|
11
|
-
require "rake/extensiontask"
|
12
|
-
Rake::ExtensionTask.new("nio4r_ext") do |ext|
|
13
|
-
ext.ext_dir = "ext/nio4r"
|
14
|
-
end
|
15
|
-
end
|
data/rakelib/rspec.rake
DELETED