[erlang-questions] atomic ETS update with a function?
Tue Nov 20 12:12:27 CET 2018
What are the chances it would run out of reductions? What about drop the update if it runs out of reductions.
Most use cases I see are putting/removing/merging elements into various collections. Complex business logic should be done outside, then you get inside the lock and simply do a ++, --, :maps.put, :maps.merge, etc.
On Tuesday, November 20, 2018, 4:36:22 a.m. EST, Lukas Larsson <garazdawi@REDACTED> wrote:
On Mon, Nov 19, 2018 at 7:44 PM Vans S <vans_163@REDACTED> wrote:
Currently there is no atomic function to update a ETS value when its not a tuple. For example if one of my ETS values is a map, and I want to put an element into the map, I have no atomic way to do so.
Is there anyone else that really has a need for a function like :ets.update/3 where arg 1 is ets_table, 2 is key, 3 is fun callback that is called passing the original element and the reply should be the new element?
I've long wanted to do this for match specs, it would however be a huge undertaking to implement this. The main problem is what to do if the process runs out of reductions while doing the update.
Should it be allowed to continue to run? and thus potentially starve other processes.Should it be preempted? what do we then do with the locks on the ETS table?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions