class

LevelDB::DB

Inherits Reference < Object

Constructors

new(path : String, options : Options = Options.new)
Source

Class methods

open(path : String, options : Options = Options.new, &)

RAII-friendly block helper

Source

Instance methods

[](key : Bytes | String) : String | Nil

[] operator for convenient string access

Source
close
Source
closed?
Source
compact

Compact the entire database

Source
compact_range(start_key : Bytes | String, limit_key : Bytes | String)

Compact the underlying storage for the key range [start_key, limit_key]

Source
create_snapshot

Create a snapshot of the current DB state

Source
delete(key : Bytes | String, write_options : WriteOptions = WriteOptions.new)
Source
each

Iterate over all key-value pairs

Source
each_string

Iterate over all key-value pairs as strings

Source
finalize

Finalizer is only a safety net; prefer explicit close or block-style open.

Source
get(key : Bytes | String, read_options : ReadOptions = ReadOptions.new) : Bytes | Nil
Source
get_string(key : Bytes | String, read_options : ReadOptions = ReadOptions.new) : String | Nil
Source
iterator(read_options : ReadOptions = ReadOptions.new) : Iterator

Create an iterator

Source
iterator(read_options : ReadOptions = ReadOptions.new, &)

Block-style iterator usage with ensure close

Source
property(name : String) : String | Nil

Get database property value

Source
put(key : Bytes | String, value : Bytes | String, write_options : WriteOptions = WriteOptions.new)
Source
release_snapshot(snapshot : LibLevelDB::Snapshot)

Release a snapshot

Source
write(batch : WriteBatch, write_options : WriteOptions = WriteOptions.new)
Source