T
- raw data format of the data store subclassing this classpublic abstract class DiskBackedDataStore<T> extends Object
Modifier and Type | Field and Description |
---|---|
protected Set<Integer> |
hasPartitionDataOnFile
Set containing ids of all partitions where the partition data is in some
file on disk.
|
static IntConfOption |
MINIMUM_BUFFER_SIZE_TO_FLUSH
Minimum size of a buffer (in bytes) to flush to disk.
|
protected OutOfCoreEngine |
oocEngine
Out-of-core engine
|
Modifier and Type | Method and Description |
---|---|
protected void |
addEntry(int partitionId,
T entry)
Adds a data entry for a given partition to the current data store.
|
protected abstract void |
addEntryToInMemoryPartitionData(int partitionId,
T entry)
Adds a single entry for a given partition to the in-memory data store.
|
protected abstract int |
entrySerializedSize(T entry)
Gets the size of a given entry in bytes.
|
Set<Integer> |
getCandidateBuffersToOffload(int ioThreadId)
Looks through all partitions that their data is not in the data store (is
offloaded to disk), and sees if any of them has enough raw data buffer in
memory.
|
protected abstract long |
loadInMemoryPartitionData(int partitionId,
int ioThreadId,
DataIndex index)
Loads data of a partition into data store.
|
abstract long |
loadPartitionData(int partitionId)
Loads and assembles all data for a given partition, and put it into the
data store.
|
protected long |
loadPartitionDataProxy(int partitionId,
DataIndex index)
The proxy method that does the actual operation for `loadPartitionData`,
but uses the data index given by the caller.
|
abstract long |
offloadBuffers(int partitionId)
Offloads raw data buffers of a given partition to disk, and returns the
number of bytes offloaded from memory to disk.
|
protected long |
offloadBuffersProxy(int partitionId,
DataIndex index)
The proxy method that does the actual operation for `offloadBuffers`,
but uses the data index given by the caller.
|
protected abstract long |
offloadInMemoryPartitionData(int partitionId,
int ioThreadId,
DataIndex index)
Offloads data of a partition in data store to disk.
|
abstract long |
offloadPartitionData(int partitionId)
Offloads partition data of a given partition in the data store to disk, and
returns the number of bytes offloaded from memory to disk.
|
protected long |
offloadPartitionDataProxy(int partitionId,
DataIndex index)
The proxy method that does the actual operation for `offloadPartitionData`,
but uses the data index given by the caller.
|
protected abstract T |
readNextEntry(DataInput in)
Reads the next available raw entry from a given input stream.
|
protected abstract void |
writeEntry(T entry,
DataOutput out)
Writes a single raw entry to a given output stream.
|
public static final IntConfOption MINIMUM_BUFFER_SIZE_TO_FLUSH
protected final OutOfCoreEngine oocEngine
protected final Set<Integer> hasPartitionDataOnFile
protected void addEntry(int partitionId, T entry)
partitionId
- id of the partition to add the data entry toentry
- data entry to addpublic abstract long loadPartitionData(int partitionId) throws IOException
partitionId
- id of the partition to load and assemble all data forIOException
protected long loadPartitionDataProxy(int partitionId, DataIndex index) throws IOException
partitionId
- id of the partition to load and assemble all data forindex
- data index chain for the data to loadIOException
public abstract long offloadPartitionData(int partitionId) throws IOException
partitionId
- id of the partition to offload its dataIOException
protected long offloadPartitionDataProxy(int partitionId, DataIndex index) throws IOException
partitionId
- id of the partition to offload its dataindex
- data index chain for the data to offloadIOException
public abstract long offloadBuffers(int partitionId) throws IOException
partitionId
- id of the partition to offload its raw data buffersIOException
protected long offloadBuffersProxy(int partitionId, DataIndex index) throws IOException
partitionId
- id of the partition to offload its raw data buffersindex
- data index chain for the data to offload its buffersIOException
public Set<Integer> getCandidateBuffersToOffload(int ioThreadId)
ioThreadId
- Id of the IO thread who would offload the buffersprotected abstract void writeEntry(T entry, DataOutput out) throws IOException
entry
- entry to write to outputout
- output stream to write the entry toIOException
protected abstract T readNextEntry(DataInput in) throws IOException
in
- input stream to read the entry fromIOException
protected abstract long loadInMemoryPartitionData(int partitionId, int ioThreadId, DataIndex index) throws IOException
partitionId
- id of the partition to load its dataioThreadId
- id of the IO thread performing the loadindex
- data index chain for the data to loadIOException
protected abstract long offloadInMemoryPartitionData(int partitionId, int ioThreadId, DataIndex index) throws IOException
partitionId
- id of the partition to offload to diskioThreadId
- id of the IO thread performing the offloadindex
- data index chain for the data to offloadIOException
protected abstract int entrySerializedSize(T entry)
entry
- input entry to find its sizeprotected abstract void addEntryToInMemoryPartitionData(int partitionId, T entry)
partitionId
- id of the partition to add the data toentry
- input entry to add to the data storeCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.