david 0.3.0.pre → 0.3.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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +24 -0
- data/Gemfile +11 -7
- data/Gemfile.lock +155 -19
- data/README.md +21 -3
- data/Rakefile +5 -0
- data/TODO.md +73 -0
- data/benchmarks/Gemfile +4 -0
- data/benchmarks/Gemfile.lock +31 -0
- data/benchmarks/rps.rb +20 -0
- data/bin/david +9 -4
- data/config.ru +4 -0
- data/david.gemspec +10 -4
- data/experiments/mcast.rb +37 -0
- data/experiments/structs.rb +45 -0
- data/{test.rb → experiments/test.rb} +0 -0
- data/lib/david.rb +15 -4
- data/lib/david/actor.rb +18 -0
- data/lib/david/garbage_collector.rb +35 -0
- data/lib/david/observe.rb +102 -0
- data/lib/david/rails/action_controller/base.rb +11 -0
- data/lib/david/railties/config.rb +20 -1
- data/lib/david/railties/middleware.rb +18 -6
- data/lib/david/request.rb +80 -0
- data/lib/david/resource_discovery.rb +92 -0
- data/lib/david/resource_discovery_proxy.rb +13 -0
- data/lib/david/server.rb +72 -27
- data/lib/david/server/constants.rb +48 -0
- data/lib/david/server/deduplication.rb +21 -0
- data/lib/david/server/mapping.rb +64 -12
- data/lib/david/server/multicast.rb +54 -0
- data/lib/david/server/options.rb +32 -0
- data/lib/david/server/respond.rb +146 -0
- data/lib/david/server/utility.rb +1 -6
- data/lib/david/show_exceptions.rb +52 -0
- data/lib/david/version.rb +2 -1
- data/lib/rack/handler/david.rb +16 -6
- data/lib/rack/hello_world.rb +23 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +29 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +37 -0
- data/spec/dummy/config/environments/production.rb +78 -0
- data/spec/dummy/config/environments/test.rb +39 -0
- data/spec/dummy/config/initializers/assets.rb +8 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/guerilla_rack_handler_spec.rb +16 -0
- data/spec/mapping_spec.rb +56 -0
- data/spec/observe_spec.rb +111 -0
- data/spec/perf/server_perf_spec.rb +15 -9
- data/spec/resource_discovery_spec.rb +65 -0
- data/spec/server_spec.rb +306 -0
- data/spec/spec_helper.rb +43 -1
- data/spec/utility_spec.rb +8 -0
- metadata +195 -38
- data/lib/david/server/response.rb +0 -124
- data/lib/david/well_known.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf99b7a04f88ad84fc39ae748528fc0555d340a4
|
4
|
+
data.tar.gz: db0a00feed99717987b4b5e72e399e0c85d2accb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17f584e9e2d9f2000a20eb0a22a963b42b8b4e82b9438c99e46d04be2e37c7670e35d739bd13850c45426a7c7e83837b74f266a76f4e30d117dc52a59ed08f9b
|
7
|
+
data.tar.gz: ca6cc59e8fedfa63392b6b8edbbf15076a0809e11433b9dcdeaf80d212ba696ddd0a0bc0ee7d5dc4e593ce22b3e16d7ab3574d7970ece21a6ca932379724cbc6
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.log
|
data/.travis.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
os:
|
4
|
+
- linux
|
5
|
+
- osx
|
6
|
+
|
7
|
+
rvm:
|
8
|
+
- 2.2
|
9
|
+
- jruby
|
10
|
+
- rbx-head
|
11
|
+
|
12
|
+
matrix:
|
13
|
+
fast_finish: true
|
14
|
+
allow_failures:
|
15
|
+
- os: osx
|
16
|
+
- rvm: jruby
|
17
|
+
- rvm: rbx-head
|
18
|
+
|
19
|
+
notifications:
|
20
|
+
email: false
|
21
|
+
|
22
|
+
script:
|
23
|
+
- bundle exec rake build
|
24
|
+
- DEBUG=1 bundle exec rspec -t ~multicast:ipv6 -t ~performance
|
data/Gemfile
CHANGED
@@ -1,12 +1,16 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
gem '
|
7
|
-
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :cbor do
|
6
|
+
gem 'cbor', platforms: :ruby
|
7
|
+
end
|
8
|
+
|
9
|
+
group :development do
|
10
|
+
gem 'sqlite3', platforms: :ruby
|
11
|
+
gem 'activerecord-jdbcsqlite3-adapter', platforms: :jruby
|
12
|
+
end
|
8
13
|
|
9
14
|
group :test do
|
10
|
-
gem '
|
11
|
-
gem 'rspec'
|
15
|
+
gem 'coveralls', require: false
|
12
16
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,51 +1,187 @@
|
|
1
1
|
PATH
|
2
|
-
remote:
|
2
|
+
remote: .
|
3
3
|
specs:
|
4
|
-
|
5
|
-
celluloid-io (~> 0.16)
|
6
|
-
|
4
|
+
david (0.3.0.pre)
|
5
|
+
celluloid-io (~> 0.16, >= 0.16.1)
|
6
|
+
coap (~> 0.1)
|
7
|
+
rack (~> 1.5)
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
|
-
|
12
|
+
actionmailer (4.2.0)
|
13
|
+
actionpack (= 4.2.0)
|
14
|
+
actionview (= 4.2.0)
|
15
|
+
activejob (= 4.2.0)
|
16
|
+
mail (~> 2.5, >= 2.5.4)
|
17
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
18
|
+
actionpack (4.2.0)
|
19
|
+
actionview (= 4.2.0)
|
20
|
+
activesupport (= 4.2.0)
|
21
|
+
rack (~> 1.6.0)
|
22
|
+
rack-test (~> 0.6.2)
|
23
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
24
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
25
|
+
actionview (4.2.0)
|
26
|
+
activesupport (= 4.2.0)
|
27
|
+
builder (~> 3.1)
|
28
|
+
erubis (~> 2.7.0)
|
29
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
30
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
31
|
+
activejob (4.2.0)
|
32
|
+
activesupport (= 4.2.0)
|
33
|
+
globalid (>= 0.3.0)
|
34
|
+
activemodel (4.2.0)
|
35
|
+
activesupport (= 4.2.0)
|
36
|
+
builder (~> 3.1)
|
37
|
+
activerecord (4.2.0)
|
38
|
+
activemodel (= 4.2.0)
|
39
|
+
activesupport (= 4.2.0)
|
40
|
+
arel (~> 6.0)
|
41
|
+
activerecord-jdbc-adapter (1.3.13)
|
42
|
+
activerecord (>= 2.2)
|
43
|
+
activerecord-jdbcsqlite3-adapter (1.3.13)
|
44
|
+
activerecord-jdbc-adapter (~> 1.3.13)
|
45
|
+
jdbc-sqlite3 (>= 3.7.2, < 3.9)
|
46
|
+
activesupport (4.2.0)
|
47
|
+
i18n (~> 0.7)
|
48
|
+
json (~> 1.7, >= 1.7.7)
|
49
|
+
minitest (~> 5.1)
|
50
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
51
|
+
tzinfo (~> 1.1)
|
52
|
+
arel (6.0.0)
|
53
|
+
builder (3.2.2)
|
54
|
+
cbor (0.5.9.0)
|
12
55
|
celluloid (0.16.0)
|
13
56
|
timers (~> 4.0.0)
|
14
|
-
celluloid-io (0.16.
|
57
|
+
celluloid-io (0.16.1)
|
15
58
|
celluloid (>= 0.16.0)
|
16
59
|
nio4r (>= 1.0.0)
|
60
|
+
coap (0.1.0)
|
61
|
+
celluloid-io (~> 0.16, >= 0.16.1)
|
62
|
+
resolv-ipv6favor (~> 0)
|
63
|
+
coveralls (0.7.1)
|
64
|
+
multi_json (~> 1.3)
|
65
|
+
rest-client
|
66
|
+
simplecov (>= 0.7)
|
67
|
+
term-ansicolor
|
68
|
+
thor
|
17
69
|
diff-lcs (1.2.5)
|
70
|
+
docile (1.1.5)
|
71
|
+
erubis (2.7.0)
|
72
|
+
globalid (0.3.0)
|
73
|
+
activesupport (>= 4.1.0)
|
74
|
+
hike (1.2.3)
|
18
75
|
hitimes (1.2.2)
|
19
76
|
hitimes (1.2.2-java)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
77
|
+
i18n (0.7.0)
|
78
|
+
jdbc-sqlite3 (3.8.7)
|
79
|
+
json (1.8.2)
|
80
|
+
json (1.8.2-java)
|
81
|
+
loofah (2.0.1)
|
82
|
+
nokogiri (>= 1.5.9)
|
83
|
+
mail (2.6.3)
|
84
|
+
mime-types (>= 1.16, < 3)
|
85
|
+
mime-types (2.4.3)
|
86
|
+
mini_portile (0.6.2)
|
87
|
+
minitest (5.5.1)
|
88
|
+
multi_json (1.10.1)
|
89
|
+
netrc (0.10.2)
|
90
|
+
nio4r (1.1.0)
|
91
|
+
nio4r (1.1.0-java)
|
92
|
+
nokogiri (1.6.5)
|
93
|
+
mini_portile (~> 0.6.0)
|
94
|
+
nokogiri (1.6.5-java)
|
95
|
+
rack (1.6.0)
|
96
|
+
rack-test (0.6.3)
|
97
|
+
rack (>= 1.0)
|
98
|
+
rails (4.2.0)
|
99
|
+
actionmailer (= 4.2.0)
|
100
|
+
actionpack (= 4.2.0)
|
101
|
+
actionview (= 4.2.0)
|
102
|
+
activejob (= 4.2.0)
|
103
|
+
activemodel (= 4.2.0)
|
104
|
+
activerecord (= 4.2.0)
|
105
|
+
activesupport (= 4.2.0)
|
106
|
+
bundler (>= 1.3.0, < 2.0)
|
107
|
+
railties (= 4.2.0)
|
108
|
+
sprockets-rails
|
109
|
+
rails-deprecated_sanitizer (1.0.3)
|
110
|
+
activesupport (>= 4.2.0.alpha)
|
111
|
+
rails-dom-testing (1.0.5)
|
112
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
113
|
+
nokogiri (~> 1.6.0)
|
114
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
115
|
+
rails-html-sanitizer (1.0.1)
|
116
|
+
loofah (~> 2.0)
|
117
|
+
railties (4.2.0)
|
118
|
+
actionpack (= 4.2.0)
|
119
|
+
activesupport (= 4.2.0)
|
120
|
+
rake (>= 0.8.7)
|
121
|
+
thor (>= 0.18.1, < 2.0)
|
122
|
+
rake (10.4.2)
|
24
123
|
resolv-ipv6favor (0.0.0)
|
124
|
+
rest-client (1.7.2)
|
125
|
+
mime-types (>= 1.16, < 3.0)
|
126
|
+
netrc (~> 0.7)
|
25
127
|
rspec (3.1.0)
|
26
128
|
rspec-core (~> 3.1.0)
|
27
129
|
rspec-expectations (~> 3.1.0)
|
28
130
|
rspec-mocks (~> 3.1.0)
|
29
|
-
rspec-core (3.1.
|
131
|
+
rspec-core (3.1.7)
|
30
132
|
rspec-support (~> 3.1.0)
|
31
|
-
rspec-expectations (3.1.
|
133
|
+
rspec-expectations (3.1.2)
|
32
134
|
diff-lcs (>= 1.2.0, < 2.0)
|
33
135
|
rspec-support (~> 3.1.0)
|
34
|
-
rspec-mocks (3.1.
|
136
|
+
rspec-mocks (3.1.3)
|
137
|
+
rspec-support (~> 3.1.0)
|
138
|
+
rspec-rails (3.1.0)
|
139
|
+
actionpack (>= 3.0)
|
140
|
+
activesupport (>= 3.0)
|
141
|
+
railties (>= 3.0)
|
142
|
+
rspec-core (~> 3.1.0)
|
143
|
+
rspec-expectations (~> 3.1.0)
|
144
|
+
rspec-mocks (~> 3.1.0)
|
35
145
|
rspec-support (~> 3.1.0)
|
36
|
-
rspec-support (3.1.
|
146
|
+
rspec-support (3.1.2)
|
147
|
+
simplecov (0.9.1)
|
148
|
+
docile (~> 1.1.0)
|
149
|
+
multi_json (~> 1.0)
|
150
|
+
simplecov-html (~> 0.8.0)
|
151
|
+
simplecov-html (0.8.0)
|
152
|
+
sprockets (2.12.3)
|
153
|
+
hike (~> 1.2)
|
154
|
+
multi_json (~> 1.0)
|
155
|
+
rack (~> 1.0)
|
156
|
+
tilt (~> 1.1, != 1.3.0)
|
157
|
+
sprockets-rails (2.2.2)
|
158
|
+
actionpack (>= 3.0)
|
159
|
+
activesupport (>= 3.0)
|
160
|
+
sprockets (>= 2.8, < 4.0)
|
161
|
+
sqlite3 (1.3.10)
|
162
|
+
term-ansicolor (1.3.0)
|
163
|
+
tins (~> 1.0)
|
164
|
+
thor (0.19.1)
|
165
|
+
thread_safe (0.3.4)
|
166
|
+
thread_safe (0.3.4-java)
|
167
|
+
tilt (1.4.1)
|
37
168
|
timers (4.0.1)
|
38
169
|
hitimes
|
170
|
+
tins (1.3.3)
|
171
|
+
tzinfo (1.2.2)
|
172
|
+
thread_safe (~> 0.1)
|
39
173
|
|
40
174
|
PLATFORMS
|
41
175
|
java
|
42
176
|
ruby
|
43
177
|
|
44
178
|
DEPENDENCIES
|
179
|
+
activerecord-jdbcsqlite3-adapter
|
45
180
|
cbor
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
rack
|
181
|
+
coveralls
|
182
|
+
david!
|
183
|
+
rails (~> 4.2)
|
50
184
|
rake
|
51
|
-
rspec
|
185
|
+
rspec (~> 3.1)
|
186
|
+
rspec-rails (~> 3.1)
|
187
|
+
sqlite3
|
data/README.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
[](http://badge.fury.io/rb/david)
|
2
|
+
[](https://gemnasium.com/nning/david)
|
3
|
+
[](https://travis-ci.org/nning/david)
|
4
|
+
[](https://coveralls.io/r/nning/david)
|
5
|
+
[](https://codeclimate.com/github/nning/david)
|
6
|
+
|
7
|
+
# David
|
3
8
|
|
4
9
|
David is a CoAP server with Rack interface to bring the illustrious family of
|
5
|
-
Rack compatible web frameworks into the Internet of Things.
|
10
|
+
Rack compatible web frameworks into the Internet of Things. **Currently, it is
|
11
|
+
in a development state on not ready for use in production.**
|
12
|
+
|
13
|
+
A fork of the CoAP gem on rubygems.org is needed:
|
14
|
+
|
15
|
+
https://github.com/nning/coap
|
16
|
+
|
17
|
+
## Copyright
|
18
|
+
|
19
|
+
The code is published under the GPLv3 license (see the LICENSE file).
|
20
|
+
|
21
|
+
### Authors
|
22
|
+
|
23
|
+
* [henning mueller](https://nning.io)
|
data/Rakefile
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
3
|
|
4
|
+
# APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
5
|
+
# load 'rails/tasks/engine.rake'
|
6
|
+
|
7
|
+
Bundler::GemHelper.install_tasks
|
8
|
+
|
4
9
|
RSpec::Core::RakeTask.new(:spec)
|
5
10
|
|
6
11
|
task default: :spec
|
data/TODO.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
TODO
|
2
|
+
====
|
3
|
+
|
4
|
+
Solid, platform independent multicast
|
5
|
+
-------------------------------------
|
6
|
+
|
7
|
+
### Current implementation state:
|
8
|
+
|
9
|
+
* SO_REUSEADDR=1 to allow different servers simultaneously.
|
10
|
+
* 0.0.0.0 (IPv4) and interface index 0 (IPv6) as interface for membership
|
11
|
+
should select OS default interface.
|
12
|
+
* On OSX, ifindex 0 does not work:
|
13
|
+
* http://lists.apple.com/archives/darwin-kernel/2014/Mar/msg00012.html
|
14
|
+
* Therefore, set ifindex explicitly to en1 (or en0).
|
15
|
+
* Join 224.0.1.187, ff02::fd, and ff05::fd.
|
16
|
+
* OSX needs ff02::1 joined explicitly.
|
17
|
+
|
18
|
+
(Remember configuring firewall accordingly.)
|
19
|
+
|
20
|
+
### Tests:
|
21
|
+
|
22
|
+
Desktop (Arch Linux) ok
|
23
|
+
Notebook (Arch Linux) ok
|
24
|
+
Debian (7.7, KVM) IPv6 fail (timeout)
|
25
|
+
Ubuntu (12.04, Travis CI) IPv6 fail (timeout)
|
26
|
+
OSX (10.9.5, KVM) ok
|
27
|
+
|
28
|
+
|
29
|
+
Better blockwise transfer support
|
30
|
+
---------------------------------
|
31
|
+
|
32
|
+
### Current implementation state:
|
33
|
+
|
34
|
+
* The server supports control usage of block messages, so block only works for
|
35
|
+
outbound documents.
|
36
|
+
|
37
|
+
### Features to be implemented:
|
38
|
+
|
39
|
+
* Handling of blockwise PUT or POST.
|
40
|
+
* Caching of documents so that a Rack app call is not necessary for every
|
41
|
+
block.
|
42
|
+
|
43
|
+
|
44
|
+
More detailed CoAP implementation
|
45
|
+
---------------------------------
|
46
|
+
|
47
|
+
### Examples for missing or unsufficient features:
|
48
|
+
|
49
|
+
* Message Deduplication (4.5.)
|
50
|
+
* Transmission Parameters (4.8.)
|
51
|
+
* Request/Response Matching (5.3.2.) (became transparent in connection to
|
52
|
+
observe transmissions)
|
53
|
+
* "For a new Confirmable message, the initial timeout is set to a random
|
54
|
+
duration (often not an integral number of seconds) between ACK_TIMEOUT and
|
55
|
+
(ACK_TIMEOUT * ACK_RANDOM_FACTOR) (see Section 4.8)"
|
56
|
+
* Validation of ETag (conditional requests)
|
57
|
+
* Request validations and error responses
|
58
|
+
* Follow redirects
|
59
|
+
|
60
|
+
|
61
|
+
Non-blocking I/O
|
62
|
+
----------------
|
63
|
+
|
64
|
+
* Check if I/O in Rack environment blocks or can block and what possibilities
|
65
|
+
exist to make it non-blocking.
|
66
|
+
|
67
|
+
|
68
|
+
Observe
|
69
|
+
-------
|
70
|
+
|
71
|
+
* Garbage collection.
|
72
|
+
* Observe on .well-known/core returns "Resource not observable" but Observe
|
73
|
+
actor still calls Rails in tick.
|
data/benchmarks/Gemfile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../../coap
|
3
|
+
specs:
|
4
|
+
coap (0.0.17.dev)
|
5
|
+
celluloid-io (~> 0.16, >= 0.16.1)
|
6
|
+
resolv-ipv6favor (~> 0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
benchmark-ips (2.1.1)
|
12
|
+
celluloid (0.16.0)
|
13
|
+
timers (~> 4.0.0)
|
14
|
+
celluloid-io (0.16.1)
|
15
|
+
celluloid (>= 0.16.0)
|
16
|
+
nio4r (>= 1.0.0)
|
17
|
+
hitimes (1.2.2)
|
18
|
+
hitimes (1.2.2-java)
|
19
|
+
nio4r (1.1.0)
|
20
|
+
nio4r (1.1.0-java)
|
21
|
+
resolv-ipv6favor (0.0.0)
|
22
|
+
timers (4.0.1)
|
23
|
+
hitimes
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
java
|
27
|
+
ruby
|
28
|
+
|
29
|
+
DEPENDENCIES
|
30
|
+
benchmark-ips
|
31
|
+
coap!
|
data/benchmarks/rps.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'benchmark/ips'
|
4
|
+
|
5
|
+
require 'coap'
|
6
|
+
include CoRE
|
7
|
+
|
8
|
+
uri = ARGV[0] || 'coap://[::1]/hello'
|
9
|
+
|
10
|
+
Benchmark.ips do |x|
|
11
|
+
x.warmup = 30
|
12
|
+
x.time = 30
|
13
|
+
|
14
|
+
x.report(uri) do
|
15
|
+
response = CoAP::Client.new.get_by_uri(uri)
|
16
|
+
raise unless response.mcode == [2, 5]
|
17
|
+
end
|
18
|
+
|
19
|
+
x.compare!
|
20
|
+
end
|
data/bin/david
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
require_relative '../lib/rack/hello_world'
|
3
|
+
$:.unshift(File.expand_path(File.join('..', '..', 'lib'), __FILE__))
|
5
4
|
|
6
|
-
|
5
|
+
require 'david'
|
6
|
+
require 'rack/hello_world'
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
options[:Log] = 'debug' if ARGV.include?('-d')
|
10
|
+
options[:Multicast] = false if defined?(JRuby)
|
7
11
|
|
8
12
|
klass = Rack::HelloWorld.new
|
13
|
+
klass = Rack::ETag.new(klass)
|
9
14
|
klass = Rack::Lint.new(klass) if ARGV.include?('-l')
|
10
15
|
|
11
|
-
Rack::Handler::David.run(klass,
|
16
|
+
Rack::Handler::David.run(klass, options)
|