Open tleyden opened 11 years ago
Hmm, just realized that my workaround will break all existing code because the changes function is changed from:
type ChangeHandler func(r io.Reader) int64
to
type ChangeHandler func(r io.Reader) string
@snej can you remind me what exactly the string part of the sequence means? Also, if something is following the changes feed, I take it it will need to preserve this string part when requesting since=?
?
I'm asking because in couch-go the expectation is that the sequence is numeric-only and the code would need to be changed in order to accommodate strings.
Here's what I changed to make it work against Sync Gateway:
https://github.com/tleyden/go-couch/commit/a8d50160edbc9956bab0b1d567d3615f003a4e95
not going to submit a pull request since there might be a cleaner way to solve this.
CouchDB sequence IDs are opaque — the correct type to use is probably interface{}
, not int64
or string
.
The only thing you can validly do with a received sequence ID is send it in the since
parameter of a future changes feed request. You can't even safely compare IDs for equality, since some implementations (like Cloudant) can represent the same sequence in different ways when called at different times.
It sounds like you do need to break existing code.
More Sync Gateway <-> Go-Couch incompatibilities: https://github.com/couchbase/sync_gateway/issues/190#issuecomment-30987039
CouchDB style sequence: 4356 (numeric only)
Sync Gateway style sequence:
*:4356
(the "*" means something related to the channels, which I can't remember off the top of my head)I've got a workaround/fix, will send a pull request.