replication - How to selectively replicate private and shared portions of a CouchDB database? -
we're looking using couchdb/couchcocoa replicate data our mobile app.
our system has large number of users. part of database private each user -- example tasks. these i've been able replicate without problem using filtered replication.
here's catch... database includes shared information of pertains given user. how selectively replicate shared information? example user's task might reference specific shared documents. there way make sure documents included in replication without including all shared documents?
from documentation seems adding doc_ids
replication (or adding replication doc ids) might 1 solution. has 1 tried this? there other solutions?
edit: given number of users seems impractical tag each shared document users sharing perhaps that's way this?
final solution depends on documents structure, see 2 use-cases:
as keep within single database, have fields set recognize, document shared or document private, right? example:
owner: "mike"
participants: [] // if there nobody mentioned, document looks private(?)
so need filter handle private documents , shared ones: tags, number of participants, references or somehow.
also, if need replicate documents specific user (e.g. mike), need special view handle these documents and, yes, use replication document ids, wouldn't atomic request: need service script handle these steps. if shared documents defined references them, solution same: service script, view generated document reference tree , replication doc._id's.
review architecture. having per user database normal use-case couchdb , follows way of data partitioning , isolation. may create per user database private user. shared documents may create additional databases playing database members of security options. each "shared" database handle number of participants names or groups, there couldn't data leaks unless not couchdb bug(:
this approach looks weird first sight, you've needed there create management script handle database creation , publication, replications easy possible , users data in safe.
p.s. i've supposed "sharing" operation makes document visible not every one, set of users. if wrong , "shared" state means "public" state p2. more simpler: n users databases + 1 public one.
Comments
Post a Comment