@Test public void readPagesMetrics() throws Exception { int fileSize = PAGE_SIZE * 5; byte[] testData = BufferUtils.getIncreasingByteArray(fileSize); ByteArrayCacheManager manager = new ByteArrayCacheManager(); LocalCacheFileInStream stream = setupWithSingleFile(testData, manager); int readSize = fileSize - 1; byte[] cacheMiss = new byte[readSize]; stream.read(cacheMiss); Assert.assertEquals(0, MetricsSystem.meter(MetricKey.CLIENT_CACHE_BYTES_READ_CACHE.getName()).getCount()); Assert.assertEquals(readSize, MetricsSystem.meter( MetricKey.CLIENT_CACHE_BYTES_REQUESTED_EXTERNAL.getName()).getCount()); Assert.assertEquals(fileSize, MetricsSystem.meter(MetricKey.CLIENT_CACHE_BYTES_READ_EXTERNAL.getName()).getCount()); stream.read(); Assert.assertEquals(1, MetricsSystem.meter(MetricKey.CLIENT_CACHE_BYTES_READ_CACHE.getName()).getCount()); Assert.assertEquals(readSize, MetricsSystem.meter( MetricKey.CLIENT_CACHE_BYTES_REQUESTED_EXTERNAL.getName()).getCount()); Assert.assertEquals(fileSize, MetricsSystem.meter(MetricKey.CLIENT_CACHE_BYTES_READ_EXTERNAL.getName()).getCount()); }
@Override public int read() throws IOException { int bytesRead = read(mSingleByte); if (bytesRead == -1) { return -1; } Preconditions.checkState(bytesRead == 1); return BufferUtils.byteToInt(mSingleByte[0]); }
LocalCacheFileInStream extends FileInStream { @Override public int read() throws IOException { int bytesRead = read(mSingleByte); if (bytesRead == -1) { return -1; } Preconditions.checkState(bytesRead == 1); return BufferUtils.byteToInt(mSingleByte[0]); } }
LocalCacheFileInStream extends FileInStream { @Override public int read() throws IOException { int bytesRead = read(mSingleByte); if (bytesRead == -1) { return -1; } Preconditions.checkState(bytesRead == 1); return BufferUtils.byteToInt(mSingleByte[0]); } LocalCacheFileInStream(AlluxioURI path, OpenFilePOptions options, FileSystem externalFs,
      CacheManager cacheManager);  LocalCacheFileInStream(URIStatus status, OpenFilePOptions options, FileSystem externalFs,
      CacheManager cacheManager); }
LocalCacheFileInStream extends FileInStream { @Override public int read() throws IOException { int bytesRead = read(mSingleByte); if (bytesRead == -1) { return -1; } Preconditions.checkState(bytesRead == 1); return BufferUtils.byteToInt(mSingleByte[0]); } LocalCacheFileInStream(AlluxioURI path, OpenFilePOptions options, FileSystem externalFs,
      CacheManager cacheManager);  LocalCacheFileInStream(URIStatus status, OpenFilePOptions options, FileSystem externalFs,
      CacheManager cacheManager); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(long n); @Override void close(); @Override long remaining(); @Override int positionedRead(long pos, byte[] b, int off, int len); @Override long getPos(); @Override void seek(long pos); }
LocalCacheFileInStream extends FileInStream { @Override public int read() throws IOException { int bytesRead = read(mSingleByte); if (bytesRead == -1) { return -1; } Preconditions.checkState(bytesRead == 1); return BufferUtils.byteToInt(mSingleByte[0]); } LocalCacheFileInStream(AlluxioURI path, OpenFilePOptions options, FileSystem externalFs,
      CacheManager cacheManager);  LocalCacheFileInStream(URIStatus status, OpenFilePOptions options, FileSystem externalFs,
      CacheManager cacheManager); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override long skip(long n); @Override void close(); @Override long remaining(); @Override int positionedRead(long pos, byte[] b, int off, int len); @Override long getPos(); @Override void seek(long pos);  }