lib/wukong/keystore/tyrant_db.rb in wukong-1.4.11 vs lib/wukong/keystore/tyrant_db.rb in wukong-1.4.12
- old
+ new
@@ -51,11 +51,10 @@
end
def close
@servers.all?{ |server| server.close rescue nil}
end
-
end
module TokyoDbConnection
class TyrantDb
attr_reader :dataset
@@ -65,26 +64,40 @@
'10.196.75.47',
'10.242.217.140',
].freeze unless defined?(TokyoDbConnection::TyrantDb::DB_SERVERS)
DB_PORTS = {
- :user_ids => 12001,
- :screen_names => 12002,
- :search_ids => 12003,
- :tweets_parsed => 12004,
- :users_parsed => 12005,
+ :screen_names => 12002,
+ :search_ids => 12003,
+ #
+ :tw_user_info => 14000,
+ :tw_wordbag => 14101,
+ :tw_influence => 14102,
+ :tw_trstrank => 14103,
+ :tw_conversation => 14104,
+ #
+ :screen_names2 => 12004,
+ :search_ids2 => 12005,
+ #
+ :tw_user_info2 => 14200,
+ :tw_wordbag2 => 14201,
+ :tw_influence2 => 14202,
+ :tw_trstrank2 => 14203,
+ :tw_conversation2 => 14204,
+ :tw_strong_links2 => 14205,
+ :tw_word_stats2 => 14206,
+ #
+ :ip_geo_census => 14400,
} unless defined?(TokyoDbConnection::TyrantDb::DB_PORTS)
def initialize dataset
@dataset = dataset
end
def db
return @db if @db
port = DB_PORTS[dataset] or raise "Don't know how to reach dataset #{dataset}"
@db = TokyoTyrant::Balancer::DB.new(DB_SERVERS.map{|s| s+':'+port.to_s})
- # @db = TokyoTyrant::DB.new(DB_SERVERS.first, port.to_i)
- @db
end
def [](*args) ; db[*args] ; end
def size(*args) ; db.size(*args) ; end
def vanish!(*args) ; db.vanish(*args) ; end