Package-level declarations

Types

Link copied to clipboard
interface CloseableSequence<T>

Represents a sequence of elements that can be closed to release any underlying resources.

Link copied to clipboard

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.

Link copied to clipboard

Constructs and manages a collection of batch operations for LevelDB.

Link copied to clipboard
@Serializable
sealed interface LevelDBBatchOperation

Represents a batch operation to be performed on a LevelDB database. This sealed interface encapsulates different types of operations that can be executed in a batch.

Link copied to clipboard
@Serializable
data class LevelDBOptions(val blockRestartInterval: Int = 16, val blockSize: Int = 4 * 1024, val compression: LevelDBOptions.CompressionType = CompressionType.SNAPPY, val createIfMissing: Boolean = true, val errorIfExists: Boolean = false, val maxBytesForLevelBase: Long = 10L * 1024 * 1024, val maxBytesForLevelMultiplier: Int = 10, val maxFileSize: Long = 2L * 1024 * 1024, val maxOpenFiles: Int = 1000, val paranoidChecks: Boolean = false, val writeBufferSize: Long = 4L * 1024 * 1024)

Configuration options for creating and managing a LevelDB instance.

Link copied to clipboard
interface LevelDBReader

Interface for reading from a LevelDB database. Provides methods for getting values and iterating over key-value pairs.

Link copied to clipboard

Represents a snapshot of the LevelDB database at a specific point in time. A snapshot provides a consistent view of the database, unaffected by subsequent changes.

Functions

Link copied to clipboard
fun <T> <Error class: unknown class><T>.asCloseable(onClose: () -> Unit): CloseableSequence<T>

Wraps a Sequence into a CloseableSequence with a custom close action.

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

Constructs and builds a batch operation for LevelDB using a customizable builder.

Link copied to clipboard
expect fun destroyDatabase(path: String, options: LevelDBOptions = LevelDBOptions.DEFAULT)

Destroys the database located at the specified path using the provided options.

actual fun destroyDatabase(path: String, options: LevelDBOptions)
actual fun destroyDatabase(path: String, options: LevelDBOptions)
Link copied to clipboard
expect fun LevelDB(path: String, options: LevelDBOptions = LevelDBOptions.DEFAULT): LevelDB

Creates a new instance of a LevelDB database at the specified file path.

actual fun LevelDB(path: String, options: LevelDBOptions): LevelDB
actual fun LevelDB(path: String, options: LevelDBOptions): LevelDB
Link copied to clipboard
expect fun repairDatabase(path: String, options: LevelDBOptions = LevelDBOptions.DEFAULT)

Repairs the database at the specified path using the provided options.

actual fun repairDatabase(path: String, options: LevelDBOptions)
actual fun repairDatabase(path: String, options: LevelDBOptions)
Link copied to clipboard

Retrieves the value associated with a given key in the LevelDB database. This is a convenience method that returns the value as a LevelDBReader.Entry object. This method can be invoked only if the sequence is not closed.

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.