couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Pavlogiannis <paulogiann.couc...@gmail.com>
Subject Dealing with Atomic Operations
Date Tue, 05 Jan 2010 03:48:27 GMT
Hello,

I 've been experimenting with Couchdb and I have reached a point in 
which I need to do some transactions in an atomic way. I know that 
Couchdb lacks locking, so is there a uniform way to deal with this?
In particular, I have created a filesystem in which each file and folder 
is represented by a single document, while its pathname is a list. For 
example:

['root', 'home']
['root', 'home', pictures']
['root', 'home', 'pictures', 'picture.jpg']

Now, when creating the document with pathname ['root', 'home', 
pictures', 'my_dog.jpg'], I need to make sure that its parent, ['root', 
'home', pictures'] exists in the db. Moreover, I need to ensure that the 
user is not exceeding his quota.
The bulk update way would be ideal if  a possible conflict would create 
the appropriate error messages but as far as I know, that's not the 
case. Moreover, there are cases in which a bulk update seems inevitable 
(for example, when deleting a folder, so all its contents must be 
deleted too), but its poor behavior in a bad scenario (with document 
conflicts) makes it a bit difficult to use.

Is there any way to circumvent all these problems?
Is the behavior of the bulk updates going to change in the near future?

Thanks,
Andeas

Mime
View raw message