class RIMS::QDBM::Depot_KeyValueStore
Public Class Methods
depot_open(path, *optional)
click to toggle source
# File lib/rims/qdbm.rb, line 23 def depot_open(path, *optional) depot = Depot.new(path, Depot::OWRITER | Depot::OCREAT, *optional) depot.silent = true depot end
exist?(path)
click to toggle source
# File lib/rims/qdbm.rb, line 18 def exist?(path) depot_path = path + '.qdbm_depot' File.exist? depot_path end
new(depot, path)
click to toggle source
# File lib/rims/qdbm.rb, line 11 def initialize(depot, path) @db = depot @path = path @closed = false end
open(name, *optional)
click to toggle source
# File lib/rims/qdbm.rb, line 29 def open(name, *optional) depot_path = name + '.qdbm_depot' new(depot_open(depot_path, *optional), depot_path) end
open_with_conf(name, config)
click to toggle source
# File lib/rims/qdbm.rb, line 34 def open_with_conf(name, config) bnum = config['bnum'] args = [] args << bnum if bnum open(name, *args) end
Public Instance Methods
[](key)
click to toggle source
# File lib/rims/qdbm.rb, line 42 def [](key) @db[key] end
[]=(key, value)
click to toggle source
# File lib/rims/qdbm.rb, line 46 def []=(key, value) @db[key] = value end
close()
click to toggle source
# File lib/rims/qdbm.rb, line 73 def close @db.close @closed = true self end
delete(key)
click to toggle source
# File lib/rims/qdbm.rb, line 50 def delete(key) ret_val = @db[key] @db.out(key) ret_val end
destroy()
click to toggle source
# File lib/rims/qdbm.rb, line 79 def destroy unless (@closed) then raise DepotError_EMISC, "failed to destroy qdbm-depot that isn't closed: #{@path}" end File.delete(@path) nil end
each_key() { |key| ... }
click to toggle source
# File lib/rims/qdbm.rb, line 60 def each_key return enum_for(:each_key) unless block_given? @db.each_key do |key| yield(key) end self end
key?(key)
click to toggle source
# File lib/rims/qdbm.rb, line 56 def key?(key) ! @db[key].nil? end
sync()
click to toggle source
# File lib/rims/qdbm.rb, line 68 def sync @db.sync self end