# `MnemosynePostgres.Backend`
[🔗](https://github.com/edlontech/mnemosyne_postgres/blob/main/lib/mnemosyne_postgres/backend.ex#L1)

PostgreSQL/pgvector implementation of `Mnemosyne.GraphBackend`.

Persists knowledge graph nodes in a single polymorphic `nodes` table
with JSONB data, vector embeddings, and JSONB link maps. Metadata
is stored in a separate `node_metadata` table.

## Telemetry

See `MnemosynePostgres.Telemetry` for the full list of events and their
metadata.

## Error handling

Callbacks whose behaviour spec includes `{:error, ...}` returns
(`apply_changeset`, `delete_nodes`, `find_candidates`, `get_nodes_by_type`)
catch exceptions and return `{:error, StorageError.t()}`. Callbacks that
only define `{:ok, ...}` returns (`get_node`, `get_linked_nodes`,
`get_metadata`, `update_metadata`, `delete_metadata`) let exceptions
propagate, as the caller is expected to handle crashes via supervision.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
