Sha256: c77bf95513431d312b068e113e6cc8ab95a7d327345f5f0364d576bbcebd410c
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 KB
Contents
require 'norikra/engine' require 'norikra/logger' include Norikra::Log require 'norikra/typedef_manager' require 'norikra/output_pool' require 'norikra/typedef' require 'norikra/query' require 'norikra/rpc' module Norikra class Server RPC_DEFAULT_HOST = '0.0.0.0' RPC_DEFAULT_PORT = 26571 # 26571 = 3026 + 3014 + 2968 + 2950 + 2891 + 2896 + 2975 + 2979 + 2872 attr_accessor :running def initialize(host=RPC_DEFAULT_HOST, port=RPC_DEFAULT_PORT, conf={}) #TODO: initial configuration (targets/queries) @typedef_manager = Norikra::TypedefManager.new @output_pool = Norikra::OutputPool.new Norikra::Log.init(conf[:loglevel], conf[:logdir], {:filesize => conf[:logfilesize], :backups => conf[:logbackups]}) @engine = Norikra::Engine.new(@output_pool, @typedef_manager) @rpcserver = Norikra::RPC::HTTP.new(:engine => @engine, :port => port) end def run @engine.start @rpcserver.start info "Norikra server started." @running = true Signal.trap(:INT){ @running = false } #TODO: more signal traps (dumps of query/fields? or other handler?) while @running sleep 1 end end def shutdown info "Norikra server shutting down." @rpcserver.stop @engine.stop info "Norikra server shutdown complete." end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
norikra-0.0.6-java | lib/norikra/server.rb |
norikra-0.0.5-java | lib/norikra/server.rb |