Example #1
0
        public override unsafe void Read(DocumentsOperationContext context, IncomingReplicationStatsScope stats)
        {
            IncomingReplicationStatsScope scope;

            if (Type == ReplicationItemType.Document)
            {
                scope = stats.For(ReplicationOperation.Incoming.DocumentRead, start: false);
                stats.RecordDocumentRead();
            }
            else
            {
                scope = stats.For(ReplicationOperation.Incoming.TombstoneRead, start: false);
                stats.RecordDocumentTombstoneRead();
            }

            using (scope.Start())
            {
                LastModifiedTicks = *(long *)Reader.ReadExactly(sizeof(long));

                Flags = *(DocumentFlags *)Reader.ReadExactly(sizeof(DocumentFlags)) | DocumentFlags.FromReplication;

                SetLazyStringValueFromString(context, out Id);

                var documentSize = *(int *)Reader.ReadExactly(sizeof(int));
                if (documentSize != -1) //if -1, then this is a tombstone
                {
                    using (var read = stats.For(ReplicationOperation.Incoming.DocumentRead).Start())
                    {
                        read.RecordDocumentRead();

                        var mem = Reader.AllocateMemory(documentSize);
                        Reader.ReadExactly(mem, documentSize);

                        Data = new BlittableJsonReaderObject(mem, documentSize, context);
                        Data.BlittableValidation();
                    }
                }
                else
                {
                    SetLazyStringValueFromString(context, out Collection);
                }
            }
        }
        public override unsafe void Read(DocumentsOperationContext context, IncomingReplicationStatsScope stats)
        {
            using (stats.For(ReplicationOperation.Incoming.TombstoneRead))
            {
                stats.RecordAttachmentTombstoneRead();
                LastModifiedTicks = *(long *)Reader.ReadExactly(sizeof(long));

                var size = *(int *)Reader.ReadExactly(sizeof(int));
                ToDispose(Slice.From(context.Allocator, Reader.ReadExactly(size), size, ByteStringType.Immutable, out Key));
            }
        }
Example #3
0
 public override unsafe void Read(DocumentsOperationContext context, IncomingReplicationStatsScope stats)
 {
     using (stats.For(ReplicationOperation.Incoming.TombstoneRead))
     {
         stats.RecordRevisionTombstoneRead();
         LastModifiedTicks = *(long *)Reader.ReadExactly(sizeof(long));
         SetLazyStringValueFromString(context, out Id);
         SetLazyStringValueFromString(context, out Collection);
         Debug.Assert(Collection != null);
     }
 }
        public override unsafe void Read(DocumentsOperationContext context, IncomingReplicationStatsScope stats)
        {
            using (stats.For(ReplicationOperation.Incoming.AttachmentRead))
            {
                stats.RecordAttachmentRead();

                var size = *(int *)Reader.ReadExactly(sizeof(int));
                ToDispose(Slice.From(context.Allocator, Reader.ReadExactly(size), size, ByteStringType.Immutable, out Key));

                SetLazyStringValueFromString(context, out Name);
                SetLazyStringValueFromString(context, out ContentType);

                var base64HashSize = *Reader.ReadExactly(sizeof(byte));
                ToDispose(Slice.From(context.Allocator, Reader.ReadExactly(base64HashSize), base64HashSize, out Base64Hash));
            }
        }