[erlang-questions] Storing tuples directly in Mnesia without records
shahzad bhatti
bhatti_shahzad@REDACTED
Sun Sep 30 19:34:44 CEST 2007
Though, I would like to use tuples of any arity, so that clients can store any tuples without defining schema. But it sounds like I will have to add that constraint for arity and record name. Also, is it possible for insert to automatically add table/schema if it does not exist. And is there any event that I can listen to know when tuples are added to simulate blocking read/remove (preferably using pattern based filtering). Thanks again.
Ulf Wiger <ulf@REDACTED> wrote: Yes, you can use tuples directly. Unlike ets, mnesia requires
the key to be the second element in the tuple, and the first
element needs to be a label (record_name).
Mnesia will check that the inserted data is a tuple of the
right arity, and that the first element of the tuple is equal
to the 'record_name' of the table (this defaults to the table
name, but can be changed with the {record_name, N} option.
Remember, records are only syntactic sugar for tagged tuples.
BR,
Ulf W
2007/9/30, shahzad bhatti :
> I am trying to build a Linda like tuple space in Erlang and though my simple
> application is using ets for now, but I would like to use Mnesia to store
> tuples directly to take leverage of its replication and transactions
> capabilities. Since, Mnesia supports multiple tables that map to records, is
> it possible to use tuples directly. Also, if anyone can suggest anything
> that will make it easier to implement tuplespace with blocking get/read
> operations. Thanks in advance.
>
>
>
> ________________________________
> Pinpoint customers who are looking for what you sell.
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
---------------------------------
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070930/afe2d866/attachment.htm>
More information about the erlang-questions
mailing list