channelsForRevTreeID returns the set of channels the given revision is in for the document Channel information is only stored for leaf nodes in the revision tree, as we don't keep full history of channel information
(revTreeID string)
| 1402 | // channelsForRevTreeID returns the set of channels the given revision is in for the document |
| 1403 | // Channel information is only stored for leaf nodes in the revision tree, as we don't keep full history of channel information |
| 1404 | func (doc *Document) channelsForRevTreeID(revTreeID string) (base.Set, bool) { |
| 1405 | if revTreeID == "" || doc.GetRevTreeID() == revTreeID { |
| 1406 | return doc.getCurrentChannels(), true |
| 1407 | } |
| 1408 | |
| 1409 | // lookup in history for other revisions |
| 1410 | if rev, ok := doc.History[revTreeID]; ok { |
| 1411 | // return ok only if we found a leaf |
| 1412 | // since 4.0 we don't store non-leaf channel info and lookups for non-leaf revisions shouldn't succeed |
| 1413 | return rev.Channels, doc.History.isLeaf(revTreeID) |
| 1414 | } |
| 1415 | |
| 1416 | // no rev |
| 1417 | return nil, false |
| 1418 | } |
| 1419 | |
| 1420 | // computeMetadataOnlyUpdate computes a new metadataOnlyUpdate based on the existing document's CAS and metadataOnlyUpdate |
| 1421 | func computeMetadataOnlyUpdate(currentCas uint64, revNo uint64, currentMou *MetadataOnlyUpdate) *MetadataOnlyUpdate { |