Exemple #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="HasherToken" /> struct.
        /// </summary>
        /// <remarks>
        ///     When the token is disposed, the hasher will be added back to the object pool.
        /// </remarks>
        public HasherToken(IPoolHandle <HashAlgorithm> pooledHasher)
        {
            Contract.Requires(pooledHasher.Value != null);

            Hasher      = pooledHasher.Value;
            _poolHandle = pooledHasher;
        }
Exemple #2
0
            public Session(IChunker chunker, Action <ChunkInfo> callback)
            {
                _pushBufferHandle = PushBufferPool.Get();
                _pushBuffer       = _pushBufferHandle.Value;

                _chunksSeenHandle = ChunksSeenPool.Get();
                _chunksSeen       = _chunksSeenHandle.Value;

                _chunker  = chunker;
                _callback = callback;
            }
Exemple #3
0
            public Session(DeterministicChunker parent, Action <ChunkInfo> callback)
            {
                _parent = parent;

                _pushBufferHandle = _parent._pushBufferPool.Get();
                _pushBuffer       = _pushBufferHandle.Value;

                _chunksSeenHandle = ChunksSeenPool.Get();
                _chunksSeen       = _chunksSeenHandle.Value;

                _callback = callback;
            }