Esempio n. 1
0
        public BoltWriter(Stream stream, int defaultBufferSize, int maxBufferSize, ILogger logger, bool supportBytes)
        {
            Throw.ArgumentNullException.IfNull(stream, nameof(stream));

            _logger           = logger;
            _chunkWriter      = new ChunkWriter(stream, defaultBufferSize, maxBufferSize, logger);
            _packStreamWriter = supportBytes ? new PackStreamWriter(_chunkWriter.ChunkerStream) : new PackStreamWriterBytesIncompatible(_chunkWriter.ChunkerStream);
        }
Esempio n. 2
0
        public BoltWriter(Stream stream, int defaultBufferSize, int maxBufferSize, ILogger logger, IPackStreamFactory packStreamFactory)
        {
            Throw.ArgumentNullException.IfNull(stream, nameof(stream));
            Throw.ArgumentOutOfRangeException.IfFalse(stream.CanWrite, nameof(stream));
            Throw.ArgumentNullException.IfNull(packStreamFactory, nameof(packStreamFactory));

            _chunkWriter      = new ChunkWriter(stream, defaultBufferSize, maxBufferSize, logger);
            _packStreamWriter = packStreamFactory.CreateWriter(_chunkWriter.ChunkerStream);
        }
        public MessageWriter(Stream stream, int defaultBufferSize, int maxBufferSize, IDriverLogger logger, IMessageFormat messageFormat)
        {
            Throw.ArgumentNullException.IfNull(stream, nameof(stream));
            Throw.ArgumentOutOfRangeException.IfFalse(stream.CanWrite, nameof(stream));
            Throw.ArgumentNullException.IfNull(messageFormat, nameof(messageFormat));

            _chunkWriter      = new ChunkWriter(stream, defaultBufferSize, maxBufferSize, logger);
            _packStreamWriter = messageFormat.CreateWriter(_chunkWriter.ChunkerStream);
        }
Esempio n. 4
0
 public GZipManager(string inFile, ISourceReader reader, IChunkWriter chunkWriter,
                    IFileSplitterFactory fileSplitterFactory, ICompressorFactory compressorFactory, ITaskFactory taskFactory, IErrorLogs errorLogs)
 {
     _chunkWriter         = chunkWriter;
     _sourceReader        = reader;
     _taskFactory         = taskFactory;
     _inFile              = inFile;
     _fileSplitterFactory = fileSplitterFactory;
     _compressorFactory   = compressorFactory;
     _errorLogs           = errorLogs;
 }
Esempio n. 5
0
 public FileWriterTask(int chunksCount, IChunkWriter chunkWriter, IErrorLogs errorLogs)
 {
     _chunksCount = chunksCount;
     _chunkWriter = chunkWriter;
     _errorLogs   = errorLogs;
     _thread      = new Thread(Consume)
     {
         IsBackground = true, Name = "Background worker (file writer)"
     };
     _thread.Start();
 }
Esempio n. 6
0
 public FileDisassemblerService(int sizeofChunksInBytes
                                , IFileRepository fileRepository
                                , IEofMessageRepository eofMessageRepository
                                , File file
                                , IChunkWriter chunkWriter)
 {
     _sizeofChunkInBytes   = sizeofChunksInBytes;
     _fileRepository       = fileRepository;
     _eofMessageRepository = eofMessageRepository;
     _file        = file;
     _chunkWriter = chunkWriter;
 }
Esempio n. 7
0
 public void Merge(IChunkReader[] chunkReaders, IChunkWriter output)
 {
     var list = new LinkedList<Pair>();
     for(int i = 0; i < chunkReaders.Length; i++)
     {
         string current = chunkReaders[i].MoveNextLine();
         if(current == null)
             continue;
         AddToList(list, new Pair(i, current));
     }
     while(list.Count > 0)
     {
         Pair pair = list.First.Value;
         list.RemoveFirst();
         string line = pair.Key;
         output.WriteLine(line);
         string current = chunkReaders[pair.InputIndex].MoveNextLine();
         if(current == null)
             continue;
         pair.Key = current;
         AddToList(list, pair);
     }
 }
        public GZipTestDecompress(IChunkReader chunkReader, IChunkWriter chunkWriter)
        {
            _ChunkReader = chunkReader ?? throw new ArgumentNullException(nameof(chunkReader));

            _ChunkWriter = chunkWriter ?? throw new ArgumentNullException(nameof(chunkWriter));
        }
Esempio n. 9
0
 /// <summary>
 /// Create task for writing chunks after compression, decompression
 /// </summary>
 /// <param name="chunksCount">Count of chunks for write</param>
 /// <param name="chunkWriter">Writer</param>
 /// <param name="errorLogs">Execution error logs</param>
 /// <returns>Writer task</returns>
 public IWriterTask CreatWriterTask(int chunksCount, IChunkWriter chunkWriter, IErrorLogs errorLogs)
 {
     return(new FileWriterTask(chunksCount, chunkWriter, errorLogs));
 }
Esempio n. 10
0
 public DataTransfer(StorageHandle storage, IChunkWriter target)
 {
     this.storage = storage;
     this.target  = target;
 }