IsInConflict is true if the incoming HLV is in conflict with the current document.
(ctx context.Context, db *DatabaseCollectionWithUser, incomingHLV *HybridLogicalVector, putOpts PutDocOptions, revTreeConflictCheck, revTreeConflictCheckStatus bool)
| 1487 | |
| 1488 | // IsInConflict is true if the incoming HLV is in conflict with the current document. |
| 1489 | func (doc *Document) IsInConflict(ctx context.Context, db *DatabaseCollectionWithUser, incomingHLV *HybridLogicalVector, putOpts PutDocOptions, revTreeConflictCheck, revTreeConflictCheckStatus bool) HLVConflictStatus { |
| 1490 | // If there is no SyncData, then the document can not be in conflict. |
| 1491 | if doc.SyncData.Sequence == 0 { |
| 1492 | return HLVNoConflict |
| 1493 | |
| 1494 | } |
| 1495 | // we need to check if local CV version was generated from a revID if so we need to perform conflict check on rev tree history |
| 1496 | if doc.HLV.HasRevEncodedCV() { |
| 1497 | if revTreeConflictCheck { |
| 1498 | if revTreeConflictCheckStatus { |
| 1499 | return HLVConflict |
| 1500 | } else { |
| 1501 | return HLVNoConflict |
| 1502 | } |
| 1503 | } else { |
| 1504 | _, _, isConflictErr := db.revTreeConflictCheck(ctx, putOpts.RevTreeHistory, doc, putOpts.NewDoc.Deleted) |
| 1505 | if isConflictErr != nil { |
| 1506 | return HLVConflict |
| 1507 | } |
| 1508 | } |
| 1509 | return HLVNoConflict |
| 1510 | } |
| 1511 | return IsInConflict(ctx, doc.HLV, incomingHLV) |
| 1512 | } |
| 1513 | |
| 1514 | // DocVersion represents a specific version of a document in an revID/HLV agnostic manner. |
| 1515 | // Users should access the properties via the CV and RevTreeID methods, to ensure there's a check that the specific version type is not empty. |
no test coverage detected