couchdb replication algo