<div dir="auto">ets:foldl/3 maybe?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Den ons 19 jan. 2022 23:18Frank Muller <<a href="mailto:frank.muller.erl@gmail.com">frank.muller.erl@gmail.com</a>> skrev:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Hi Valentin,</div><div dir="auto"><br></div><div dir="auto">Have you read what I posted in earlier messages?</div><div dir="auto">I already explored first/next with other alternatives. </div><div dir="auto"><br></div><div dir="auto">Thanks anyway </div><div dir="auto"><br></div><div dir="auto">/F.</div><div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)"><div style="word-wrap:break-word;line-break:after-white-space"><br>In addition to serialisation to disk (its:tab2file/2,3), one can always use:<div><br></div><div><b>ets:first/1</b> followed by a number of calls to <b>ets:next/2</b></div><div><div><br></div><div><br></div><div>e.g. </div><div> ets:first( Tab ) -> Key</div><div><span style="white-space:pre-wrap"> </span>ets:lookup( Tab, Key ) -> [TableRow] % to retrieve data associated with this key</div><div> ets:next( Tab, Key ) -> NextKey, etc.</div><div><br></div><div>NOTE: once the end of the table is reached, instead of a key an atom ‘$end_of_table’ is returned by ets:next/2.</div><div><br></div><div><br><blockquote type="cite"><div>On 19 Jan 2022, at 23:33, <a href="mailto:valentin@micic.co.za" target="_blank" rel="noreferrer">valentin@micic.co.za</a> <<a href="mailto:valentin@pixie.co.za" target="_blank" rel="noreferrer">valentin@pixie.co.za</a>> wrote:</div><br><div><div>To serialize ETS to a file on the disk, one may use ets:tab2file/2,3.<br><br>It does not destroy the table, but simply dumps a content of the table to a file. I’ve used it a number of times and it works as advertised.<br>I don’t think there’s a tool available to traverse this file without loading it back to ETS (via ets:file2tab/1,2).<br><br> However, it may be a start.<br><br><br>V/</div></div></blockquote></div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div><blockquote type="cite"><div><div><br><br><br><blockquote type="cite">On 18 Jan 2022, at 17:02, Hugo Mills <<a href="mailto:hugo@carfax.org.uk" target="_blank" rel="noreferrer">hugo@carfax.org.uk</a>> wrote:<br><br> I may be wrong, but my reading of Frank's requirement was that the<br>table needs to be serialised to disk in some external format so that<br>it can be processed by some additional tool outside the current erlang<br>application. No amount of reparenting to another erlang process in the<br>same VM is going to accomplish that...<br><br> Hugo.<br><br>On Tue, Jan 18, 2022 at 03:49:51PM +0200, Led wrote:<br><blockquote type="cite"><blockquote type="cite"><br>I think this opinion stems from confusion about the GiftData argument<br>in ets:give_away/3.<br><br>AFAIK this just passes whatever 'data' you set for the variable, not<br>the actual table data, through to the recipient of the 'ETS_TRANSFER'<br>message.<br></blockquote><br>It gives all table data with full access to the process "for<br>processing". What else do you need?<br><br><blockquote type="cite"><br>On Tue, Jan 18, 2022 at 7:28 AM Frank Muller <<a href="mailto:frank.muller.erl@gmail.com" target="_blank" rel="noreferrer">frank.muller.erl@gmail.com</a>> wrote:<br><blockquote type="cite"><br>No it doesn’t. It only charges the table owner<br><br><br><blockquote type="cite"><blockquote type="cite"><br><br><blockquote type="cite"><blockquote type="cite">I’d like to retrieve all objects before deleting the table.<br></blockquote><br>Strange task. Table is already "all objects".<br></blockquote><br><br>Nothing strange. Just a simple requirement.<br>Objects are sent elsewhere for processing before deleting the table content.<br><br><blockquote type="cite"><br><blockquote type="cite">What’s the most efficient way to do it?<br></blockquote><br>ets:give_away/3<br></blockquote><br><br>That’s strange indeed. How give_away/3 could help? It gives the ownership to another proc.<br></blockquote><br>It actually sends all objects elsewhere (to another proc) for processing.<br><br></blockquote></blockquote></blockquote></blockquote><br>-- <br>Hugo Mills | All hope abandon, Ye who press Enter here.<br>hugo@... <a href="http://carfax.org.uk" target="_blank" rel="noreferrer">carfax.org.uk</a> |<br><a href="http://carfax.org.uk/" target="_blank" rel="noreferrer">http://carfax.org.uk/</a> |<br>PGP: E2AB1DE4 |<br></blockquote><br></div></div></blockquote></div><br></div></div></blockquote></div></div>
</blockquote></div>