class RIMS::QDBM::Curia_KeyValueStore
Public Class Methods
curia_open(path, *optional)
click to toggle source
# File lib/rims/qdbm.rb, line 102 def curia_open(path, *optional) curia = Curia.new(path, Curia::OWRITER | Curia::OCREAT, *optional) curia.silent = true curia end
exist?(path)
click to toggle source
# File lib/rims/qdbm.rb, line 97 def exist?(path) curia_path = path + '.qdbm_curia' File.exist? curia_path end
new(curia, path)
click to toggle source
# File lib/rims/qdbm.rb, line 90 def initialize(curia, path) @db = curia @path = path @closed = false end
open(name, *optional)
click to toggle source
# File lib/rims/qdbm.rb, line 108 def open(name, *optional) curia_path = name + '.qdbm_curia' new(curia_open(curia_path, *optional), curia_path) end
open_with_conf(name, config)
click to toggle source
# File lib/rims/qdbm.rb, line 113 def open_with_conf(name, config) bnum = config['bnum'] dnum = config['dnum'] args = [] unless (dnum) then args << bnum if bnum else args << bnum || -1 args << dnum end open(name, *args) end
Public Instance Methods
[](key)
click to toggle source
# File lib/rims/qdbm.rb, line 129 def [](key) @db[key] end
[]=(key, value)
click to toggle source
# File lib/rims/qdbm.rb, line 133 def []=(key, value) @db[key] = value end
close()
click to toggle source
# File lib/rims/qdbm.rb, line 160 def close @closed and raise 'closed' @db.close @closed = true self end
delete(key)
click to toggle source
# File lib/rims/qdbm.rb, line 137 def delete(key) ret_val = @db[key] @db.out(key) ret_val end
destroy()
click to toggle source
# File lib/rims/qdbm.rb, line 167 def destroy unless (@closed) then raise CuriaError_EMISC, "failed to destroy qdbm-curia that isn't closed: #{@path}" end FileUtils.rm_rf(@path) nil end
each_key() { |key| ... }
click to toggle source
# File lib/rims/qdbm.rb, line 147 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 143 def key?(key) ! @db[key].nil? end
sync()
click to toggle source
# File lib/rims/qdbm.rb, line 155 def sync @db.sync self end