couchdb-replication mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <>
Subject Server feature detection
Date Wed, 05 Feb 2014 20:22:37 GMT
Features are being added to CouchDB over time, and there are compatible servers that may have
nonstandard features (like _bulk_get). But there isn't a clear way for a client (which might
be another server's replicator) to determine what features a server has. Currently a client
looking at the response of a GET / has to read tea leaves to figure out what server it's talking
to, then based on that parse the version number, and then has to consult hardcode knowledge
that version X of server Y supports feature Z.

(True, you can often get away without needing to check, by assuming a feature exists but falling
back to standard behavior if you get an error. But not all features may be so easy to detect
— the behavior of an unaware server might be to ignore the feature and do the wrong thing,
rather than returning an error — and anyway this adds extra round-trips that slow down the

As for version detection, here's what I get from CouchDB:
	"vendor":{"version":"1.4.0","name":"The Apache Software Foundation"}}
Couchbase Sync Gateway:
	{"couchdb": "welcome", "version": "Couchbase Sync Gateway/0.93"}
	"vendor":{"version":"1.3.0r1","name":"Iris Couch"}}

I hadn't noticed the "vendor" property before; probably it was added to CouchDB after I'd
implemented my first "/" handler :) I'll add that to the next release of the Sync Gateway.
That takes care of deducing the server and version.

But it would still be best to explicitly encode information about features. How about adding
a property called "features" or "extensions" whose value is an array of strings, each string
being an agreed-upon identifier of a specific feature? For example:
	{"couchdb": "welcome", "features": ["_bulk_get", "channels"]}, "vendor": …

View raw message