Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 tdl.kpeg
Octocat-spinner-32 twp.gemspec
Octocat-spinner-32 twp3.txt
README.md

This is for a lecture. Code quality/architecture/test coverage/documentation is accordingly.

Pure Ruby implementation (including dependencies) of The Wire Protocol 3 (see twp3.txt).

Make sure you're on Ruby 1.9.3 and have bundler installed. Then run bundle install and rake.

This library is not thread-safe (i.e. don't access the same connection from multiple threads, it's ok to use different connections in different threads). TWP::Server will start an event-loop for you and will use non-blocking reads. It will also use a blocking accept if there are no connections open and slow down the loop when there are open connections but no activity.

This library includes, amongst other things:

  • TDL parser and compiler
  • Generic TWP3 Server/Client
  • CLI toolkit
  • Echo TWP3 Server/Client
  • FAM TWP3 Server/Client
  • RPC TWP3 Server/Client (CORBA subset)
  • TFS RPC Server/Client
  • Proper error handling
  • Various command line tools based on TFS (all wrapped in bin/tfs)
  • Fancy stream visualization for development

Strings in binary encoding are treated as binary data, other strings as strings (will be converted to UTF-8 when streaming).

Code is written to tolerate network issues and resource failures.

Use RPC like this:

require 'twp'

# server
server = TWP::RPC::Server.new(host, port)
server.object = some_local_object
server.start

def some_local_object.foo
  "bar"
end

# client
some_remote_object = TWP::RPC::Client.get(host, port)
some_remote_object.foo # => "bar"

How does that differ from DRb? Well, it also works with servers/clients not written in Ruby. For instance, written in Scala.

Something went wrong with that request. Please try again.