ExAgent.Store.ETS (ExAgent v1.1.0)

Copy Markdown View Source

In-process, ETS-backed ExAgent.Store implementation (dev/test default).

A supervised ExAgent.Store.ETS GenServer owns a public, named ETS table (default name ExAgent.Store.ETS, started by the application supervisor), so the table outlives any single ExAgent.Server crash and snapshots survive a restart. The behaviour callbacks operate directly on the table for speed.

Portability (the important bit)

Even though ETS can hold arbitrary Erlang terms, this implementation round-trips snapshots through JSON (Snapshot.serialize/1), never term_to_binary. That enforces two things a future Postgres store will rely on:

  1. the stored shape is portable (JSON, not opaque binaries), and
  2. non-serializable values (pids, secrets, function captures) are refused at write time — Jason.encode! raises rather than persisting junk.

Use it as store: :ets on ExAgent.Server / ExAgent.AgentSupervisor.