/// <summary> /// Initializes a new instance of the <see cref="Chunker"/> class. /// </summary> public ComChunkerNonDeterministic() { _chunkLibrary = NativeMethods.CreateChunkLibrary(); _chunkLibrary.InitializeForPushBuffers(); object chunksEnum; _chunkLibrary.StartChunking(IteratorComGuid, out chunksEnum); _chunkHashIterator = (IDedupIterateChunksHash32)chunksEnum; }
/// <summary> /// Initializes a new instance of the <see cref="Chunker"/> class. /// </summary> public ComChunker() { _bytesInPushBuffer = 0; _totalBytes = 0; _chunkLibrary = NativeMethods.CreateChunkLibrary(); _chunkLibrary.InitializeForPushBuffers(); object chunksEnum; _chunkLibrary.StartChunking(IteratorComGuid, out chunksEnum); _chunkHashIterator = (IDedupIterateChunksHash32)chunksEnum; }
/// <summary> /// Initializes a new instance of the <see cref="Chunker"/> class. /// </summary> public ComChunkerNonDeterministic(ChunkerConfiguration config) { if (Thread.CurrentThread.GetApartmentState() != ApartmentState.MTA) { throw new System.Threading.ThreadStateException("Thread must be in MTA ApartmentState"); } Contract.Assert( config.AvgChunkSize == ComChunker.SupportedAvgChunkSize, "ComChunker only supports average chunk size of 64KB" ); _chunkLibrary = NativeMethods.CreateChunkLibrary(); _chunkLibrary.InitializeForPushBuffers(); Action[] configures = new Action[] { () => { var max = (object)(config.MaxChunkSize); _chunkLibrary.SetParameter(NativeMethods.DEDUP_PT_MaxChunkSizeBytes, ref max); }, () => { // THIS IS NOT HONORED var avg = (object)(config.AvgChunkSize); _chunkLibrary.SetParameter(NativeMethods.DEDUP_PT_AvgChunkSizeBytes, ref avg); }, () => { var min = (object)(config.MinChunkSize); _chunkLibrary.SetParameter(NativeMethods.DEDUP_PT_MinChunkSizeBytes, ref min); }, }; // The order in which these need to be set depends on whether we are going bigger or smaller // than the default. if (config.MaxChunkSize < ChunkerConfiguration.SupportedComChunkerConfiguration.MaxChunkSize) { Array.Reverse(configures); } foreach (Action configure in configures) { configure(); } object chunksEnum; _chunkLibrary.StartChunking(IteratorComGuid, out chunksEnum); _chunkHashIterator = (IDedupIterateChunksHash32)chunksEnum; }
/// <summary> /// Initializes a new instance of the <see cref="Chunker"/> class. /// </summary> public ComChunkerNonDeterministic() { _chunkLibrary = NativeMethods.CreateChunkLibrary(); _chunkLibrary.InitializeForPushBuffers(); Contract.Assert( Thread.CurrentThread.GetApartmentState() == ApartmentState.MTA, "Thread must be in MTA ApartmentState"); object chunksEnum; _chunkLibrary.StartChunking(IteratorComGuid, out chunksEnum); _chunkHashIterator = (IDedupIterateChunksHash32)chunksEnum; }