@Override public boolean accept(Path p) { return HFileLink.isHFileLink(p); } }
/** * @param splitRow * @return A {@link Reference} that points at top half of a an hfile */ public static Reference createTopReference(final byte [] splitRow) { return new Reference(splitRow, Range.top); }
@Override public int size() { return baos.size(); } }
/** * @return ImmutableBytesWritable * * @see org.apache.hadoop.mapred.RecordReader#createKey() */ public ImmutableBytesWritable createKey() { return new ImmutableBytesWritable(); }
public void testSpecificCompare() { ImmutableBytesWritable ibw1 = new ImmutableBytesWritable(new byte[]{0x0f}); ImmutableBytesWritable ibw2 = new ImmutableBytesWritable(new byte[]{0x00, 0x00}); ImmutableBytesWritable.Comparator c = new ImmutableBytesWritable.Comparator(); assertFalse("ibw1 < ibw2", c.compare( ibw1, ibw2 ) < 0 ); }
/** * @param b Use passed bytes as backing array for this instance. */ public void set(final byte [] b) { set(b, 0, b.length); }
/** * Check if this storeFile may contain keys within the TimeRange that * have not expired (i.e. not older than oldestUnexpiredTS). * @param tr the timeRange to restrict * @param oldestUnexpiredTS the oldest timestamp that is not expired, as * determined by the column family's TTL * @return false if queried keys definitely don't exist in this StoreFile */ boolean passesTimerangeFilter(TimeRange tr, long oldestUnexpiredTS) { return this.timeRange == null? true: this.timeRange.includesTimeRange(tr) && this.timeRange.getMax() >= oldestUnexpiredTS; }
/** * Get versions of columns only within the specified timestamp range, * [minStamp, maxStamp). * @param minStamp minimum timestamp value, inclusive * @param maxStamp maximum timestamp value, exclusive * @throws IOException * @return this for invocation chaining */ public Get setTimeRange(long minStamp, long maxStamp) throws IOException { tr = new TimeRange(minStamp, maxStamp); return this; }
private void initPoolWithAllBuffers(ByteBufferPool pool, int maxBuffersInPool) { ByteBuffer[] buffers = new ByteBuffer[maxBuffersInPool]; // Just call getBuffer() on pool 'maxBuffersInPool' so as to init all buffers and then put back // all. Makes pool with max #buffers. for (int i = 0; i < maxBuffersInPool; i++) { buffers[i] = pool.getBuffer(); } for (ByteBuffer buf : buffers) { pool.putbackBuffer(buf); } } }
private void doComparisonsOnObjects(ImmutableBytesWritable a, ImmutableBytesWritable b, int expectedSignum) { ImmutableBytesWritable.Comparator comparator = new ImmutableBytesWritable.Comparator(); assertEquals( "Comparing " + a + " and " + b + " as objects", signum(comparator.compare(a, b)), expectedSignum); assertEquals( "Comparing " + a + " and " + b + " as objects (inverse)", -signum(comparator.compare(b, a)), expectedSignum); }
@Override public OutputStream get(int expectedSize) { baos = new ByteBufferOutputStream(expectedSize); return baos; }
public static final void updateReadLatency(long latencyMillis, boolean pread) { if (pread) { metrics.updateFsPreadTime(latencyMillis); } else { metrics.updateFsReadTime(latencyMillis); } }
public FileLinkInputStream(final FileSystem fs, final FileLink fileLink, int bufferSize) throws IOException { this.bufferSize = bufferSize; this.fileLink = fileLink; this.fs = fs; this.in = tryOpen(); }
/** * @param originPath Original location of the file to link * @param alternativePaths Alternative locations to look for the linked file */ public FileLink(Path originPath, Path... alternativePaths) { setLocations(originPath, alternativePaths); }
/** * A constructor that reads files with the latest minor version. * This is used by unit tests only. */ FSReaderImpl(FSDataInputStream istream, long fileSize, HFileContext fileContext) throws IOException { this(new FSDataInputStreamWrapper(istream), fileSize, null, null, fileContext); }
/** * Dead simple hfile link constructor */ public HFileLink(final Path originPath, final Path tempPath, final Path mobPath, final Path archivePath) { this.tempPath = tempPath; this.originPath = originPath; this.mobPath = mobPath; this.archivePath = archivePath; setLocations(originPath, tempPath, mobPath, archivePath); }
/** * @param originPath Path to the wal in the log directory * @param archivePath Path to the wal in the archived log directory */ public WALLink(final Path originPath, final Path archivePath) { setLocations(originPath, archivePath); } }
@Override public void write(int b) { checkSizeAndGrow(Bytes.SIZEOF_BYTE); buf[this.pos] = (byte) b; this.pos++; }
/** * @param splitRow * @return A {@link Reference} that points at the bottom half of a an hfile */ public static Reference createBottomReference(final byte [] splitRow) { return new Reference(splitRow, Range.bottom); }