Esempio n. 1
0
        private void OnWrite(IAsyncResult asyncResult)
        {
            FileQueue.Chunk chunk = asyncResult.AsyncState as FileQueue.Chunk;

            fileStream.EndWrite(asyncResult);

            if (metrics != null)
            {
                metrics.OnFileWritten(chunk.Size);
            }

            chunk.Commit();
        }
Esempio n. 2
0
        private void FileCallback(FileQueue.Chunk chunk)
        {
            if (FileOperations.AreSynchronous)
            {
                fileStream.Write(chunk.Buffer, chunk.Offset, chunk.Size);

                if (metrics != null)
                {
                    metrics.OnFileWritten(chunk.Size);
                }

                chunk.Commit();
            }
            else
            {
                if (writeCallback == null)
                {
                    writeCallback = this.OnWrite;
                }

                fileStream.BeginWrite(chunk.Buffer, chunk.Offset, chunk.Size, writeCallback, chunk);
            }
        }