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

Method resolveDocRemoteWins

db/crud.go:1922–1933  ·  view source on GitHub ↗

resolveDocRemoteWins makes the following changes to the document: - Tombstones the local revision The remote revision is added to the revision tree by the standard update processing.

(ctx context.Context, localDoc *Document, conflict Conflict)

Source from the content-addressed store, hash-verified

1920//
1921// The remote revision is added to the revision tree by the standard update processing.
1922func (db *DatabaseCollectionWithUser) resolveDocRemoteWins(ctx context.Context, localDoc *Document, conflict Conflict) (resolvedRevID string, err error) {
1923
1924 // Tombstone the local revision
1925 localRevID := localDoc.GetRevTreeID()
1926 tombstoneRevID, tombstoneErr := db.tombstoneActiveRevision(ctx, localDoc, localRevID)
1927 if tombstoneErr != nil {
1928 return "", tombstoneErr
1929 }
1930 remoteRevID := conflict.RemoteDocument.ExtractRev()
1931 base.DebugfCtx(ctx, base.KeyReplicate, "Resolved conflict for doc %s as remote wins - remote rev is %s, previous local rev %s tombstoned by %s, ", base.UD(localDoc.ID), remoteRevID, localRevID, tombstoneRevID)
1932 return remoteRevID, nil
1933}
1934
1935// localWinsConflictResolutionRevTreeHandling handles the revision tree updates required for local wins conflict
1936// resolution. This is used for both legacy conflict resolution and HLV conflict resolution

Callers 1

resolveConflictMethod · 0.95

Calls 5

DebugfCtxFunction · 0.92
UDFunction · 0.92
ExtractRevMethod · 0.80
GetRevTreeIDMethod · 0.45

Tested by

no test coverage detected