Skip to content

Commit

Permalink
Remove compatibility section from README.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Mar 14, 2016
1 parent ad2f8d5 commit 1d39a00
Showing 1 changed file with 0 additions and 109 deletions.
109 changes: 0 additions & 109 deletions README.md
Expand Up @@ -130,115 +130,6 @@ DNSSEC is currently not supported and is [unlikely to be supported in the future
end
end

## Compatibility

### Migrating from RubyDNS 0.8.x to 0.9.x

RubyDNS 0.9.0 is based on a branch which replaced EventMachine with Celluloid. This reduces the complexity in writing concurrent systems hugely, but it is also a largely untested code path. RubyDNS 0.8.x using EventMachine has been tested over 4 years now by many projects.

The reason for the change is simply that EventMachine is now a dead project and no longer being maintained/supported. The ramifications of this are: no IPv6 support, crashes/segfaults in certain workloads with no workable solution going forward, and lack of integration with external libraries.

The difference for authors integrating RubyDNS in a daemon should be minimal. For users integrating RubyDNS into an existing system, you need to be aware of the contracts imposed by Celluloid, namely, whether it affects other parts of your system. Some areas of Celluloid are well developed, others are still needing attention (e.g. how it handles forking child processes). We expect the 0.8 branch should remain stable for a long time, but 0.9 branch will eventually become the 1.0 release.

The benefits of using Celluloid include: fault tolerance, high performance, scalability across multiple hardware threads (when using Rubinius or JRuby), simpler integration with 3rd party data (e.g. `defer` has now been removed since it isn't necessary with celluloid).

### Migrating from RubyDNS 0.7.x to 0.8.x

The primary change is the removal of the dependency on `RExec` which was used for daemons and the addition of the testing dependency `process-daemon`. In order to create and run your own daemon, you may use `process-daemon` or another tool of your choice.

The transaction options are now conveniently available:

transaction.options[key] == transaction[key]

The remote peer address used to be available directly via `transaction[:peer]` but profiling revealed that the `EventMachine::Connection#get_peername` was moderately expensive. Therefore, the incoming connection is now available in `transaction[:connection]` and more specifically `transaction[:peer]` is no longer available and replaced by `transaction[:connection].peername` which gives `[ip_address, port]`.

### Migrating from RubyDNS 0.6.x to 0.7.x

The asynchronous deferred processing became the default and only method for processing requests in `0.7.0`. This simplifies the API but there were a few changes, notably the removal of `defer!` and the addition of `defer`. The reason for this was due to issues relating to deferred processing and the flow of control, which were confusing and introduced bugs in specific situations. Now, you can assume flow control through the entire block even with non-blocking functions.

RubyDNS::run_server(:listen => SERVER_PORTS) do
match(/\.*.com/, IN::A) do |transaction|
# Won't block and won't continue until fiber.resume is called.
defer do |fiber|
# No domain exists, after 5 seconds:
EventMachine::Timer.new(5) do
transaction.fail!(:NXDomain)
fiber.resume
end
end
end

otherwise do
transaction.fail!(:NXDomain)
end
end

You can see a complete example in `test/test_slow_server.rb`.

#### Server structure changes

When integrating RubyDNS into another project, the rule based DSL is often a hurdle rather than a feature. Thus, the rule-based DSL component of `RubyDNS::Server` class has been separated into a derived `RubyDNS::RuleBasedServer` class. `RubyDNS::Server` can be derived and the `RubyDNS::Server#process` method can be overridden to provide a single entry point for DNS processing.

In addition, `RubyDNS::Server#run` can now start the server, provided you are within an `EventMachine#run` context. The existing entry point, `RubyDNS::run_server` provides the same rule-based DSL as previous versions.

#### Method name changes

Some method names have changed to improve consistency.

- `failure!` became `fail!`
- `append` became `add`
- `append_query!` became `append!`

### Migrating from RubyDNS 0.5.x to 0.6.x

The order of arguments to pattern based rules has changed. For regular expression based rules, the arguments are now ordered `|transaction, match_data|`. The main reason for this change was that in many cases match_data is not important and can thus be ignored, e.g. `|transaction|`.

Going forward, Ruby 1.8.x is no longer supported.

### Migrating from RubyDNS 0.4.x to 0.5.x

The system standard resolver was synchronous, and this could stall the server when making upstream requests to other DNS servers. A new resolver `RubyDNS::Resolver` now provides an asynchronous interface and the `Transaction::passthrough` makes exclusive use of this to provide high performance asynchonous resolution.

Here is a basic example of how to use the new resolver in full. It is important to provide both `:udp` and `:tcp` connection specifications, so that large requests will be handled correctly:

resolver = RubyDNS::Resolver.new([[:udp, "8.8.8.8", 53], [:tcp, "8.8.8.8", 53]])

EventMachine::run do
resolver.query('google.com', IN::A) do |response|
case response
when RubyDNS::Message
puts "Got response: #{response.answers.first}"
else
# Response is of class RubyDNS::ResolutionFailure
puts "Failed: #{response.message}"
end

EventMachine::stop
end
end

Existing code that uses `Resolv::DNS` as a resolver will need to be updated:

# 1/ Add this at the top of your file; Host specific system information:
require 'rubydns/system'

# 2/ Change from R = Resolv::DNS.new to:
R = RubyDNS::Resolver.new(RubyDNS::System::nameservers)

Everything else in the server can remain the same. You can see a complete example in `test/test_resolver.rb`.

### Migrating from RubyDNS 0.3.x to 0.4.x

Due to changes in `resolv.rb`, superficial parts of RubyDNS have changed. Rather than using `:A` to specify A-records, one must now use the class name.

match(..., :A)

becomes

IN = Resolv::DNS::Resource::IN
match(..., IN::A)

## Contributing

1. Fork it
Expand Down

0 comments on commit 1d39a00

Please sign in to comment.