sync_npm

gratipay.sync_npm.consume_change_stream(stream, db)[source]

Given an iterable of CouchDB change notifications and a GratipayDB, read from the stream and write to the db.

The npm registry is a CouchDB app, which means we get a change stream from it that allows us to follow registry updates in near-realtime. Our strategy here is to maintain open connections to both the registry and our own database, and write as we read.

gratipay.sync_npm.process_doc(doc)[source]

Return a smoothed-out doc, or None if it’s not a package doc, meaning there’s no name key and it’s probably a design doc, per:

gratipay.sync_npm.production_change_stream(seq)[source]

Given a sequence number in the npm registry change stream, start streaming from there!