class Roma::Storage::TCMemStorage

Public Instance Methods

get_stat() click to toggle source
    # File lib/roma/storage/tc_storage.rb
166 def get_stat
167   ret = get_stat_org
168   @hdb.each_with_index{|hdb,idx|
169     ret["storage[#{idx}].rnum"] = hdb.rnum
170     ret["storage[#{idx}].size"] = hdb.size
171   }
172   ret
173 end

Protected Instance Methods

get_options(hdb) click to toggle source
    # File lib/roma/storage/tc_storage.rb
177 def get_options(hdb)
178   prop = parse_options
179 
180   prop.each_key{|k|
181     unless /^(bnum|capnum|capsiz)$/ =~ k
182       raise RuntimeError.new("Syntax error, unexpected option #{k}")
183     end
184   }
185   
186   opts = ""
187   opts += "#bnum=#{prop['bnum']}" if prop.key?('bnum')
188   opts += "#capnum=#{prop['capnum']}" if prop.key?('capnum')
189   opts += "#capsiz=#{prop['capsiz']}" if prop.key?('capsiz')
190 
191   opts = nil unless opts.length > 0
192   opts
193 end

Private Instance Methods

close_db(hdb) click to toggle source
    # File lib/roma/storage/tc_storage.rb
208 def close_db(hdb); end
open_db(fname) click to toggle source
    # File lib/roma/storage/tc_storage.rb
197 def open_db(fname)
198   hdb = ADB::new
199 
200   options = get_options(hdb)
201   dbname = "*"
202   dbname += options if options
203 
204   hdb.open(dbname)
205   hdb
206 end