Reference

Configuration & limits

Choose durability and resource budgets explicitly for your local workload.

Default options

db, err := zeedb.Open("./data", zeedb.Options{})

Zero fields select defaults. Negative or inconsistent limits are rejected. Resource limits apply to a single database directory.

OptionDefaultAccounting
DurabilityDurableSync before acknowledging commits
MaxDataBytes256 MiBLive collection/key/value bytes + 64 bytes per record
MaxMemtableBytes4 MiBMemtable records/tombstones under that accounting
MaxWALBytes16 MiBWAL threshold that triggers a synchronous checkpoint
MaxBatchBytes1 MiBEncoded batch payload
MaxBatchOperations4096Mutations in one atomic batch
MaxKeyBytes4096Bytes per key
MaxValueBytes1 MiB − 8192Bytes per value, subject to batch size too
MaxScanRecords1000Maximum records in one scan
MaxScanBytes8 MiBReturned records under the accounting model

One MiB is 1 << 20 bytes. Collection names independently contain 1–255 bytes and no NUL.

Coordinate buffer budgets

db, err := zeedb.Open("./data", zeedb.Options{
    Durability:       zeedb.Durable,
    MaxMemtableBytes: 8 << 20,
    MaxWALBytes:      32 << 20,
    MaxScanRecords:   500,
})

MaxBatchBytes must be at least 32 bytes and no greater than the 64 MiB frame-format cap. MaxMemtableBytes must be at least MaxBatchBytes. The WAL budget must fit the memtable budget, one encoded batch, and framing allowance:

MaxWALBytes >= MaxMemtableBytes + MaxBatchBytes + 16

The limits bound different things. A large permitted value can still fail because the encoded batch containing it exceeds its own budget.

Budgets versus memory usage

The counters are not exact heap/RSS or filesystem quotas. Go maps, index strings, sorted key lists, batch copies/encoding, allocation overhead, and concurrent caller-owned results consume additional memory.

The complete SSTable key index and Bloom filter live in memory; values stay on disk. Startup verifies every table block. During recovery, the memtable may temporarily grow to the bounded WAL’s contents before checkpointing.

Disk headroom

Checkpointing writes a new table before reclaiming the old one. Allow space for roughly two live tables, the bounded WAL, metadata, and encoding overhead. Temporary files from interrupted checkpointing are reclaimed after successful recovery.

This is a small-engine resource model, not a hard filesystem quota system. Disk-full failures can leave a write result indeterminate; reopen and reconcile before retrying.

Reopening with different limits

Persisted data must fit the options used to open it. Lower key, value, data, or WAL budgets may prevent reopening. Use the original limits to access data before planning a migration; there is no automatic migration tool.

On scan byte-budget overflow, reduce Limit and retry. See error handling for other failure paths.

Something to improve?Edit this page on GitHub