DETS-backed persistence for the InMemory graph backend.
Stores nodes as {node_id, node_struct} records. Secondary indexes
are rebuilt on load via Graph.put_node/2. Ingestion records are kept
separately as {{:ingestion, source_id}, record} rows.
Summary
Functions
Persists a new ingestion with its graph and metadata changes.
Removes nodes by ID from DETS and strips any back-references to those IDs from every surviving node's link sets. Without the strip pass, surviving rows retain dangling references that re-materialize on reload.
Removes metadata entries by node ID from DETS.
Opens the DETS file at the configured path, returning a handle map.
Reads all records from DETS and rebuilds a graph, metadata map, and ingestion map.
Persists changeset additions and links to DETS.
Persists metadata entries as {{:meta, id}, metadata} records.
Functions
@spec commit_ingestion( Mnemosyne.GraphBackend.ingestion_record(), Mnemosyne.Graph.Changeset.t(), map() ) :: :ok | {:error, term()}
Persists a new ingestion with its graph and metadata changes.
The ingestion row is written last as the commit marker and the table is then synchronized. DETS has no transactions, so a write failure before the marker may leave partial graph or metadata rows for a later load.
Removes nodes by ID from DETS and strips any back-references to those IDs from every surviving node's link sets. Without the strip pass, surviving rows retain dangling references that re-materialize on reload.
Removes metadata entries by node ID from DETS.
Opens the DETS file at the configured path, returning a handle map.
@spec load(map()) :: {:ok, Mnemosyne.Graph.t(), map(), map()} | {:error, term()}
Reads all records from DETS and rebuilds a graph, metadata map, and ingestion map.
Node records are stored as {id, node} tuples, metadata records as
{{:meta, id}, metadata} tuples, and ingestion records as
{{:ingestion, source_id}, record} tuples.
@spec save(Mnemosyne.Graph.Changeset.t(), map()) :: :ok | {:error, term()}
Persists changeset additions and links to DETS.
Persists metadata entries as {{:meta, id}, metadata} records.