@Ignore @Test public void readPerformanceTest() throws IOException, InterruptedException { long maxSize = 1024L * 1024 * 1024; int batchSize = 1024 * 10; try (JournalPersistence store = prepareStore()) { write(store, maxSize, ByteUtils.createRandomSizeBytes(batchSize)); read(store, batchSize, maxSize); } }
public byte[] read(long position, int length) throws IOException { if (length == 0) return new byte[0]; checkReadPosition(position); StoreFile storeFile = getStoreFile(position); if(null == storeFile) { return null; } int relPosition = (int) (position - storeFile.position()); return storeFile.read(relPosition, length).array(); }
PositioningStore implements JournalPersistence, MonitoredPersistence, Closeable { public byte[] read(long position, int length) throws IOException { if (length == 0) return new byte[0]; checkReadPosition(position); StoreFile storeFile = getStoreFile(position); if(null == storeFile) { return null; } int relPosition = (int) (position - storeFile.position()); return storeFile.read(relPosition, length).array(); } }
PositioningStore implements JournalPersistence, MonitoredPersistence, Closeable { public byte[] read(long position, int length) throws IOException { if (length == 0) return new byte[0]; checkReadPosition(position); StoreFile storeFile = getStoreFile(position); if(null == storeFile) { return null; } int relPosition = (int) (position - storeFile.position()); return storeFile.read(relPosition, length).array(); } PositioningStore(); }
PositioningStore implements JournalPersistence, MonitoredPersistence, Closeable { public byte[] read(long position, int length) throws IOException { if (length == 0) return new byte[0]; checkReadPosition(position); StoreFile storeFile = getStoreFile(position); if(null == storeFile) { return null; } int relPosition = (int) (position - storeFile.position()); return storeFile.read(relPosition, length).array(); } PositioningStore(); void truncate(long givenMax); void delete(); void recover(Path path, long min, Properties properties); @Override long append(byte[] bytes); @Override long append(List<byte[]> bytesList ); @Override long min(); @Override long physicalMin(); @Override long max(); @Override long flushed(); @Override void flush(); byte[] read(long position, int length); Long readLong(long position); long compact(long givenMin); @Override Path getBasePath(); @Override void close(); @Override Path getPath(); @Override long getFreeSpace(); @Override long getTotalSpace(); @Override String toString(); }
PositioningStore implements JournalPersistence, MonitoredPersistence, Closeable { public byte[] read(long position, int length) throws IOException { if (length == 0) return new byte[0]; checkReadPosition(position); StoreFile storeFile = getStoreFile(position); if(null == storeFile) { return null; } int relPosition = (int) (position - storeFile.position()); return storeFile.read(relPosition, length).array(); } PositioningStore(); void truncate(long givenMax); void delete(); void recover(Path path, long min, Properties properties); @Override long append(byte[] bytes); @Override long append(List<byte[]> bytesList ); @Override long min(); @Override long physicalMin(); @Override long max(); @Override long flushed(); @Override void flush(); byte[] read(long position, int length); Long readLong(long position); long compact(long givenMin); @Override Path getBasePath(); @Override void close(); @Override Path getPath(); @Override long getFreeSpace(); @Override long getTotalSpace(); @Override String toString();  }