ash-project / ash-project/ash

Optimization: `set_source` and `group_by_source` callbacks on types that support loading through

Open
#1,131 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Elixir
Stars
2.5k
Forks
426
Avg merge
23h 26m
Merged PRs (30d)
46

Description

Right now, when an attribute supports being "loaded through", what we do is we do its `load` logic for each record. If we add the following optional callbacks to type:

```elixir
@callback set_source(list({record, value})) :: list(value)
@callback group_by_source(list(value)) :: %{primary_key => list(value)}
```

We can use this to allow loading through types in a single pass.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing load logic for attributes that support being "loaded through". Determine how the proposed set_source and group_by_source callbacks would enable a single-pass load, and consider the callback inputs and grouped output described in the issue. Done means supported types can load through in one pass without running load logic separately for each record.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
backend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.