Exemplo n.º 1
0
        public static ReplicationBatchItem From(DocumentTombstone doc)
        {
            var item = new ReplicationBatchItem
            {
                Etag = doc.Etag,
                Id   = doc.LowerId,
                TransactionMarker = doc.TransactionMarker,
                ChangeVector      = doc.ChangeVector
            };

            switch (doc.Type)
            {
            case DocumentTombstone.TombstoneType.Document:
                item.Type              = ReplicationItemType.DocumentTombstone;
                item.Collection        = doc.Collection;
                item.Flags             = doc.Flags;
                item.LastModifiedTicks = doc.LastModified.Ticks;
                break;

            case DocumentTombstone.TombstoneType.Attachment:
                item.Type = ReplicationItemType.AttachmentTombstone;
                break;

            case DocumentTombstone.TombstoneType.Revision:
                item.Type       = ReplicationItemType.RevisionTombstone;
                item.Collection = doc.Collection;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(doc.Type));
            }

            return(item);
        }
Exemplo n.º 2
0
 public void WriteTombstone(DocumentTombstone tombstone, SmugglerProgressBase.CountsWithLastEtag progress)
 {
     _command.Add(new DocumentItem
     {
         Tombstone = tombstone
     });
     HandleBatchOfDocumentsIfNecessary();
 }
Exemplo n.º 3
0
        public unsafe void HandleDelete(DocumentTombstone tombstone, string collection, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats)
        {
            var tx         = indexContext.Transaction.InnerTransaction;
            var loweredKey = tombstone.LowerId;

            using (Slice.External(tx.Allocator, loweredKey.Buffer, loweredKey.Size, out Slice tombstoneKeySlice))
                _indexStorage.RemoveReferences(tombstoneKeySlice, collection, null, indexContext.Transaction);
        }
Exemplo n.º 4
0
 protected ExtractedItem(DocumentTombstone tombstone, string collection)
 {
     Etag         = tombstone.Etag;
     DocumentId   = tombstone.LowerId;
     IsDelete     = true;
     Collection   = collection;
     ChangeVector = tombstone.ChangeVector;
 }
Exemplo n.º 5
0
        public override void HandleDelete(DocumentTombstone tombstone, string collection, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats)
        {
            if (_referencedCollections.Count > 0)
            {
                _handleReferences.HandleDelete(tombstone, collection, writer, indexContext, stats);
            }

            base.HandleDelete(tombstone, collection, writer, indexContext, stats);
        }
Exemplo n.º 6
0
        public RavenEtlItem(DocumentTombstone tombstone, string collection) : base(tombstone, collection)
        {
            if (collection != null)
            {
                return;
            }

            CollectionFromMetadata = tombstone.Collection;
        }
Exemplo n.º 7
0
        protected ExtractedItem(DocumentTombstone tombstone, string collection)
        {
            Etag         = tombstone.Etag;
            DocumentId   = tombstone.LowerId;
            IsDelete     = true;
            Collection   = collection;
            ChangeVector = tombstone.ChangeVector;

            if (collection == null)
            {
                CollectionFromMetadata = tombstone.Collection;
            }
        }
Exemplo n.º 8
0
            public void WriteTombstone(DocumentTombstone tombstone, SmugglerProgressBase.CountsWithLastEtag progress)
            {
                if (First == false)
                {
                    Writer.WriteComma();
                }
                First = false;

                _context.Write(Writer, new DynamicJsonValue
                {
                    ["Key"] = tombstone.LowerId,
                    [nameof(DocumentTombstone.Type)]         = tombstone.Type.ToString(),
                    [nameof(DocumentTombstone.Collection)]   = tombstone.Collection,
                    [nameof(DocumentTombstone.Flags)]        = tombstone.Flags.ToString(),
                    [nameof(DocumentTombstone.ChangeVector)] = tombstone.ChangeVector,
                    [nameof(DocumentTombstone.DeletedEtag)]  = tombstone.DeletedEtag,
                    [nameof(DocumentTombstone.Etag)]         = tombstone.Etag,
                    [nameof(DocumentTombstone.LastModified)] = tombstone.LastModified,
                });
            }
Exemplo n.º 9
0
        public override unsafe void HandleDelete(DocumentTombstone tombstone, string collection, IndexWriteOperation writer,
                                                 TransactionOperationContext indexContext, IndexingStatsScope stats)
        {
            using (Slice.External(indexContext.Allocator, tombstone.LowerId.Buffer, tombstone.LowerId.Length, out Slice docKeyAsSlice))
            {
                MapReduceWorkContext.DocumentMapEntries.RepurposeInstance(docKeyAsSlice, clone: false);

                if (MapReduceWorkContext.DocumentMapEntries.NumberOfEntries == 0)
                {
                    return;
                }

                foreach (var mapEntry in GetMapEntries(MapReduceWorkContext.DocumentMapEntries))
                {
                    var store = GetResultsStore(mapEntry.ReduceKeyHash, indexContext, create: false);

                    store.Delete(mapEntry.Id);
                }

                MapReduceWorkContext.MapPhaseTree.DeleteFixedTreeFor(tombstone.LowerId, sizeof(ulong));
            }
        }
Exemplo n.º 10
0
 public override void HandleDelete(DocumentTombstone tombstone, string collection, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats)
 {
     throw new NotSupportedException($"Index {Name} is in-memory implementation of a faulty index", _e);
 }
Exemplo n.º 11
0
 public ToSqlItem(DocumentTombstone tombstone, string collection) : base(tombstone, collection)
 {
 }
Exemplo n.º 12
0
 public RavenEtlItem(DocumentTombstone tombstone, string collection) : base(tombstone, collection)
 {
 }
Exemplo n.º 13
0
 public override void HandleDelete(DocumentTombstone tombstone, string collection, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats)
 {
     writer.Delete(tombstone.LoweredKey, stats);
 }
Exemplo n.º 14
0
 public override void HandleDelete(DocumentTombstone tombstone, string collection, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats)
 {
     throw new NotImplementedException();
 }