MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / channelsForRevTreeID

Method channelsForRevTreeID

db/document.go:1404–1418  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
1404func (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
1421func computeMetadataOnlyUpdate(currentCas uint64, revNo uint64, currentMou *MetadataOnlyUpdate) *MetadataOnlyUpdate {

Callers 6

IsChannelRemovalMethod · 0.95
getRevisionMethod · 0.80
getCurrentVersionMethod · 0.80
authorizeDocMethod · 0.80
getRevisionMethod · 0.80
updateAndReturnDocMethod · 0.80

Calls 3

getCurrentChannelsMethod · 0.80
isLeafMethod · 0.80
GetRevTreeIDMethod · 0.45

Tested by 2

getRevisionMethod · 0.64
getCurrentVersionMethod · 0.64