Class: LevelDb::Snapshot
Instance Method Summary collapse
- #close ⇒ Object
- #get(key) ⇒ Object
-
#initialize(db) ⇒ Snapshot
constructor
A new instance of Snapshot.
Methods included from Encoding
#decode_key, #decode_value, #encode_key, #encode_value
Constructor Details
#initialize(db) ⇒ Snapshot
Returns a new instance of Snapshot.
255 256 257 258 259 260 |
# File 'lib/level_db.rb', line 255 def initialize(db) @db = db @snapshot = @db.snapshot = Library::ReadOptions.new .snapshot(@snapshot) end |
Instance Method Details
#close ⇒ Object
267 268 269 |
# File 'lib/level_db.rb', line 267 def close @snapshot.close end |
#get(key) ⇒ Object
262 263 264 265 |
# File 'lib/level_db.rb', line 262 def get(key) value = @db.get(encode_key(key), ) value && decode_value(value) end |