StoreOptions

class StoreOptions(val encoderBudgetBytes: Int? = null, val maxDepth: Int = 1024, val maxDocumentBytes: Long = Long.MAX_VALUE, val maxStringBytes: Long = Long.MAX_VALUE, val ioParallelism: Int = 16, val durability: Durability = Durability.SyncEachBatch, val compression: Boolean = true, val mmapReads: Boolean = false)(source)

The options of one open store, which may differ at every open. Every option has a safe default, so StoreOptions() opens a store that works on any heap; the values below bound what a store does, never how much of the JVM's heap it needs, which the engine derives from the heap it runs on. The options fixed when a store is created are CreationOptions.

OptionDefaultRange
encoderBudgetBytes8 MiB, or 2 × fragmentBytes if that is more≥ 2 × fragmentBytes, ≤ 1 GiB
maxDepth10241 … 1 000 000
maxDocumentBytesunlimited≥ 1
maxStringBytesunlimited≥ 0
ioParallelism161 … 1024
durabilityDurability.SyncEachBatch
compressiontrue
mmapReadsfalse

Options are values: two instances with the same settings are equal, and copy derives a variant, such as StoreOptions().copy(compression = false).

  • encoderBudgetBytes: pending bytes an insert keeps before it writes fragments early; null for the default. It only steers how new inserts are split. Opening a store fails with IllegalArgumentException when it is below twice the store's CreationOptions.fragmentBytes.

  • maxDepth, maxDocumentBytes, maxStringBytes: limits of SPEC.md §1.3; a document over one of them is rejected with RejectReason.LIMIT_EXCEEDED.

  • ioParallelism: threads for the suspending operations of JsonStore.

  • durability: when acknowledged writes are synced to disk.

  • compression: compress fragment payloads. Each payload records how it was stored, so a store written with compression reads back with it off and the other way round; the option only chooses what new writes do.

  • mmapReads: read sealed segment files through memory mappings instead of positional reads. Saves a copy per block read and leaves the pages to the OS. Off by default: on Windows a mapped file can't be deleted, so a compaction that retires a mapped segment waits for its readers, and a store that maps far more than the machine's memory pages harder than it reads. Try it on read-heavy stores whose segments fit in memory.

Constructors

Link copied to clipboard
constructor(encoderBudgetBytes: Int? = null, maxDepth: Int = 1024, maxDocumentBytes: Long = Long.MAX_VALUE, maxStringBytes: Long = Long.MAX_VALUE, ioParallelism: Int = 16, durability: Durability = Durability.SyncEachBatch, compression: Boolean = true, mmapReads: Boolean = false)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun copy(encoderBudgetBytes: Int? = this.encoderBudgetBytes, maxDepth: Int = this.maxDepth, maxDocumentBytes: Long = this.maxDocumentBytes, maxStringBytes: Long = this.maxStringBytes, ioParallelism: Int = this.ioParallelism, durability: Durability = this.durability, compression: Boolean = this.compression, mmapReads: Boolean = this.mmapReads): StoreOptions

These options with the given ones changed; the result is validated like a new instance.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String