.devcontainer | ||
.github | ||
config | ||
lib/ash_gen_server | ||
test | ||
.doctor.exs | ||
.formatter.exs | ||
.gitignore | ||
.tool-versions | ||
CHANGELOG.md | ||
mix.exs | ||
mix.lock | ||
README.md |
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 aGenServer.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 thecreate
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.