Пример #1
0
        public ISnapshot DeSerializeSnapshot(BinaryReader reader)
        {
            SnapshotHeader header;
            SnapshotPatch  patch = _snapSerializer.DeSerialize(reader, out header);

            ClearOldSnapshot(patch.BaseSnapshotSeq, header.SnapshotSeq);
            var baseSnap = SnapshotCloner.Clone(GetBaseSnapshot(patch.BaseSnapshotSeq));

            baseSnap.Header = header;
            patch.ApplyPatchTo(baseSnap, _snapSerializer.GetSerializerManager());
            patch.ReleaseReference();
            if (_receivedSnapMap.ContainsKey(baseSnap.SnapshotSeq))
            {
                Logger.ErrorFormat("SnapSHotSeq {0} exist", baseSnap.SnapshotSeq);
            }
            else
            {
                _receivedSnapMap.Add(baseSnap.SnapshotSeq, baseSnap);
            }
            baseSnap.AcquireReference();
            return(baseSnap);
        }