Reputation: 237
Can the Erlang ETS tables be shared among different processes? Thus, if I have two processes running on different Erlang running systems, can I somehow link them so that all the changes I do in one ETS table will be reflected in the other?
Upvotes: 1
Views: 2055
Reputation: 20916
You cannot "share" an ETS table between processes on different nodes, an ETS table is only accessible by processes on the node on which it was created. If you want to share ETS tables then you will need create a process on one node, the node with the table, and access the table from the other node through this process. It is not really that difficult.
Upvotes: 4
Reputation: 41528
Within a single Erlang node, ETS tables can be fully shared by passing the public
option to ets:new
. (Beware that the table will be destroyed if its owner dies, though, unless you have set up an heir.)
If you need to share tables across several Erlang nodes, you need to use Mnesia.
Upvotes: 11