-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement an MVP of the OTP ets
interface
#887
Labels
Comments
bettio
added a commit
that referenced
this issue
Apr 4, 2024
Added a limited implementation of the OTP ets interface *** Few opening words, Fred recently passed away and this is the last time I will merge a PR from him. It was an honor to work with you on this project, thanks for your precious help and for taking part to this journey. Fred, will miss you. *** This PR implements a small subset of the OTP `ets` interface. The following `ets` functions are supported: * `ets:new/2` * `ets:insert/2` * `ets:lookup/2` * `ets:delete/2` The following parameters to `ets:new/2` are supported: * `is_named` * `{keypos, I :: non_neg_integer()}` * `private` | `protected` | `public` access types Only the `set` table type is supported. This limited functionality allows users to define ETS tables and share term data between processes in a manner that is more efficient than using message passing with a process. The likely initial users of this feature will be the logging subsystem, as well as parts of the (forthcoming) application support, for storing application environment settings. This PR provides a partial implementation of issue #887. Subsequent PRs can add additional features from this issue. For information about the OTP `ets` interface, see https://www.erlang.org/doc/man/ets. This implementation attempts to be API-compatible with the OTP implementation. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
I'm unable to get gleam/mist running due to a dependency on ets:lookup_element/3 . I fully understand the unfortunate circumstances around it being partially completed, so forgive me for asking. |
pguyot
added a commit
to pguyot/AtomVM
that referenced
this issue
Apr 25, 2024
Mentioned in atomvm#887, required to port gleam/mist. Implementation is in C as initially designed by @fadushin, which saves a little bit memory as we don't need to copy the whole entry. Signed-off-by: Paul Guyot <pguyot@kallisys.net>
pguyot
added a commit
to pguyot/AtomVM
that referenced
this issue
Apr 25, 2024
Mentioned in atomvm#887, required to port gleam/mist. Implementation is in C as initially designed by @fadushin, which saves a little bit memory as we don't need to copy the whole entry. Signed-off-by: Paul Guyot <pguyot@kallisys.net>
bettio
added a commit
that referenced
this issue
Apr 27, 2024
Implement ets:lookup_element/3 Mentioned in #887, required to port gleam/mist. Implementation is in C as initially designed by @fadushin, which saves a little bit memory as we don't need to copy the whole entry. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/2
with support for theset
type,key_pos
,named_table
,private
,public
, andprotected
access, andread_concrrency
(opportunistic)ets:member/2
ets:insert/2
andets:insert_new/2
ets:lookup/2
andets:lookup_element/3
ets:delete/2
andets: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.The text was updated successfully, but these errors were encountered: