class LevelDB::DB

Defined in:

leveldb/db.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(path : String, options : Options = Options.new) #

[View source]

Class Method Detail

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

RAII-friendly block helper


[View source]

Instance Method Detail

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

[] operator for convenient string access


[View source]
def close #

[View source]
def closed? : Bool #

[View source]
def compact #

Compact the entire database


[View source]
def compact_range(start_key : Bytes | String, limit_key : Bytes | String) #

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


[View source]
def create_snapshot : LibLevelDB::Snapshot #

Create a snapshot of the current DB state


[View source]
def delete(key : Bytes | String, write_options : WriteOptions = WriteOptions.new) #

[View source]
def each(&block : Bytes, Bytes -> ) #

Iterate over all key-value pairs


[View source]
def each_string(&block : String, String -> ) #

Iterate over all key-value pairs as strings


[View source]
def finalize #

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


[View source]
def get(key : Bytes | String, read_options : ReadOptions = ReadOptions.new) : Bytes | Nil #

[View source]
def get_string(key : Bytes | String, read_options : ReadOptions = ReadOptions.new) : String | Nil #

[View source]
def iterator(read_options : ReadOptions = ReadOptions.new) : Iterator #

Create an iterator


[View source]
def iterator(read_options : ReadOptions = ReadOptions.new, &) #

Block-style iterator usage with ensure close


[View source]
def property(name : String) : String | Nil #

Get database property value


[View source]
def ptr : LibLevelDB::DB #

[View source]
def put(key : Bytes | String, value : Bytes | String, write_options : WriteOptions = WriteOptions.new) #

[View source]
def release_snapshot(snapshot : LibLevelDB::Snapshot) #

Release a snapshot


[View source]
def write(batch : WriteBatch, write_options : WriteOptions = WriteOptions.new) #

[View source]