Implement an MVP of the OTP `ets` interface
There are cases where AtomVM could benefit from ets tables.
This task would involve implementing a “minimal viable product” for ets in AtomVM. In essence, the minimal implementation should support the ets (unordered) set type, with operations for insertion, lookup, and deletion. Support for sharing tables across processes with support for read-concurrency is desirable, but not strictly needed for the MVP.
Implemented functions of ets (with caveats)would include (but may not necessarily be limited to) the following:
-
ets:new/2with support for thesettype,key_pos,named_table,private,public, andprotectedaccess, andread_concrrency(opportunistic) -
ets:member/2 -
ets:insert/2andets:insert_new/2 -
ets:lookup/2andets:lookup_element/3 -
ets:delete/2andets:delete_all_objects/1 -
ets:tab_to_list/1 -
ets:whereis/1
The implementation should be done as a Bif (I think) and should preserve the same behavior as OTP — specifically, terms that are stored in ets tables should be copied from the process heap into implementation-defined storage (e.g., a heap fragment, or even a (compressed?) encoded term.
I'm unable to get gleam/mist running due to a dependency on ets:lookup_element/3 . Does anyone intend to push the rest of this work forward?
I fully understand the unfortunate circumstances around it being partially completed, so forgive me for asking. I'm trying to understand if I need to start learning C to help do so.