Exemplo n.º 1
0
 private void ReportChunks()
 {
     checked
     {
         foreach (ChunkInfo chunk in _chunksSeen)
         {
             var fixedChunk = new ChunkInfo(chunk.Offset + _lastPushBaseline, chunk.Size, chunk.Hash);
             _callback(fixedChunk);
         }
     }
 }
Exemplo n.º 2
0
            private int PushBufferInner(byte[] buffer, int startOffset, int count)
            {
                checked
                {
                    using (IChunkerSession inner = _chunker.BeginChunking(FoundChunk))
                    {
                        inner.PushBuffer(buffer, startOffset, count);
                    }

                    //don't trust the last one ...
                    _chunksSeen.RemoveAt(_chunksSeen.Count - 1);

                    ReportChunks();

                    ChunkInfo secondToLastChunk = _chunksSeen.Last();
                    int       bytesChunked      = (int)(secondToLastChunk.Offset + secondToLastChunk.Size);

                    _chunksSeen.Clear();
                    _lastPushBaseline += (uint)bytesChunked;

                    return(bytesChunked);
                }
            }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DedupNode"/> struct from the given chunk.
 /// </summary>
 public DedupNode(ChunkInfo chunk)
     : this(NodeType.ChunkLeaf, chunk.Size, chunk.Hash, 0)
 {
 }
 private void SaveChunks(ChunkInfo chunk)
 {
     _chunks.Add(chunk);
 }
Exemplo n.º 5
0
 private void FoundChunk(ChunkInfo chunk)
 {
     _chunksSeen.Add(chunk);
 }
Exemplo n.º 6
0
 private void FoundChunk(ChunkInfo chunk)
 {
     Contract.Assert(chunk.Size != 0);
     _chunksSeen.Add(chunk);
 }
 private void SaveChunks(ChunkInfo chunk)
 {
     Contract.Check(chunk.Size != 0)?.Assert($"{nameof(SaveChunks)}: chunk size cannot be zero. Size: {chunk.Size}");
     _chunks.Add(chunk);
 }