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

Method CVEqual

db/document.go:665–670  ·  view source on GitHub ↗

CVEqual returns true if the provided CV does not match _sync.rev.ver and _sync.rev.src. The caller is responsible for testing if the values are non-empty.

(cv Version)

Source from the content-addressed store, hash-verified

663
664// CVEqual returns true if the provided CV does not match _sync.rev.ver and _sync.rev.src. The caller is responsible for testing if the values are non-empty.
665func (s *SyncData) CVEqual(cv Version) bool {
666 if cv.SourceID != s.RevAndVersion.CurrentSource {
667 return false
668 }
669 return cv.Value == base.HexCasToUint64(s.RevAndVersion.CurrentVersion)
670}
671
672// IsSGWrite determines if a document was written by Sync Gateway or via an SDK. CV is an optional parameter to check. This would represent _vv.ver and _vv.src
673func (s *SyncData) IsSGWrite(ctx context.Context, cas uint64, rawBody []byte, rawUserXattr []byte, cv cvExtractor) (isSGWrite bool, crc32Match bool, bodyChanged bool) {

Callers 3

IsSGWriteMethod · 0.95
IsSGWriteMethod · 0.80
TestSyncDataCVEqualFunction · 0.80

Calls 1

HexCasToUint64Function · 0.92

Tested by 1

TestSyncDataCVEqualFunction · 0.64