
Embedded JSON document database engine storing streamed documents, indexing every key and value, answering key-value and JSONPath queries, supporting immutable versions, diffs, crash consistency and NFC normalization.
An embedded JSON document database engine for the JVM, written in Kotlin.
Delva stores JSON documents of any size, indexes every key–value pair in them, and answers key–value and JSONPath searches over that index. It is a library, not a server: one process opens a directory and works with it directly. Documents are streamed in and out, so memory is bounded by configuration and never by document size: its tests insert, search and read back a 2 GiB document in a 256 MB heap.
Delva is Bulgarian — делва, the earthenware jar a household sinks into a cellar floor and seals for the winter.
Status: early development. Until 1.0, a minor version can change the API and the on-disk format incompatibly; see Compatibility.
Delva needs JDK 22 or newer, and depends only on the Kotlin standard library and kotlinx-coroutines. Its JPMS module
name is app.oreshkov.delva. It is published to Maven Central:
dependencies {
implementation("app.oreshkov.delva:delva:0.2.0")
}import app.oreshkov.delva.*
import java.nio.file.Path
JsonStore.openOrCreate(Path.of("data/store")).use { store ->
val blocking = store.blocking()
val id = blocking.insert("""{"name":"ada","tags":["math","engines"],"score":42}""")
blocking.search(KeyValueQuery("name", JsonQueryValue.Str("ada"))).use { result ->
for (hit in result) println(hit.readJsonAsString())
}
// An element of an array value matches the array's member too.
blocking.search(KeyValueQuery("tags", JsonQueryValue.Str("math"), ResultMode.CONTAINING_ELEMENT)).use { result ->
for (hit in result) println(hit.node)
}
blocking.delete(id)
}The guide covers the suspending functions that blocking() wraps, and everything else; the
KDoc documents every public declaration.
select within one value, and searches that the index narrows down by the
query's filters.replace swaps in a new version atomically, and an optional
document key adds get, upsert and listing in key order.verify scrubs the whole
store for damage.| Module | What it is |
|---|---|
delva |
The engine; see the guide. |
delva-kotlinx-serialization |
Stores and reads @Serializable values. |
delva-cli |
The delva command line, shipped with each GitHub release. |
cli-kit, cli-kit-testing |
A standalone library for command-line programs, and its test kit, with versions of its own. |
delva-examples |
Runnable programs that use only the public API. |
Bug reports and discussion of the semantics are welcome; see CONTRIBUTING.md. Report security problems — including anything that loses or corrupts data — privately, as SECURITY.md describes.
An embedded JSON document database engine for the JVM, written in Kotlin.
Delva stores JSON documents of any size, indexes every key–value pair in them, and answers key–value and JSONPath searches over that index. It is a library, not a server: one process opens a directory and works with it directly. Documents are streamed in and out, so memory is bounded by configuration and never by document size: its tests insert, search and read back a 2 GiB document in a 256 MB heap.
Delva is Bulgarian — делва, the earthenware jar a household sinks into a cellar floor and seals for the winter.
Status: early development. Until 1.0, a minor version can change the API and the on-disk format incompatibly; see Compatibility.
Delva needs JDK 22 or newer, and depends only on the Kotlin standard library and kotlinx-coroutines. Its JPMS module
name is app.oreshkov.delva. It is published to Maven Central:
dependencies {
implementation("app.oreshkov.delva:delva:0.2.0")
}import app.oreshkov.delva.*
import java.nio.file.Path
JsonStore.openOrCreate(Path.of("data/store")).use { store ->
val blocking = store.blocking()
val id = blocking.insert("""{"name":"ada","tags":["math","engines"],"score":42}""")
blocking.search(KeyValueQuery("name", JsonQueryValue.Str("ada"))).use { result ->
for (hit in result) println(hit.readJsonAsString())
}
// An element of an array value matches the array's member too.
blocking.search(KeyValueQuery("tags", JsonQueryValue.Str("math"), ResultMode.CONTAINING_ELEMENT)).use { result ->
for (hit in result) println(hit.node)
}
blocking.delete(id)
}The guide covers the suspending functions that blocking() wraps, and everything else; the
KDoc documents every public declaration.
select within one value, and searches that the index narrows down by the
query's filters.replace swaps in a new version atomically, and an optional
document key adds get, upsert and listing in key order.verify scrubs the whole
store for damage.| Module | What it is |
|---|---|
delva |
The engine; see the guide. |
delva-kotlinx-serialization |
Stores and reads @Serializable values. |
delva-cli |
The delva command line, shipped with each GitHub release. |
cli-kit, cli-kit-testing |
A standalone library for command-line programs, and its test kit, with versions of its own. |
delva-examples |
Runnable programs that use only the public API. |
Bug reports and discussion of the semantics are welcome; see CONTRIBUTING.md. Report security problems — including anything that loses or corrupts data — privately, as SECURITY.md describes.