SQL implementation of Rheo.Backend on top of a host-owned Ecto.Repo.
Requires {:ecto_sql, "~> 3.11"} plus the adapter your repo uses
({:postgrex, "~> 0.19"} or {:ecto_sqlite3, "~> 0.17"}).
Supports PostgreSQL (Ecto.Adapters.Postgres) and SQLite
(Ecto.Adapters.SQLite3). Prefer the Rheo facade for application code.
Supervision example
Your app supervises the repo; Rheo only borrows it.
children = [
MyApp.Repo,
{Rheo, name: MyRheo, backend: {Rheo.Backend.Ecto, repo: MyApp.Repo}}
]The opaque handle is the registered name of Rheo.Backend.Ecto.Server, which
holds the resolved repo, dialect, and options.
Tables
See Rheo.Backend.Ecto.Migrations. Rheo.ensure_indexes/1 creates them
idempotently; hosts that prefer explicit migrations can run
mix rheo.ecto.gen_migration instead.
Options
:repo— requiredEcto.Repomodule:name— handle / process name (defaultdefault_handle/0):prefix— PostgreSQL schema holding the Rheo tables (defaultnil):notify— whentrue,NOTIFY rheo_eventsafter every append (PostgreSQL only, defaultfalse)
Dialect differences
PostgreSQL claims work use FOR UPDATE SKIP LOCKED, so many nodes can fetch
concurrently (distributed: true). SQLite has a single writer and claims
inside a plain transaction, so it is declared distributed: false — correct
for one node, not for a shared network filesystem.
Callback semantics are documented on Rheo.Backend.
Summary
Functions
@spec capabilities(:postgres | :sqlite | Rheo.Backend.handle()) :: Rheo.Backend.Capabilities.t()
Capabilities for a specific dialect or running handle.
capabilities/0 describes the PostgreSQL defaults. Pass :sqlite (or a live
handle) to get the flags that actually apply to an instance, including whether
:notify was enabled.
Arguments
dialect_or_handle—:postgres,:sqlite, or a backend handle
Examples
iex> Rheo.Backend.Ecto.capabilities(:sqlite).guarantees.distributed
false
iex> Rheo.Backend.Ecto.capabilities(:postgres).guarantees.distributed
trueReturns
A Rheo.Backend.Capabilities struct.
@spec child_spec(keyword()) :: Supervisor.child_spec()
Child spec for the configuration process that acts as the backend handle.
Arguments
opts— keyword options, see the "Options" section above
Examples
iex> spec = Rheo.Backend.Ecto.child_spec(repo: MyApp.Repo, name: :demo_sql)
iex> {spec.id, elem(spec.start, 0)}
{{Rheo.Backend.Ecto.Server, :demo_sql}, Rheo.Backend.Ecto.Server}Returns
A supervisor child spec map.
Errors / raises
Raises ArgumentError when :repo is missing.
@spec default_handle() :: atom()
Default handle name for the Rheo instance.
Examples
iex> Rheo.Backend.Ecto.default_handle()
Rheo.EctoReturns
A process name atom.