@InterfaceAudience.Public @InterfaceStability.Stable public abstract class ReplicaAccessor extends Object
Constructor and Description |
---|
ReplicaAccessor() |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Release the resources associated with the ReplicaAccessor.
|
int |
getNetworkDistance()
Return the network distance between local machine and the remote machine.
|
abstract boolean |
isLocal()
Return true if bytes read via this accessor should count towards the
local byte count statistics.
|
abstract boolean |
isShortCircuit()
Return true if bytes read via this accessor should count towards the
short-circuit byte count statistics.
|
abstract int |
read(long pos,
byte[] buf,
int off,
int len)
Read bytes from the replica.
|
abstract int |
read(long pos,
ByteBuffer buf)
Read bytes from the replica.
|
public abstract int read(long pos, byte[] buf, int off, int len) throws IOException
pos
- The position in the replica to start reading at.
Must not be negative.buf
- The byte array to read into.off
- The offset within buf to start reading into.len
- The maximum length to read.IOException
public abstract int read(long pos, ByteBuffer buf) throws IOException
pos
- The position in the replica to start reading at.
Must not be negative.buf
- The byte buffer to read into. The amount to read will be
dictated by the remaining bytes between the current
position and the limit. The ByteBuffer may or may not be
direct.IOException
public abstract void close() throws IOException
IOException
public abstract boolean isLocal()
public abstract boolean isShortCircuit()
public int getNetworkDistance()
Copyright © 2023 Apache Software Foundation. All rights reserved.