On Feb 15, 2009, at 2:10 PM, Jens Alfke wrote:
I'm interested in using CouchDB in a peer-to-peer fashion to
propagate content between nodes that don't necessarily trust each
other. The available documentation sort of runs out before getting
to many of the aspects I'm interested in [I am eagerly awaiting more
chapters of the book!] but from reading the list archives and
people's blog posts, it sounds like it should be do-able. I'm just
not clear on the details.
• Is it possible to pull part of a database? For example, I might to
pull only nodes whose names start with a particular prefix, or whose
content contains a particular key/value pair.
Not yet, but my plan is you send a javascript function to a server,
and it's used to figure out which documents to replicate. The function
is invoked with each document that's potentially going to replicate,
and the function returns true or false.
• Can the server validate the content of documents being pulled from
another DB? I may want to disallow updates that modify an "author:"
property, or whose "date:" property isn't in a valid format. Or I
might want to check a digital signature[1] on each incoming entry.
It's broken when used currently, but yes. This will work is part of
the replication security work that's coming. hopefully soon.
• Likewise, can the server validate docs being posted directly,
outside of replication?
That's already there.
Some sort of generic validator hook that got called on all docs
being added to the db, and could give thumbs up or down, would
suffice. One of jchris's blog posts[2] implies this exists, but he's
deciphering its functionality from a unit test, and as a total
newbie I couldn't follow the details of what this hook is capable of.
This is pretty much how it's intended to work, but for now it's
incomplete.
-Damien