/** * Obtain a handle to the merged reader. * * @return (possibly cached) handle to the merged reader. * @throws java.io.IOException * if tables cannot be opened. */ protected Reftable reader() throws IOException { lock.lock(); try { if (mergedTables == null) { mergedTables = new MergedReftable(stack().readers()); } return mergedTables; } finally { lock.unlock(); } }
/** * Write a compaction to {@code out}. * * @param out * stream to write the compacted tables to. Caller is responsible * for closing {@code out}. * @throws java.io.IOException * if tables cannot be read, or cannot be written. */ public void compact(OutputStream out) throws IOException { MergedReftable mr = new MergedReftable(new ArrayList<>(tables)); mr.setIncludeDeletes(includeDeletes); writer.setMinUpdateIndex(Math.max(minUpdateIndex, 0)); writer.setMaxUpdateIndex(maxUpdateIndex); writer.begin(out); mergeRefs(mr); mergeLogs(mr); writer.finish(); stats = writer.getStats(); }
/** * Obtain a handle to the merged reader. * * @return (possibly cached) handle to the merged reader. * @throws java.io.IOException * if tables cannot be opened. */ protected Reftable reader() throws IOException { lock.lock(); try { if (mergedTables == null) { mergedTables = new MergedReftable(stack().readers()); } return mergedTables; } finally { lock.unlock(); } }
/** * Write a compaction to {@code out}. * * @param out * stream to write the compacted tables to. Caller is responsible * for closing {@code out}. * @throws java.io.IOException * if tables cannot be read, or cannot be written. */ public void compact(OutputStream out) throws IOException { MergedReftable mr = new MergedReftable(new ArrayList<>(tables)); mr.setIncludeDeletes(includeDeletes); writer.setMinUpdateIndex(Math.max(minUpdateIndex, 0)); writer.setMaxUpdateIndex(maxUpdateIndex); writer.begin(out); mergeRefs(mr); mergeLogs(mr); writer.finish(); stats = writer.getStats(); }