diff options
author | Saku Ytti <saku@ytti.fi> | 2014-04-16 10:04:12 +0300 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2014-04-16 10:04:12 +0300 |
commit | d74a152bba73095a0c7090dc078a7023eeb9ad18 (patch) | |
tree | 43f0a47fc93bcdd22f5799d41989582fc57c1cc9 /lib/oxidized/api/domain.rb | |
parent | 2af41e1769225ac42027f2f686763389296bab79 (diff) |
remove web API
It is now separately in oxidized-web package
Diffstat (limited to 'lib/oxidized/api/domain.rb')
-rw-r--r-- | lib/oxidized/api/domain.rb | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/lib/oxidized/api/domain.rb b/lib/oxidized/api/domain.rb deleted file mode 100644 index fa6a1c7..0000000 --- a/lib/oxidized/api/domain.rb +++ /dev/null @@ -1,48 +0,0 @@ -# this is not used, just added here if I want to revive it - -module Oxidized - require 'socket' - require 'json' - module API - class Domain - def initialize nodes, socket=CFG.api - puts 'here' - @nodes = nodes - File.unlink socket rescue Errno::ENOENT - @server = UNIXServer.new socket - end - def work - io = select [@server], nil, nil, Config::Sleep - process io.first.first.accept if io - end - def read - @socket.recv 1024 - end - def write data='' - begin - @socket.send JSON.dump(data), 0 - rescue Errno::EPIPE - end - end - def process socket - @socket = socket - cmd = read - cmd, data = cmd.split /\s+/, 2 - data = data.to_s.chomp - case cmd - when /next/i - @nodes.next data - write 'OK' - when /reload/i - @nodes.load if data.match /nodes/i - write 'OK' - when /list/i - write @nodes.map{|e|e.name} - when /node/i - write @nodes.show(data) - end - @socket.close - end - end - end -end |