computeMetadataOnlyUpdate computes a new metadataOnlyUpdate based on the existing document's CAS and metadataOnlyUpdate
(currentCas uint64, revNo uint64, currentMou *MetadataOnlyUpdate)
| 1419 | |
| 1420 | // computeMetadataOnlyUpdate computes a new metadataOnlyUpdate based on the existing document's CAS and metadataOnlyUpdate |
| 1421 | func computeMetadataOnlyUpdate(currentCas uint64, revNo uint64, currentMou *MetadataOnlyUpdate) *MetadataOnlyUpdate { |
| 1422 | var prevCas string |
| 1423 | currentCasString := base.CasToString(currentCas) |
| 1424 | if currentMou != nil && currentCasString == currentMou.HexCAS { |
| 1425 | prevCas = currentMou.PreviousHexCAS |
| 1426 | } else { |
| 1427 | prevCas = currentCasString |
| 1428 | } |
| 1429 | |
| 1430 | metadataOnlyUpdate := &MetadataOnlyUpdate{ |
| 1431 | HexCAS: expandMacroCASValueString, // when non-empty, this is replaced with cas macro expansion |
| 1432 | PreviousHexCAS: prevCas, |
| 1433 | PreviousRevSeqNo: revNo, |
| 1434 | } |
| 1435 | return metadataOnlyUpdate |
| 1436 | } |
| 1437 | |
| 1438 | // HasCurrentVersion Compares the specified CV with the fetched documents CV, returns error on mismatch between the two |
| 1439 | func (d *Document) HasCurrentVersion(ctx context.Context, cv Version) error { |
no test coverage detected