What is the best way, to traverse and update all elements in an Erlang ETS table? -


Can you help me out of a "best practice" approach, only once all the elements in the ETS table : When updating each element? My table is a private set, and I was going to cross through with my input code using ets: update_element with ets: foldl , but I'm not sure It is, if it is a safe way, because by updating the elements can give me the same element at the same time - according to the documentation. I am not about to insert new keys, only update prices, please, tell me if this approach is safe, or showing me an alternative way to achieve updates efficiently!

Thank you!

You first / 1 and next / 2 You can use. Check out Next / 2 here:

I think your concern has already been answered in the asset documentation:

No other support is available within the ETS which will guarantee stability between the objects. However, the safe / stable / 2 function can be used to guarantee that the sequence of first / 1 and next / 2 calls will go into the table without any errors and every current object in the table will be visited exactly once, even if any The other process (or the same process) removes or removes the object in the table together. There is nothing more guaranteed; In such special items that are inserted or removed during such trials, once or not, all can be visited. Functions that come internally on a table, such as choose and match, will guarantee the same guarantee as a safe guarantee.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -