public abstract class BufferedCollectionPartition<T> extends CollectionPartition<T> implements java.io.Closeable
dataList
DEFAULT_REF
Constructor and Description |
---|
BufferedCollectionPartition(long maxFramesInMemory,
Config config)
Create a disk based partition with default buffer size(10MB) and without a
MessageType
If MessageType is not defined, it will assume as
ObjectType . |
BufferedCollectionPartition(long maxFramesInMemory,
Config config,
java.lang.String reference) |
BufferedCollectionPartition(long maxFramesInMemory,
MessageType dataType,
Config config)
Creates an instance with default bugger size 10MB
|
BufferedCollectionPartition(long maxFramesInMemory,
MessageType dataType,
long bufferedBytes,
Config config,
java.lang.String reference)
Creates an instance of
BufferedCollectionPartition |
BufferedCollectionPartition(MessageType dataType,
long bufferedBytes,
Config config)
Creates an 100% disk based instance.
|
BufferedCollectionPartition(MessageType dataType,
long bufferedBytes,
Config config,
java.lang.String reference)
Loads an disk based partition from file system.
|
Modifier and Type | Method and Description |
---|---|
void |
add(T val) |
void |
addAll(java.util.Collection<T> frames) |
void |
clear() |
void |
close() |
void |
dispose()
This method will clear the memory components of this partition by assigning buffer to null
and making it garbage collectible.
|
void |
flush() |
T |
get(int index) |
DataPartitionConsumer<T> |
getConsumer()
Get the data consumer
|
protected abstract FileSystem |
getFileSystem(Config config) |
java.lang.String |
getReference()
Reference can be used to load a persisted partition from disk of hdfs
|
protected abstract Path |
getRootPath(Config config) |
boolean |
hasIndexInMemory(int index) |
getPartitionId, setId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
first, firstOrDefault
public BufferedCollectionPartition(long maxFramesInMemory, MessageType dataType, long bufferedBytes, Config config, java.lang.String reference)
BufferedCollectionPartition
maxFramesInMemory
- No of frames(elements) to keep in memorydataType
- MessageType
of data framesbufferedBytes
- amount to buffer in memory before writing to the diskpublic BufferedCollectionPartition(long maxFramesInMemory, Config config)
MessageType
If MessageType
is not defined, it will assume as
ObjectType
. This will
make serialization and deserialization inefficient.maxFramesInMemory
- No of frames(elements) to keep in memorypublic BufferedCollectionPartition(long maxFramesInMemory, Config config, java.lang.String reference)
public BufferedCollectionPartition(long maxFramesInMemory, MessageType dataType, Config config)
maxFramesInMemory
- No of frames(elements) to keep in memorydataType
- MessageType
of data framespublic BufferedCollectionPartition(MessageType dataType, long bufferedBytes, Config config)
dataType
- MessageType
of data framesbufferedBytes
- amount to buffer in memory before writing to the diskpublic BufferedCollectionPartition(MessageType dataType, long bufferedBytes, Config config, java.lang.String reference)
dataType
- MessageType
of data framesbufferedBytes
- amount to buffer in memory before writing to the diskreference
- Partition referenceprotected abstract FileSystem getFileSystem(Config config) throws java.io.IOException
java.io.IOException
public void add(T val)
add
in class CollectionPartition<T>
public void addAll(java.util.Collection<T> frames)
addAll
in class CollectionPartition<T>
public DataPartitionConsumer<T> getConsumer()
DataPartition
getConsumer
in interface DataPartition<T>
getConsumer
in class CollectionPartition<T>
public void dispose()
public void clear()
clear
in interface DataPartition<T>
clear
in class CollectionPartition<T>
public void flush()
public boolean hasIndexInMemory(int index)
public T get(int index)
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public java.lang.String getReference()
DataPartition
getReference
in interface DataPartition<T>