README.md in ruby_skynet-0.2.0 vs README.md in ruby_skynet-0.3.0

- old
+ new

@@ -1,39 +1,73 @@ ruby_skynet =========== -Ruby Client for calling [Skynet](https://github.com/bketelsen/skynet) services. -Will also implement the server side so that [Skynet](https://github.com/bketelsen/skynet) Services can be hosted in Ruby +Ruby Client for calling [Skynet](https://github.com/skynetservices/skynet) services, and +the server side so that [Skynet](https://github.com/skynetservices/skynet) services can be hosted in Ruby -* http://github.com/ClarityServices/ruby_skynet +* http://github.com/skynetservices/ruby_skynet -### Example +### Client Example ```ruby require 'rubygems' require 'ruby_skynet' -RubySkynet::Client.connect('TutorialService') do |tutorial_service| - p tutorial_service.call('AddOne', 'value' => 5) + +client = RubySkynet::Client.new('TutorialService') +p client.call('AddOne', :value => 5) +``` + +For details on installing and running the GoLang Tutorial Service: https://github.com/skynetservices/skynet/wiki/Service-Tutorial + +### Server Example + +```ruby +require 'rubygems' +require 'ruby_skynet' + +RubySkynet::Server.port = 2000 +RubySkynet::Server.hostname = 'localhost' + +# Just echo back any parameters received when the echo method is called +class EchoService + include RubySkynet::Service + + # Methods implemented by this service + # Must take a Hash as input + # Must Return a Hash response or nil for no response + def echo(params) + params + end end + +# Start the server +RubySkynet::Server.start ``` -For details on installing and running the Tutorial Service: https://github.com/bketelsen/skynet/wiki/Service-Tutorial +Client to call the above Service +```ruby +require 'rubygems' +require 'ruby_skynet' +client = RubySkynet::Client.new('EchoService') +p client.call('echo', :hello => 'world') +``` + ### Logging Since ruby_skynet uses SemanticLogger, trace level logging of all TCP/IP calls can be enabled as follows: ```ruby require 'rubygems' require 'ruby_skynet' + SemanticLogger::Logger.default_level = :trace SemanticLogger::Logger.appenders << SemanticLogger::Appender::File.new('skynet.log') -RubySkynet::Client.connect('TutorialService') do |tutorial_service| - p tutorial_service.call('AddOne', 'value' => 5) -end +client = RubySkynet::Client.new('EchoService') +p client.call('echo', :hello => 'world') ``` ### Architecture ruby_skynet implements its own doozer client which has been tested against @@ -43,21 +77,23 @@ ### Dependencies - Ruby MRI 1.8.7 (or above), Ruby 1.9.3, Or JRuby 1.6.3 (or above) - [SemanticLogger](http://github.com/ClarityServices/semantic_logger) -- [ResilientSocket](http://github.com/ClarityServices/ruby_skynet) +- [ResilientSocket](https://github.com/ClarityServices/resilient_socket) - [ruby_protobuf](https://github.com/macks/ruby-protobuf) - [multi_json](https://github.com/intridea/multi_json) +The server to host services in Ruby also requires: +- [Celluloid::io](https://github.com/celluloid/celluloid-io) + ### Install gem install ruby_skynet ### Future -* Implement Skynet Service in Ruby so that it can be called from Go lang, etc. * Immediately drop connections to a service on a host when that instance shuts down or stops. ( Doozer::Wait ) * More intelligent selection of available Skynet services. For example nearest, or looking at load etc. @@ -66,11 +102,11 @@ Want to contribute to Ruby Skynet? First clone the repo and run the tests: - git clone git://github.com/ClarityServices/ruby_skynet.git + git clone git://github.com/skynetservices/ruby_skynet.git cd ruby_skynet ruby -S rake test Feel free to submit an issue and we'll try to resolve it. @@ -80,18 +116,18 @@ Once you've made your great commits: 1. [Fork](http://help.github.com/forking/) ruby_skynet 2. Create a topic branch - `git checkout -b my_branch` 3. Push to your branch - `git push origin my_branch` -4. Create an [Issue](http://github.com/ClarityServices/ruby_skynet/issues) with a link to your branch +4. Create an [Issue](http://github.com/skynetservices/ruby_skynet/issues) with a link to your branch 5. That's it! Meta ---- -* Code: `git clone git://github.com/ClarityServices/ruby_skynet.git` -* Home: <https://github.com/ClarityServices/ruby_skynet> -* Bugs: <http://github.com/ClarityServices/ruby_skynet/issues> +* Code: `git clone git://github.com/skynetservices/ruby_skynet.git` +* Home: <https://github.com/skynetservices/ruby_skynet> +* Bugs: <http://github.com/skynetservices/ruby_skynet/issues> * Gems: <http://rubygems.org/gems/ruby_skynet> This project uses [Semantic Versioning](http://semver.org/). Authors