コード例 #1
0
 /// <exception cref="System.IO.IOException"/>
 public HdfsDataOutputStream(CryptoOutputStream @out, FileSystem.Statistics stats,
                             long startPosition)
     : base(@out, stats, startPosition)
 {
     Preconditions.CheckArgument(@out.GetWrappedStream() is DFSOutputStream, "CryptoOutputStream should wrap a DFSOutputStream"
                                 );
 }
コード例 #2
0
        public virtual void TestStatistics()
        {
            URI fsUri = GetFsUri();

            FileSystem.Statistics stats = FileContext.GetStatistics(fsUri);
            Assert.Equal(0, stats.GetBytesRead());
            Path filePath = fileContextTestHelper.GetTestRootPath(fc, "file1");

            FileContextTestHelper.CreateFile(fc, filePath, numBlocks, blockSize);
            Assert.Equal(0, stats.GetBytesRead());
            VerifyWrittenBytes(stats);
            FSDataInputStream fstr = fc.Open(filePath);

            byte[] buf       = new byte[blockSize];
            int    bytesRead = fstr.Read(buf, 0, blockSize);

            fstr.Read(0, buf, 0, blockSize);
            Assert.Equal(blockSize, bytesRead);
            VerifyReadBytes(stats);
            VerifyWrittenBytes(stats);
            VerifyReadBytes(FileContext.GetStatistics(GetFsUri()));
            IDictionary <URI, FileSystem.Statistics> statsMap = FileContext.GetAllStatistics();
            URI exactUri = GetSchemeAuthorityUri();

            VerifyWrittenBytes(statsMap[exactUri]);
            fc.Delete(filePath, true);
        }
コード例 #3
0
        //fc should be set appropriately by the deriving test.
        /// <exception cref="System.Exception"/>
        public virtual void TestStatisticsOperations()
        {
            FileSystem.Statistics stats = new FileSystem.Statistics("file");
            Assert.Equal(0L, stats.GetBytesRead());
            Assert.Equal(0L, stats.GetBytesWritten());
            Assert.Equal(0, stats.GetWriteOps());
            stats.IncrementBytesWritten(1000);
            Assert.Equal(1000L, stats.GetBytesWritten());
            Assert.Equal(0, stats.GetWriteOps());
            stats.IncrementWriteOps(123);
            Assert.Equal(123, stats.GetWriteOps());
            Thread thread = new _Thread_61(stats);

            thread.Start();
            Uninterruptibles.JoinUninterruptibly(thread);
            Assert.Equal(124, stats.GetWriteOps());
            // Test copy constructor and reset function
            FileSystem.Statistics stats2 = new FileSystem.Statistics(stats);
            stats.Reset();
            Assert.Equal(0, stats.GetWriteOps());
            Assert.Equal(0L, stats.GetBytesWritten());
            Assert.Equal(0L, stats.GetBytesRead());
            Assert.Equal(124, stats2.GetWriteOps());
            Assert.Equal(1000L, stats2.GetBytesWritten());
            Assert.Equal(0L, stats2.GetBytesRead());
        }
コード例 #4
0
ファイル: FTPFileSystem.cs プロジェクト: orf53975/hadoop.net
 public _FSDataOutputStream_263(FTPFileSystem _enclosing, FTPClient client, OutputStream
                                baseArg1, FileSystem.Statistics baseArg2)
     : base(baseArg1, baseArg2)
 {
     this._enclosing = _enclosing;
     this.client     = client;
 }
コード例 #5
0
 public FTPInputStream(InputStream stream, FTPClient client, FileSystem.Statistics
                       stats)
 {
     if (stream == null)
     {
         throw new ArgumentException("Null InputStream");
     }
     if (client == null || !client.IsConnected())
     {
         throw new ArgumentException("FTP client null or not connected");
     }
     this.wrappedStream = stream;
     this.client        = client;
     this.stats         = stats;
     this.pos           = 0;
     this.closed        = false;
 }
コード例 #6
0
 public _Thread_61(FileSystem.Statistics stats)
 {
     this.stats = stats;
 }
コード例 #7
0
 /// <summary>Bytes written may be different for different file systems.</summary>
 /// <remarks>
 /// Bytes written may be different for different file systems. This method should
 /// throw assertion error if bytes written are incorrect.
 /// </remarks>
 /// <param name="stats"/>
 protected internal abstract void VerifyWrittenBytes(FileSystem.Statistics stats);
コード例 #8
0
 /// <exception cref="System.IO.IOException"/>
 public FSDataOutputStream(OutputStream @out, FileSystem.Statistics stats, long startPosition
                           )
     : base(new FSDataOutputStream.PositionCache(@out, stats, startPosition))
 {
     wrappedStream = @out;
 }
コード例 #9
0
 /// <exception cref="System.IO.IOException"/>
 public FSDataOutputStream(OutputStream @out, FileSystem.Statistics stats)
     : this(@out, stats, 0)
 {
 }
コード例 #10
0
 /// <exception cref="System.IO.IOException"/>
 public PositionCache(OutputStream @out, FileSystem.Statistics stats, long pos)
     : base(@out)
 {
     statistics = stats;
     position   = pos;
 }
コード例 #11
0
 protected internal override void VerifyWrittenBytes(FileSystem.Statistics stats)
 {
     //Extra 12 bytes are written apart from the block.
     Assert.Equal(blockSize + 12, stats.GetBytesWritten());
 }
コード例 #12
0
 protected internal override void VerifyReadBytes(FileSystem.Statistics stats)
 {
     // one blockSize for read, one for pread
     Assert.Equal(2 * blockSize, stats.GetBytesRead());
 }
コード例 #13
0
 /// <exception cref="System.IO.IOException"/>
 public HdfsDataOutputStream(CryptoOutputStream @out, FileSystem.Statistics stats)
     : this(@out, stats, 0L)
 {
 }
コード例 #14
0
 /// <exception cref="System.IO.IOException"/>
 public HdfsDataOutputStream(DFSOutputStream @out, FileSystem.Statistics stats, long
                             startPosition)
     : base(@out, stats, startPosition)
 {
 }