Sha256: 7214fd3f8fb12f4c410f4c297f41873d082b8bf62899972b658f870aaf55167c

Contents?: true

Size: 535 Bytes

Versions: 12

Compression:

Stored size: 535 Bytes

Contents

require 'cellect/node_set'
require 'socket'

module Cellect
  module Server
    class NodeSet < Cellect::NodeSet
      attr_accessor :id
      
      protected
      
      def setup
        zk.mkdir_p '/nodes'
        address = Socket.ip_address_list.find{ |address| address.ipv4? && !address.ipv4_loopback? }
        raise "Cannot identify IP address" unless address
        path = zk.create '/nodes/node', data: address.ip_address, mode: :ephemeral_sequential
        self.id = path.sub /^\/nodes\//, ''
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
cellect-server-0.1.2.pre.jruby lib/cellect/server/node_set.rb
cellect-server-0.1.2 lib/cellect/server/node_set.rb
cellect-server-0.1.1 lib/cellect/server/node_set.rb
cellect-server-0.1.0 lib/cellect/server/node_set.rb
cellect-server-0.0.9 lib/cellect/server/node_set.rb
cellect-server-0.0.8 lib/cellect/server/node_set.rb
cellect-server-0.0.7 lib/cellect/server/node_set.rb
cellect-server-0.0.6 lib/cellect/server/node_set.rb
cellect-server-0.0.5 lib/cellect/server/node_set.rb
cellect-server-0.0.4 lib/cellect/server/node_set.rb
cellect-server-0.0.3 lib/cellect/server/node_set.rb
cellect-server-0.0.2 lib/cellect/server/node_set.rb