@NotThreadSafe public class BufferCachingGrpcDataReader extends Object
Modifier and Type | Field and Description |
---|---|
protected long |
mPosToRead
The next pos to read.
|
Modifier | Constructor and Description |
---|---|
protected |
BufferCachingGrpcDataReader(WorkerNetAddress address,
CloseableResource<BlockWorkerClient> client,
long dataTimeoutMs,
ReadRequest readRequest,
GrpcBlockingStream<ReadRequest,ReadResponse> stream)
Creates an instance of
BufferCachingGrpcDataReader . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the
BufferCachingGrpcDataReader . |
static BufferCachingGrpcDataReader |
create(FileSystemContext context,
WorkerNetAddress address,
ReadRequest readRequest)
Creates an instance of
BufferCachingGrpcDataReader for block reads. |
int |
deRef()
Decreases the reference count and return the current count.
|
int |
getRefCount() |
protected DataBuffer |
readChunk()
Reads a chunk of data.
|
DataBuffer |
readChunk(int index)
Reads a specific chunk from the block.
|
int |
ref()
Increases the reference count and return the current count.
|
protected BufferCachingGrpcDataReader(WorkerNetAddress address, CloseableResource<BlockWorkerClient> client, long dataTimeoutMs, ReadRequest readRequest, GrpcBlockingStream<ReadRequest,ReadResponse> stream)
BufferCachingGrpcDataReader
.address
- the data server addressclient
- the block worker client to read data fromdataTimeoutMs
- the maximum time to wait for a data responsereadRequest
- the read requeststream
- the underlying gRPC stream to read data@Nullable public DataBuffer readChunk(int index) throws IOException
index
- the chunk indexIOException
@Nullable protected DataBuffer readChunk() throws IOException
IOException
public void close() throws IOException
BufferCachingGrpcDataReader
.IOException
public int ref()
public int deRef()
public int getRefCount()
public static BufferCachingGrpcDataReader create(FileSystemContext context, WorkerNetAddress address, ReadRequest readRequest) throws IOException
BufferCachingGrpcDataReader
for block reads.context
- the file system contextaddress
- the worker addressreadRequest
- the read requestBufferCachingGrpcDataReader
IOException
Copyright © 2023. All Rights Reserved.