Episteme.Database.Backends.Dets (Episteme v0.1.0)

Copy Markdown View Source

An on-disk Episteme.Database.Backend, for a database that should survive past the owning process (or the VM) -- same {name, arity}-keyed :set shape as Episteme.Database.Backends.Ets, backed by :dets instead. Requires a :file option (a binary or charlist path) on Episteme.Database.new/1; :table names the DETS table itself (defaults to a name derived from :file, so two databases opened against different files don't collide).

:dets's own limits apply -- single Erlang node, roughly 2 GB per table, and no coordination for concurrent writers beyond what :dets itself serializes internally. This is "an embedded database that persists across restarts," not a substitute for a real multi-writer datastore. Writes are only guaranteed durable after sync/1 (:dets itself flushes periodically, but not before every single insert).