<!--
This file was generated by Spark. Do not edit it by hand.
-->
# AshArcadic.DataLayer
Ash `DataLayer` for ArcadeDB — the "ash_postgres of ArcadeDB". Executes through
the tenant-blind `arcadic` transport. Exposes an `arcade do … end` resource
section and implements the `Ash.DataLayer` behaviour.
use Ash.Resource, data_layer: AshArcadic.DataLayer
arcade do
client MyApp.ArcadicClient # module implementing AshArcadic.Client
label :Person # defaults to the short module name
skip [:computed]
sensitive [:ssn] # binary-storage-typed or skipped
# database "my_db" # per-resource default (non-:context)
# tenant_database {MyApp.Tenancy, :db_for, []} # :context override
end
Advertised capabilities (see `can?/2` for the authoritative matrix): CRUD +
`MERGE` upserts + atomic `SET`, bulk writes (`bulk_create`, multi-row bulk
upsert, heterogeneous `update_many`, query-scoped `update_query`/
`destroy_query`), filter/sort/distinct/combinations push-down, offset +
keyset pagination (`Ash.stream!`), query + relationship aggregates,
expression calculations, standard relationships + `Traverse` manual
traversal + edge writes, dense/sparse/hybrid vector search, transactions,
`:async_engine`, telemetry. Multitenancy (`:attribute` + `:context`) is
fail-closed on every path; errors are value-free (no value, tenant, or byte
in a message). Per-feature fine print: `usage-rules.md`.
## arcade
Configuration for the ArcadeDB data layer.
### Nested DSLs
* [edge](#arcade-edge)
* [vector_index](#arcade-vector_index)
* [sparse_vector_index](#arcade-sparse_vector_index)
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`client`](#arcade-client){: #arcade-client .spark-required} | `atom` | | Module implementing `AshArcadic.Client` (supplies the `Arcadic.Conn`). |
| [`database`](#arcade-database){: #arcade-database } | `String.t` | | Per-resource default database. Defaults to the client conn's database. Ignored for `:context`. |
| [`label`](#arcade-label){: #arcade-label } | `atom \| String.t` | | Vertex label. Defaults to the resource's short module name. |
| [`skip`](#arcade-skip){: #arcade-skip } | `list(atom)` | `[]` | Attribute names excluded from ArcadeDB properties. |
| [`sensitive`](#arcade-sensitive){: #arcade-sensitive } | `list(atom)` | `[]` | Attribute names classified as sensitive. Verifier (ValidateSensitive): each must be binary-storage-typed (app-side-encrypted bytes) or listed in `skip`. The verifier checks the type SHAPE — encrypting is the host app's job. |
| [`tenant_database`](#arcade-tenant_database){: #arcade-tenant_database } | `mfa` | | MFA applied as `apply(m, f, [tenant \| a])` returning the ArcadeDB database name for a `:context` tenant. Defaults to a built-in collision-free encoder. |
### arcade.edge
```elixir
edge name
```
Defines an edge mapping from this vertex to a destination resource.
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#arcade-edge-name){: #arcade-edge-name .spark-required} | `atom` | | Edge name (referenced by CreateEdge/DestroyEdge `edge:`). |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`label`](#arcade-edge-label){: #arcade-edge-label .spark-required} | `atom` | | Edge label in the graph (a valid Arcadic.Identifier). |
| [`destination`](#arcade-edge-destination){: #arcade-edge-destination .spark-required} | `atom` | | Destination resource module (single-attribute PK). |
| [`direction`](#arcade-edge-direction){: #arcade-edge-direction } | `:outgoing \| :incoming \| :both` | `:outgoing` | Edge direction. |
| [`properties`](#arcade-edge-properties){: #arcade-edge-properties } | `list(atom)` | `[]` | Edge property keys, set from same-named declared action arguments. |
| [`multiple?`](#arcade-edge-multiple?){: #arcade-edge-multiple? } | `boolean` | `false` | false → idempotent MERGE (one edge per endpoint-pair+label); true → CREATE (parallel edges). |
### Introspection
Target: `AshArcadic.Edge`
### arcade.vector_index
```elixir
vector_index name
```
Declares a dense vector index on an attribute (metadata only — the host creates the index).
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#arcade-vector_index-name){: #arcade-vector_index-name .spark-required} | `atom` | | The vector attribute (a stored, non-sensitive, array-typed property). |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`dimensions`](#arcade-vector_index-dimensions){: #arcade-vector_index-dimensions .spark-required} | `pos_integer` | | Embedding dimensionality (must equal the search vector's length). |
| [`similarity`](#arcade-vector_index-similarity){: #arcade-vector_index-similarity } | `:cosine \| :dot_product \| :euclidean` | `:cosine` | Distance metric — drives `distance`/`max_distance` semantics. |
### Introspection
Target: `AshArcadic.VectorIndex`
### arcade.sparse_vector_index
```elixir
sparse_vector_index name
```
Declares a sparse vector index over a (tokens, weights) attribute pair (metadata only — the host creates the index).
### Arguments
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`name`](#arcade-sparse_vector_index-name){: #arcade-sparse_vector_index-name .spark-required} | `atom` | | A logical index name (referenced by the vector-search preparation). |
### Options
| Name | Type | Default | Docs |
|------|------|---------|------|
| [`tokens`](#arcade-sparse_vector_index-tokens){: #arcade-sparse_vector_index-tokens .spark-required} | `atom` | | The integer-array attribute holding token ids (stored, non-sensitive). |
| [`weights`](#arcade-sparse_vector_index-weights){: #arcade-sparse_vector_index-weights .spark-required} | `atom` | | The float-array attribute holding the matching weights (stored, non-sensitive). |
### Introspection
Target: `AshArcadic.SparseVectorIndex`
<style type="text/css">.spark-required::after { content: "*"; color: red !important; }</style>