-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CBG-3727: Diagnostic API: Get all doc channels #6701
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, suggestion to avoid iterating over history more than once.
Redocly previews |
- $ref: ../../components/parameters.yaml#/db | ||
- $ref: ../../components/parameters.yaml#/user-name | ||
get: | ||
summary: Get all channels for a user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
summary: Get all channels for a user | |
summary: Get channel history for a document |
Another comment about the ChannelSetHistory data I just thought of: Those sequence ranges can over-represent the sequences at which the docs were in the channel, and the API format doesn't distinuqish complete entries and "merged" history entries. Might be worth formatting the history differently so we can tell which entries are complete and which are multiple compressed/compacted sequence ranges. E.g.
This might require an additional field in the struct containing start/end seq to denote a compacted range. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your change to MarshalJSON isn't symmetrical with UnmarshalJSON, and will make things start to error with compacted sequence ranges.
if pair.Compacted { | ||
stringPair = fmt.Sprintf("%d~%d", pair.StartSeq, pair.EndSeq) | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're doing this text representation in MarshalJSON
, an equivalent should be put in UnmarshalJSON
.
Right now the two aren't compatible, and will error when running the splitPair := strings.Split(stringPair, "-")
step.
* Add handling and test for get all doc channels * Fix lint * Add licensing * Address comments * Add docs * fix yamllint * Add DocumentHistoryMaxEntriesPerChannel test case and fix docs * Denote compacted sequence pairs with ~ * Fix goimports * Fix comment * Fix comment * Add unmarshalJSON handlign for compacted sequence pair
CBG-3727
Describe your PR here...
Example response:
{"CHAN1":["6-0","1-2","3-5"],"CHAN2":["4-5","2-3"],"CHAN3":["5-6"]}
Pre-review checklist
fmt.Print
,log.Print
, ...)base.UD(docID)
,base.MD(dbName)
)docs/api
Dependencies (if applicable)
Integration Tests
GSI=true,xattrs=true
https://jenkins.sgwdev.com/job/SyncGateway-Integration/2319/