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

Method updateWinningRevAndSetDocFlags

db/crud.go:2200–2212  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

2198}
2199
2200func (doc *Document) updateWinningRevAndSetDocFlags(ctx context.Context) {
2201 revtreeID, branched, inConflict := doc.History.winningRevision(ctx)
2202 doc.SetRevTreeID(revtreeID)
2203 doc.setFlag(channels.Deleted, doc.History[revtreeID].Deleted)
2204 doc.setFlag(channels.Conflict, inConflict)
2205 doc.setFlag(channels.Branched, branched)
2206 doc.setFlag(channels.UnchangedCV, doc.localWinsConflict)
2207 if doc.hasFlag(channels.Deleted) {
2208 doc.SyncData.TombstonedAt = time.Now().Unix()
2209 } else {
2210 doc.SyncData.TombstonedAt = 0
2211 }
2212}
2213
2214func (db *DatabaseCollectionWithUser) storeOldBodyInRevTreeAndUpdateCurrent(ctx context.Context, doc *Document, prevCurrentRev string, newRevID string, newDoc *Document, newDocHasAttachments bool) {
2215 if doc.HasBody() && doc.GetRevTreeID() != prevCurrentRev && prevCurrentRev != "" {

Callers 1

documentUpdateFuncMethod · 0.80

Calls 4

setFlagMethod · 0.95
hasFlagMethod · 0.95
winningRevisionMethod · 0.80
SetRevTreeIDMethod · 0.80

Tested by

no test coverage detected