Skip to content

Maryk RocksDB Store

An embedded Maryk data store backed by RocksDB, supporting JVM, Android, Apple platforms, Linux, Windows and Android Native through the rocksdb-multiplatform bindings.

Define a model, register its stable ID, and execute Maryk requests:

import maryk.core.models.RootDataModel
import maryk.core.properties.definitions.string
import maryk.core.query.pairs.with
import maryk.core.query.requests.add
import maryk.datastore.rocksdb.RocksDBDataStore
object Note : RootDataModel<Note>() {
val message by string(index = 1u)
}
suspend fun main() {
RocksDBDataStore.open(
relativePath = "notes.db",
dataModelsById = mapOf(1u to Note),
).use {
execute(Note.add(Note.create { Note.message with "Hello Maryk" }))
}
}

The path is a database directory. Keep model IDs stable across reopens. use closes the store; otherwise, call close() when finished to release native resources.

The defaults retain history and use a shared 64 MiB cache, 10-bit Bloom filters, automatic index search for bytewise families, and LZ4/Zstandard compression. Existing stores remain readable; opening can run a required storage-format or schema migration. Read the upgrade guidance before upgrading a deployed store.

TaskGuide
Tune memory, filters, compression, caches or logging; inspect diagnosticsConfiguration and tuning
Configure history, page revisions or use transactionsHistory and transactions
Encrypt sensitive properties and manage key ownershipField encryption
Upgrade storage or migrate model definitionsMigrations and upgrades
Create and restore physical recovery backupsRocksDB backups
Transfer data between storage backendsPortable backups
Understand the implementationArchitecture and storage layout

For request examples, see reading and writing. Expose a store through the Remote Store, or add SQL queries when needed.