A GenServer-backed Ash.DataLayer.
Find a file
2022-10-25 22:42:59 +11:00
.devcontainer feat: first pass at a genserver backed Ash datalayer. 2022-08-12 16:32:42 +12:00
.github feat: first pass at a genserver backed Ash datalayer. 2022-08-12 16:32:42 +12:00
config feat: first pass at a genserver backed Ash datalayer. 2022-08-12 16:32:42 +12:00
lib docs: reformat moduledocs 2022-10-25 22:42:02 +11:00
test improvement: update to latest ash (#1) 2022-09-22 13:59:22 +12:00
.doctor.exs feat: add inactivity and maximum lifetime timeouts. 2022-08-17 12:49:13 +12:00
.formatter.exs feat: first pass at a genserver backed Ash datalayer. 2022-08-12 16:32:42 +12:00
.gitignore feat: first pass at a genserver backed Ash datalayer. 2022-08-12 16:32:42 +12:00
.tool-versions feat: first pass at a genserver backed Ash datalayer. 2022-08-12 16:32:42 +12:00
CHANGELOG.md chore: release version v0.2.0 2022-09-22 14:01:38 +12:00
mix.exs improvement: update to latest ash (#1) 2022-09-22 13:59:22 +12:00
mix.lock improvement: update to latest ash (#1) 2022-09-22 13:59:22 +12:00
README.md Update README.md 2022-10-25 22:42:59 +11:00

AshGenServer

An Ash Datalayer backed by individual GenServers.

If you want in-memory storage of resources then take a look at Ash.DataLayer.Ets.

Caveats

  • When a resource using this datalayer is created it spawns an instance of AshGenServer.Server and performs all operations on the data within it. This means that your actions must pay the price of a GenServer.call/3 to read or modify the data.

  • When destroying a resource it's process is terminated and it's internal state is lost.

  • If, for some reason, the AshGenServer.Server process crashes or exits for an abnormal reason the supervisor will restart it with the changeset used by the create action - this means that any updates performed since creation will be lost.

  • Any resource using this data source must have at least one primary key field.

  • Retrieving a resource by primary key is an optimised case, but any other queries will pay the price of having to query every AshGenServer.Server process in sequence.

Installation

If available in Hex, the package can be installed by adding ash_gen_server to your list of dependencies in mix.exs:

def deps do
  [
    {:ash_gen_server, "~> 0.2.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ash_gen_server.