[erlang-questions] Storing tuples directly in Mnesia without records

Ludovic Coquelle lcoquelle@REDACTED
Mon Oct 1 02:34:33 CEST 2007


would it be possible to define a wrapper record? I mean something in the
line of:
{data_wrapper, SomeKey, SomeData} ... such that SomeData can be whatever you
need.

On 10/1/07, shahzad bhatti <bhatti_shahzad@REDACTED> wrote:
>
> 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<http://us.rd.yahoo.com/evt=48249/*http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz>at Yahoo! Search.
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20071001/45769145/attachment.htm>


More information about the erlang-questions mailing list