LevelDB

A simple interface for interacting with a LevelDB database. Provides methods to perform various operations such as put, get, delete, batch operations, iteration, snapshot creation, and compaction.

Inheritors

Functions

Link copied to clipboard
abstract fun batch(operations: List<LevelDBBatchOperation>, sync: Boolean = false)

Performs a batch operation on the LevelDB database.

Link copied to clipboard
inline fun LevelDB.batch(sync: Boolean = false, builder: LevelDBBatchBuilder.() -> Unit)

Performs a batch operation on the LevelDB database.

Link copied to clipboard
abstract fun compactRange(start: String = "", end: String = "")

Compacts the range of keys between the specified start and end keys in the LevelDB database.

Link copied to clipboard
abstract fun delete(key: String, sync: Boolean = false)

Deletes a key-value pair from the LevelDB database.

Link copied to clipboard
abstract fun get(key: String, verifyChecksums: Boolean = false, fillCache: Boolean = true): String?

Retrieves the value associated with a given key in the LevelDB database.

Link copied to clipboard
abstract fun put(key: String, value: String, sync: Boolean = false)

Inserts or updates a key-value pair in the LevelDB database.

Link copied to clipboard
abstract fun scan(from: String? = null, verifyChecksums: Boolean = false, fillCache: Boolean = true): CloseableSequence<LevelDBReader.LazyEntry>

Creates an Iterable to traverse all key-value pairs in the LevelDB database. The sequence will start from the specified key, or from the first key if no key is specified. LevelDB sorts keys in lexicographic order.

Link copied to clipboard
inline fun <T> LevelDB.scan(from: String? = null, verifyChecksums: Boolean = false, fillCache: Boolean = true, action: (<Error class: unknown class><LevelDBReader.LazyEntry>) -> T): T

Creates an Iterable to traverse all key-value pairs in the LevelDB database. The sequence will start from the specified key, or from the first key if no key is specified. LevelDB sorts keys in lexicographic order.

Link copied to clipboard
abstract fun <T> withSnapshot(action: LevelDBSnapshot.() -> T): T

Executes a provided action within the context of a LevelDB snapshot. This method ensures that the action runs with a consistent view of the database at the time the snapshot is created.