@ThreadSafe public class LocalCachePositionReader extends Object implements PositionReader
PositionReader
that reads from a local cache if possible.Modifier and Type | Field and Description |
---|---|
protected long |
mPageSize
Page size in bytes.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the positon reader and do cleanup job if any.
|
static LocalCachePositionReader |
create(AlluxioConfiguration conf,
CacheManager cacheManager,
CloseableSupplier<PositionReader> fallbackReader,
URIStatus status,
long pageSize,
CacheContext cacheContext) |
static LocalCachePositionReader |
create(CacheManager cacheManager,
CloseableSupplier<PositionReader> fallbackReader,
FileId fileId,
long fileSize,
long pageSize,
CacheContext cacheContext) |
protected com.google.common.base.Stopwatch |
createUnstartedStopwatch() |
Optional<DataFileChannel> |
getDataFileChannel(long position,
int length)
Get a
DataFileChannel which wraps a FileRegion . |
long |
getPageSize()
Get the page size.
|
int |
readInternal(long position,
ReadTargetBuffer buffer,
int length) |
public static LocalCachePositionReader create(AlluxioConfiguration conf, CacheManager cacheManager, CloseableSupplier<PositionReader> fallbackReader, URIStatus status, long pageSize, CacheContext cacheContext)
conf
- cacheManager
- fallbackReader
- status
- pageSize
- cacheContext
- public static LocalCachePositionReader create(CacheManager cacheManager, CloseableSupplier<PositionReader> fallbackReader, FileId fileId, long fileSize, long pageSize, CacheContext cacheContext)
cacheManager
- fallbackReader
- fileId
- fileSize
- pageSize
- cacheContext
- public int readInternal(long position, ReadTargetBuffer buffer, int length) throws IOException
readInternal
in interface PositionReader
position
- position of the file to start reading databuffer
- target byte bufferlength
- bytes to readIOException
public void close() throws IOException
PositionReader
close
in interface PositionReader
close
in interface Closeable
close
in interface AutoCloseable
IOException
public Optional<DataFileChannel> getDataFileChannel(long position, int length)
DataFileChannel
which wraps a FileRegion
.position
- the start position to readlength
- how many bytes to readDataFileChannel
protected com.google.common.base.Stopwatch createUnstartedStopwatch()
public long getPageSize()
Copyright © 2023. All Rights Reserved.