Hi, this is mainly a discussion before trying to implement a new feature.
In my current use case, a number of process groups is created, using a name like {:group_x, :subgroup_y}, (for example the names are {:group_1, :subgroup_1}, {:group_1, :subgroup_2}, {:group_2, :subgroup_1}, ...)
Then, for example, i need to retrieve all existing subgroups for a given group, with something like :syn.group_names(scope) |> Enum.filter(fn {group_name, _} -> group_name == :group_1 end).
Since this is becoming quite inefficient, due to the filter call, i was wondering if it was desired to add a new api, group_names_match/2 which mimics the match function in the elixir registry.
The implementation would simply be something like adding a new parameter to group_name_ordset which is then used here as a guard on the ets select, and then expose a new function group_names_match which will be called like group_names_match(scope, [{:==, :"$1", {:group_1, :_}}]).
What do you think? I can work on a pull request if this seems interesting.
Or should i simply use a different scope for every group_x (which is fixed) in my use case?
Hi, this is mainly a discussion before trying to implement a new feature.
In my current use case, a number of process groups is created, using a name like
{:group_x, :subgroup_y}, (for example the names are{:group_1, :subgroup_1},{:group_1, :subgroup_2},{:group_2, :subgroup_1}, ...)Then, for example, i need to retrieve all existing subgroups for a given group, with something like
:syn.group_names(scope) |> Enum.filter(fn {group_name, _} -> group_name == :group_1 end).Since this is becoming quite inefficient, due to the filter call, i was wondering if it was desired to add a new api,
group_names_match/2which mimics the match function in the elixir registry.The implementation would simply be something like adding a new parameter to
group_name_ordsetwhich is then used here as a guard on the ets select, and then expose a new functiongroup_names_matchwhich will be called likegroup_names_match(scope, [{:==, :"$1", {:group_1, :_}}]).What do you think? I can work on a pull request if this seems interesting.
Or should i simply use a different scope for every
group_x(which is fixed) in my use case?