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