class
LevelDB::DB
- LevelDB::DB
- Reference
- Object
Defined in:
leveldb/db.crConstructors
Class Method Summary
-
.open(path : String, options : Options = Options.new, &)
RAII-friendly block helper
Instance Method Summary
-
#[](key : Bytes | String) : String | Nil
[] operator for convenient string access
- #close
- #closed? : Bool
-
#compact
Compact the entire database
-
#compact_range(start_key : Bytes | String, limit_key : Bytes | String)
Compact the underlying storage for the key range [start_key, limit_key]
-
#create_snapshot : LibLevelDB::Snapshot
Create a snapshot of the current DB state
- #delete(key : Bytes | String, write_options : WriteOptions = WriteOptions.new)
-
#each(&block : Bytes, Bytes -> )
Iterate over all key-value pairs
-
#each_string(&block : String, String -> )
Iterate over all key-value pairs as strings
-
#finalize
Finalizer is only a safety net; prefer explicit close or block-style open.
- #get(key : Bytes | String, read_options : ReadOptions = ReadOptions.new) : Bytes | Nil
- #get_string(key : Bytes | String, read_options : ReadOptions = ReadOptions.new) : String | Nil
-
#iterator(read_options : ReadOptions = ReadOptions.new) : Iterator
Create an iterator
-
#iterator(read_options : ReadOptions = ReadOptions.new, &)
Block-style iterator usage with ensure close
-
#property(name : String) : String | Nil
Get database property value
- #ptr : LibLevelDB::DB
- #put(key : Bytes | String, value : Bytes | String, write_options : WriteOptions = WriteOptions.new)
-
#release_snapshot(snapshot : LibLevelDB::Snapshot)
Release a snapshot
- #write(batch : WriteBatch, write_options : WriteOptions = WriteOptions.new)
Constructor Detail
Class Method Detail
RAII-friendly block helper
Instance Method Detail
def compact_range(start_key : Bytes | String, limit_key : Bytes | String)
#
Compact the underlying storage for the key range [start_key, limit_key]
Create an iterator
Block-style iterator usage with ensure close
def put(key : Bytes | String, value : Bytes | String, write_options : WriteOptions = WriteOptions.new)
#