Class: RocksDB::DB

Inherits:
Object
  • Object
show all
Extended by:
Forwardable, Gem::Deprecate
Defined in:
lib/rocksdb.rb,
lib/rocksdb/ruby/deprecated.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, rocksdb_options = "", options = {}) ⇒ DB

Returns a new instance of DB.



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rocksdb.rb', line 30

def initialize(path, rocksdb_options = "", options = {})
  is_readonly = options[:readonly] || false

  if rocksdb_options.is_a? Hash
    rocksdb_options = rocksdb_options.map do |key, value|
      [key, value].join("=")
    end.join(";")
  end

  __initialize(path, is_readonly, rocksdb_options.to_s)
end

Instance Method Details

#get(*args) ⇒ Object Also known as: []



42
43
44
45
46
47
48
49
50
# File 'lib/rocksdb.rb', line 42

def get(*args)
  args.flatten!

  if args.size == 1
    get_one args.first
  else
    get_many args
  end
end

#is_readonly?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/rocksdb/ruby/deprecated.rb', line 18

def is_readonly?
  !writable?
end

#optionsObject



52
53
54
55
56
57
58
59
60
# File 'lib/rocksdb.rb', line 52

def options
  options_strings.each_with_object({}) do |(option_group, value), result|
    pairs = value.split(/;\s*/)
    pairs.map do |pair|
      key, value = pair.split("=")
      result[key] = value
    end
  end
end