tristan
ETS table select_take
This is a cross post from the Erlang Forums. ETS table `select_take` - Proposals: Ideas - Erlang Programming Language Forum - Erlang Forums
I’ve been in need for an ets:select_take function. Currently a select of all keys for matching elements followed by a take is required since select_delete returns only the number of deleted elements. Could also do a select/match followed by a delete but that would mean some updates would technically succeed on an element but not be part of what was selected.
Curious if anyone else has encountered need for this and if anyone knows what an implementation would look like.
Most Liked
christhekeele
I’ve noticed this hole in the :ets API as well, though I can’t say I have any idea how to implement. I think it’s a great proposal!
tristan
Yea. An update that happens in another process during the selecting/deleting. So you select the elements, get some element A and in another process A is updated, which succeeds but then A is deleted from the table. Better, in some cases, that the update to A fails instead of being silently lost.







