RE: W3C Working Draft for Data Store API

Hi Zoltan,

On 11 feb 2014 at 09:18:41, Kis, Zoltan wrote:
> Hi Eduardo,
>
> On Tue, Feb 11, 2014 at 9:02 AM, Gene Lian <clian@mozilla.com> wrote:
>> Hi Eduardo!
>>
>> ----- Original Message -----
>>> From: "EDUARDO FULLEA CARRERA" <efc@tid.es> To: "Gene Lian"
>>> <clian@mozilla.com> Cc: public-sysapps@w3.org, "Ehsan Akhgari"
>>> <ehsan@mozilla.com>, "Andrew Overholt" <overholt@mozilla.com>, "Jonas
>>> Sicking" <jonas@sicking.cc> Sent: Thursday, February 6, 2014 10:47:43
>>> PM Subject: RE: W3C Working Draft for Data Store API
>>>
>>> It is ok to have to separate operations but in order to avoid duplicated
>>> operations we could drop 'add' with 'id' as argument and stick to:
>>> update (data, id)
>>> add (data)
>>
>> Yeap! I doubt the same thing. I'll ask around why Mozilla separates
>> this in the first design.
>
> I thought we have discussed that in
> https://github.com/airpingu/data-store-api/issues/12

>
> Giving it a second thought, let's start from use cases.
>
> There are 3 different data adding use cases one would possibly like
> DataStore to handle:
> 1. update data with a given id; if the id does not exist, fail.
> 2. insert data; a new id is returned on success, else fail.
> 3. insert data if it does not exist; if it exists, then update it.
>
> The first 2 are trivial. The third has some challenge about how to
> formalize, and how to implement it. One example was given as inserting
> URL's in a DB, if they did not exist in the DB. This would not need
> the update part: if the data exists, just don't add. On the other
> hand, one knows the content, but not the id. So if we support 3., we
> need a way to specify "if data exists". In most cases that can be
> reduced to an id/primary key, but in some cases the content matters.
> IMO a generic way to deal with this would be the following:
>
> Promise<index> add(any data, DOMString[] props);
>

Not sure the benefits of case 3 are worth the complexity. Is there a real demand for that?
In any case we may want to separate (and probably rename) the function from the regular add (case 2)


________________________________

Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo.
This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at:
http://www.tid.es/ES/PAGINAS/disclaimer.aspx

Received on Tuesday, 11 February 2014 09:47:51 UTC