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

Function buildResolverBody

db/crud.go:1804–1833  ·  view source on GitHub ↗
(localDoc, incomingDoc *Document)

Source from the content-addressed store, hash-verified

1802}
1803
1804func buildResolverBody(localDoc, incomingDoc *Document) (Body, Body, error) {
1805 localRevID := localDoc.SyncData.GetRevTreeID()
1806 localAttachments := localDoc.Attachments()
1807 localExpiry := localDoc.SyncData.Expiry
1808
1809 remoteAttachments := incomingDoc.Attachments()
1810
1811 localDocBody, err := localDoc.GetDeepMutableBody()
1812 if err != nil {
1813 return nil, nil, err
1814 }
1815 localDocBody[BodyRev] = localRevID
1816 localDocBody[BodyId] = localDoc.ID
1817 localDocBody[BodyAttachments] = localAttachments
1818 localDocBody[BodyExpiry] = localExpiry
1819 localDocBody[BodyDeleted] = localDoc.IsDeleted()
1820 localDocBody[BodyCV] = localDoc.HLV.GetCurrentVersionString()
1821
1822 remoteDocBody, err := incomingDoc.GetDeepMutableBody()
1823 if err != nil {
1824 return nil, nil, err
1825 }
1826 remoteDocBody[BodyRev] = incomingDoc.RevID
1827 remoteDocBody[BodyId] = incomingDoc.ID
1828 remoteDocBody[BodyAttachments] = remoteAttachments
1829 remoteDocBody[BodyDeleted] = incomingDoc.Deleted
1830 remoteDocBody[BodyCV] = incomingDoc.HLV.GetCurrentVersionString()
1831
1832 return localDocBody, remoteDocBody, nil
1833}
1834
1835func (db *DatabaseCollectionWithUser) resolveHLVConflict(ctx context.Context, localDoc, incomingDoc *Document, resolver *ConflictResolver, revTreeHistory []string) (*HybridLogicalVector, []string, error) {
1836 if resolver == nil {

Callers 2

resolveHLVConflictMethod · 0.85
resolveConflictMethod · 0.85

Calls 5

AttachmentsMethod · 0.80
GetDeepMutableBodyMethod · 0.80
IsDeletedMethod · 0.65
GetRevTreeIDMethod · 0.45

Tested by

no test coverage detected