Status: smarter...
This commit is contained in:
parent
f562f25d82
commit
bc097f8532
2 changed files with 11 additions and 5 deletions
|
@ -81,7 +81,9 @@ module LogAn::Inc
|
||||||
begin
|
begin
|
||||||
stores = @conf[:stores] = {}
|
stores = @conf[:stores] = {}
|
||||||
db = @etc[ 'sids.store', 'seeks', SBDB::Recno, SBDB::CREATE | SBDB::AUTO_COMMIT]
|
db = @etc[ 'sids.store', 'seeks', SBDB::Recno, SBDB::CREATE | SBDB::AUTO_COMMIT]
|
||||||
db = LogAn::AutoValueConvertHash.new( db, lambda {|val| val.pack( 'NN') }) {|val| (val||0.chr*8).unpack( 'NN') }
|
db = LogAn::AutoValueConvertHash.new( db, lambda {|val| val.pack( 'NN') }) {|val|
|
||||||
|
(val||0.chr*8).unpack( 'NN')
|
||||||
|
}
|
||||||
stores[:seeks] = LogAn::Cache.new db
|
stores[:seeks] = LogAn::Cache.new db
|
||||||
LogAn::Inc::FileParser::Base.store = LogAn::Inc::SID0.store = stores
|
LogAn::Inc::FileParser::Base.store = LogAn::Inc::SID0.store = stores
|
||||||
end
|
end
|
||||||
|
@ -90,13 +92,15 @@ module LogAn::Inc
|
||||||
@select = LogAn::Inc::Select.new
|
@select = LogAn::Inc::Select.new
|
||||||
status = lambda do
|
status = lambda do
|
||||||
@select.at Time.now+5, &status
|
@select.at Time.now+5, &status
|
||||||
LogAn::Logging.info :recv_lines => @logs.counter, :connections => @serv && @serv.clients.map{|cl|cl.sock.peeraddr}
|
LogAn::Logging.info :recv_lines => @logs.counter,
|
||||||
|
:connections => @serv && @serv.clients.map {|cl| cl.sid }
|
||||||
@conf[:stores].each{|key, db| db.flush!}
|
@conf[:stores].each{|key, db| db.flush!}
|
||||||
end
|
end
|
||||||
status.call
|
status.call
|
||||||
|
|
||||||
# Prepare Inc-server - create server
|
# Prepare Inc-server - create server
|
||||||
@serv = LogAn::Inc::Server.new :sock => TCPServer.new( *@conf[:server]), :config => @conf[:configs], :select => @select
|
@serv = LogAn::Inc::Server.new :sock => TCPServer.new( *@conf[:server]),
|
||||||
|
:config => @conf[:configs], :select => @select
|
||||||
LogAn::Logging.debug @serv
|
LogAn::Logging.debug @serv
|
||||||
|
|
||||||
# Shutdown on signals
|
# Shutdown on signals
|
||||||
|
|
|
@ -27,7 +27,8 @@ module LogAn
|
||||||
else env
|
else env
|
||||||
end
|
end
|
||||||
@rdb = @env[ 'rotates.db', :type => SBDB::Btree, :flags => SBDB::CREATE | SBDB::AUTO_COMMIT]
|
@rdb = @env[ 'rotates.db', :type => SBDB::Btree, :flags => SBDB::CREATE | SBDB::AUTO_COMMIT]
|
||||||
@queue = @env[ "newids.queue", :type => SBDB::Queue, :flags => SBDB::CREATE | SBDB::AUTO_COMMIT, :re_len => 16]
|
@queue = @env[ "newids.queue", :type => SBDB::Queue,
|
||||||
|
:flags => SBDB::CREATE | SBDB::AUTO_COMMIT, :re_len => 16]
|
||||||
@dbs, @counter = {}, 0
|
@dbs, @counter = {}, 0
|
||||||
self.hash_func = lambda {|k|
|
self.hash_func = lambda {|k|
|
||||||
[k.timestamp.to_i/60/60].pack 'N' # Hour-based rotation
|
[k.timestamp.to_i/60/60].pack 'N' # Hour-based rotation
|
||||||
|
@ -64,7 +65,8 @@ module LogAn
|
||||||
end
|
end
|
||||||
|
|
||||||
def db name
|
def db name
|
||||||
@dbs[name] ||= @env[ name.to_s, :type => SBDB::Btree, :flags => SBDB::CREATE | SBDB::AUTO_COMMIT]
|
@dbs[name] ||= @env[ name.to_s, :type => SBDB::Btree,
|
||||||
|
:flags => SBDB::CREATE | SBDB::AUTO_COMMIT]
|
||||||
end
|
end
|
||||||
|
|
||||||
def sync
|
def sync
|
||||||
|
|
Loading…
Reference in a new issue