Exemple #1
0
        private CollectionName ResolveConflictAndAddTombstone(DocumentsOperationContext context, string changeVector,
                                                              IReadOnlyList <DocumentConflict> conflicts, out long etag)
        {
            var indexOfLargestEtag = FindIndexOfLargestEtagAndMergeChangeVectors(conflicts, out string mergedChangeVector);
            var latestConflict     = conflicts[indexOfLargestEtag];
            var collectionName     = new CollectionName(latestConflict.Collection);

            using (DocumentIdWorker.GetSliceFromId(context, latestConflict.Id, out Slice lowerId))
            {
                //note that CreateTombstone is also deleting conflicts
                etag = _documentsStorage.CreateTombstone(context,
                                                         lowerId,
                                                         latestConflict.Etag,
                                                         collectionName,
                                                         context.GetLazyString(mergedChangeVector),
                                                         latestConflict.LastModified.Ticks,
                                                         changeVector,
                                                         latestConflict.Flags).Etag;
            }

            return(collectionName);
        }