Storage backends #
--storage-backend <name> selects the driver that sits under the ledis data model. The command layer
is written against store.driver.IDB, so the same commands run on every backend — what changes is
where the bytes live, who replicates them, and how much you can trust the driver.
type IDB interface {
Close() error
Get(key []byte) ([]byte, error)
Put(key []byte, value []byte) error
Delete(key []byte) error
SyncPut(key []byte, value []byte) error
SyncDelete(key []byte) error
NewIterator() IIterator
NewWriteBatch() IWriteBatch
NewSnapshot() (ISnapshot, error)
Compact() error
GetStorageEngine() interface{}
}
What each backend is #
--storage-backend | Where data lives | Replication | External dependency |
|---|---|---|---|
goleveldb (default) | Local LevelDB (pure Go) | Raft only | — |
badger | Local BadgerDB v4, ZSTD compression | Raft only | — |
hybriddb | Local LevelDB + Ristretto hot cache, per-driver metrics | Raft only | — |
oss | S3-compatible object store, local LevelDB index + Ristretto cache | Raft only | S3/MinIO endpoint |
ipfs | Local LevelDB whose values are fetched from IPFS by CID | Raft only | IPFS API (not a gateway) |
ipfs-synckv | IPFS as source of truth + local mirror + version metadata, optional AES-256 | IPFS/ipfs-log P2P | IPFS API + P2P |
crdt | Local Badger + icefiredb-crdt-kv over libp2p pubsub | P2P CRDT | libp2p peers |
ipfs-log | Append-only icefiredb-ipfs-log store over IPFS pubsub | P2P log | IPFS + P2P |
leveldb (the cgo driver) and orbitdb are not compiled into the binary: the former is never
imported, the latter is commented out in main.go/flags.go. Passing either name fails at startup
with “unknown driver”.
Choosing one #
- Default / most workloads —
goleveldb. Pure Go, no cgo, predictable memory, no external services. - Write-heavy local workloads —
badger. Note the driver opens with large fixed defaults (1 GB memtable, 1 GB block cache, 100 goroutines/compactors), so size the host accordingly. - Read-heavy working sets that fit in RAM —
hybriddb. The hot tier absorbs reads, and the driver registersread_operations,write_operations,bytes_read,errors… intoINFO. - Data that must outlive the host —
oss, with--oss-endpoint,--oss-ak,--oss-sk. Every write goes to the object store and a local LevelDB index keeps it addressable; keep the local disk because it carries the index. - Multi-site / decentralized —
ipfs-synckvorcrdt. Both replicate through libp2p pubsub and are configured with--servicename,--nettopic,--datatopic(all three must match across nodes). - Not as a general backend today —
ipfs. Its write path stores the raw value locally while the read path treats the stored bytes as an IPFS CID andcats them, so a value written through the engine does not round-trip. Useipfs-synckvwhen you want IPFS persistence.
Per-backend configuration #
| Backend | Flags | Defaults |
|---|---|---|
ipfs, ipfs-synckv | --ipfs-endpoint | http://localhost:5001 (the API port, not the 8080 gateway) |
ipfs-synckv | --ipfs-synckv-key | empty → no encryption; a 32-byte key enables AES-256 |
ipfs-log | --ipfs-log-dbname, or env IPFS_LOG_DBNAME | ifdb-event-kv-ipfs-log |
oss | --oss-endpoint, --oss-ak, --oss-sk | http://localhost:9000 + placeholder credentials |
crdt, ipfs-log | --servicename, --nettopic, --datatopic | icefiredb, icefiredb-net, icefiredb-data |
The hot-cache capacity of oss, ipfs and ipfs-synckv is not configurable from the command
line: it is the driver constant of 1024 MB. See
Configuration.
Guarantees you do and do not get #
You get
- The same command semantics on every backend, including the per-type keyspaces and per-type expiry.
- Raft snapshot/restore that is backend-agnostic:
writeSnapshotiterates the driver’s snapshot and streams key/value pairs insdsformat inside a gzip file, so a backup taken onbadgercan be restored into a freshgoleveldbnode (see Operations). - Backend metrics in
INFOforhybriddb,ipfs,ipfs-synckv,oss.
You do not get
- No cross-backend on-disk compatibility. Do not change
--storage-backendfor an existing data directory; the formats are unrelated. - No “empty value” distinction on the decentralized drivers. They collapse “missing” and “empty”, so an empty string reads back as a nil reply. Pinned in Compatibility.
- No driver-level retry or repair. A failed write surfaces as a command error; on a P2P driver a temporarily unreachable peer shows up as missing data until the log catches up.
Test coverage, by driver #
| Driver | Tests | Notes |
|---|---|---|
goleveldb | engine-level compat suite (DRIVER=goleveldb make test-compat) | via ledisdb |
badger | driver/badger/db_test.go + engine suite (default DRIVER=badger) | — |
hybriddb | driver/hybriddb/{db,iterator,snapshot,write_batch}_test.go | — |
ipfs-synckv | driver/ipfs-synckv/{db,iterator,singularity}_test.go | needs an IPFS daemon |
oss | driver/oss/s3_test.go | needs S3/MinIO (CI runs localstack) |
ipfs, crdt, ipfs-log | no unit tests in this repository | exercised manually against real peers |
That table is the honest version of “supported”: a driver with no test can still work, but nothing in CI will tell you when it stops working.