Class: Roma::Storage::TCStorage
- Inherits:
-
BasicStorage
- Object
- BasicStorage
- Roma::Storage::TCStorage
- Includes:
- TokyoCabinet
- Defined in:
- lib/roma/storage/tc_storage.rb
Direct Known Subclasses
Constant Summary
Constants inherited from BasicStorage
BasicStorage::PACK_HEADER_TEMPLATE, BasicStorage::PACK_TEMPLATE
Instance Attribute Summary
Attributes inherited from BasicStorage
#cleanup_regexp, #dbs, #divnum, #do_each_vn_dump, #each_clean_up_sleep, #each_vn_dump_sleep, #each_vn_dump_sleep_count, #error_message, #ext_name, #hdb, #hdiv, #logic_clock_expire, #option, #st_class, #storage_path, #vn_list
Instance Method Summary collapse
- #closedb ⇒ Object
- #get_stat ⇒ Object
- #get_stat_org ⇒ Object
-
#initialize ⇒ TCStorage
constructor
class TokyoCabinet::HDB.
- #opendb ⇒ Object
Methods inherited from BasicStorage
#add, #append, #cache_file_name, #cas, #close_log, #db_get, #db_put, #decr, #delete, #dump, #each_cache_by_keys, #each_cache_dump_pack, #each_clean_up, #each_hdb_dump, #each_vn_dump, #flush_db, #get, #get_context, #get_keys_in_cache, #get_logfile_list, #get_raw, #get_raw2, #incr, #load, #load_stream_dump, #load_stream_dump_for_cachecleaning, #open_log, #out, #out_cache, #prepend, #rdelete, #replace, #rset, #set, #set_db_stat, #set_expt, #stop_clean_up, #true_length, #write_log
Constructor Details
#initialize ⇒ TCStorage
class TokyoCabinet::HDB
37 38 39 40 |
# File 'lib/roma/storage/tc_storage.rb', line 37 def initialize super @ext_name = 'tc' end |
Instance Method Details
#closedb ⇒ Object
64 65 66 67 68 69 |
# File 'lib/roma/storage/tc_storage.rb', line 64 def closedb super File.unlink(@fname_lock) if @fname_lock @fname_lock = nil end |
#get_stat ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'lib/roma/storage/tc_storage.rb', line 43 def get_stat ret = super @hdb.each_with_index{|hdb,idx| ret["storage[#{idx}].path"] = File.(hdb.path) ret["storage[#{idx}].rnum"] = hdb.rnum ret["storage[#{idx}].fsiz"] = hdb.fsiz } ret end |
#get_stat_org ⇒ Object
42 |
# File 'lib/roma/storage/tc_storage.rb', line 42 alias get_stat_org get_stat |
#opendb ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/roma/storage/tc_storage.rb', line 53 def opendb @fname_lock = "#{@storage_path}/lock" if File.exist?(@fname_lock) raise RuntimeError.new("Lock file already exists.") end super open(@fname_lock,"w"){} end |