[erlang-questions] ets vs list
Johan Montelius
johanmon@REDACTED
Tue Sep 14 11:02:41 CEST 2010
While we're talking ets tables:
Wouldn't it be nice to be able to send table references across nodes?
Today when you create a new tabel you get a table reference that is an
integer. The table can only be accessed by processes in the same node and
god know what will happen if you send the reference over to another node
where there is another table registered under the same number.
Since tables have a mutable state they should be modeled as processess.
When you create a table you get a process identifier. Locally on the node
where the table was created all operations are done as usual i.e. direct
access to the table without the overhead of sending messages. When you
send the process identifier over to another node however, a process
identifier is sent that refers to a proxy process on the originating node.
Using the functions in the ets module using a regular process identifier
would result in messages being sent to that process and replies being
received. Just like accessing a local ets table (slower and we have to
have some error codes if the process is dead).
One could the also open up for a asynchronous access to the table:
Ref = ets:lookup_and_send_me_the_reply(Table, Key),
do_something(),
receive
{Ref, Value} ->
How's that :-)
Johan
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the erlang-questions
mailing list