An ETS (Erlang Term Storage) backed Ash Datalayer, for testing and lightweight usage.
Remember, this has no support for transactions unless the resource names a
transaction_group in its ets section. This is not recommended for production use,
especially in multi-user applications. It can, however, be great for prototyping.
ets
A section for configuring the ets data layer
Examples
ets do
# Used in testing
private? true
end
Options
| Name | Type | Default | Docs |
|---|---|---|---|
private? | boolean | false | Sets the ets table protection to private, and scopes it to only this process. The table name will not be used directly if this is true, to allow multiple processes to use this resource separately. |
transaction_group | atom | Runs the resource's actions in transactions shared with every resource that names the same group, as resources sharing a repo share a transaction. A transaction's writes reach the tables when it commits, so other processes read only what was committed, and a rollback through any resource of the group leaves the tables as they were. Reads take no locks. A write locks the record it writes, and the identity values it takes, until its transaction ends, waiting for a lock another transaction holds and failing only when its wait would deadlock, and a write made outside any transaction runs in one of its own. The resource's identities are enforced when it writes, so they need no pre_check_with. A value a destroy or an update gives up stays taken until its transaction commits, so a create of the value meanwhile is refused, as Ash's identity check refuses a value a committed record holds. A transaction's timeout is checked at each table it reads or writes and when it commits. | |
table | atom | The name of the table. Defaults to the resource name. |