Sha256: d27bd387a37cd4778ba2caa3c663365124982191c129e90b34b33e6243bbe99e
Contents?: true
Size: 1.82 KB
Versions: 1
Compression:
Stored size: 1.82 KB
Contents
require 'rubygems' require "pp" require File.join(File.dirname(__FILE__),'exception.rb') begin require 'sinatra/base' require "logger" require "thin" require 'activesupport' unless ({}.respond_to? :to_json) rescue LoadError => e p <<DOC ----------------------------------------------------------------------- LPM say: The LPM server require sinatra and activesupport. Please exec "gem install sinatra" or "gem install activesupport" or "gem install logger" or "gem instasll thin" first. ----------------------------------------------------------------------- Ruby say: #{e} ----------------------------------------------------------------------- DOC exit(-1) end module Lpmp def self.run!(vars) raise LoggerNotExist,"logger is needed,$logger in lpmp will pass to vars[:logger].but now vars[:logger] => #{vars[:logger]}" unless vars[:logger] case vars[:mode].to_sym when :PULL vars[:logger].debug "Entry PULL mode" require File.join(File.dirname(__FILE__),'pull','lpmp.rb') LPMPServer.run!('0.0.0.0',vars[:port]||6789) when :BGPULL # not complete. # require File.join(File.dirname(__FILE__),'bg_pull','lpmp.rb') when :XQPUSH vars[:logger].debug "Entry XQPUSH mode" require File.join(File.dirname(__FILE__),'xq_push','lpmp.rb') require File.join(File.dirname(__FILE__),'xq_push','caichen.rb') begin LPMPServer.run(Lpmp::Caichen.new(vars),:port => vars[:port]||6789) rescue ParamsError => e vars[:logger].fatal "XQPUSH mode start failed.Maybe Lpmp::Caichen.new(#{vars.inspect}) error.#{$/}#{e.to_s}." raise e rescue Exception => e p "LPMP start error!" p e.to_s end else vars[:logger].error "No mode fit.vars[:mode] => #{vars[:mode]}.#{$/}Only one of %w[PULL BGPULL XQPUSH] is available." end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lpmp-1.0.0 | lib/lpmp.rb |