Storage

object Storage

Types

Link copied to clipboard
@Serializable
sealed interface Factory

Represents a factory interface for creating storage instances. The default implementation is InMemoryStorageFactory which stores data in memory

Link copied to clipboard
@Serializable
@SerialName(value = "!InMemory")
data class InMemoryStorageFactory(var epoch: Int = 0) : Storage.Factory

Default implementation for the storage module when configuring an XTDB node. Stores everything within in-process memory - a non-persistent option for storage.

Link copied to clipboard
@Serializable
@SerialName(value = "!Local")
data class LocalStorageFactory(val path: Path, var epoch: Int = 0) : Storage.Factory

Implementation for the storage module that persists data to the local file system, under the path directory.

Link copied to clipboard
@Serializable
@SerialName(value = "!Remote")
data class RemoteStorageFactory(val objectStore: ObjectStore.Factory, var epoch: Int = 0) : Storage.Factory

Implementation for the storage module that persists data remotely within a specified objectStore,

Properties

Link copied to clipboard
const val VERSION: StorageVersion = 6

Functions

Link copied to clipboard
fun DatabaseConfig.Builder.applyStorage(storage: Storage.Factory)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

fun storageRoot(version: StorageVersion, epoch: Int, partition: Int, totalPartitions: Int): Path

The totalPartitions == 1 branch produces the same key-space as the pre-multi-partition layout, and must keep doing so — do not unify the two branches. An older version resolves against the unmarked root, so a single-partition database writing under parts/0/ would leave a rollback with nothing to read and a data migration to run at the worst possible moment. Avoiding a re-key of existing stores is the secondary benefit — blob stores have no mv primitive, so that means a full copy-and-delete sweep — but reversibility is the sharper reason. Only at N > 1 does the parts/<partition>/ grouping appear, and partition counts are immutable post-attach, so a store is one shape or the other for its whole lifetime and the two never collide.