I
- Vertex idV
- Vertex dataE
- Edge datapublic interface PartitionStore<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
Modifier and Type | Method and Description |
---|---|
boolean |
addPartition(Partition<I,V,E> partition)
Add a *new* partition to the store.
|
void |
addPartitionVertices(Integer partitionId,
ExtendedDataOutput extendedDataOutput)
Add vertices to a given partition from a given DataOutput instance.
|
Partition<I,V,E> |
getNextPartition()
Return the next partition in iteration for the current superstep.
|
int |
getNumPartitions()
Return the number of stored partitions.
|
long |
getPartitionEdgeCount(Integer partitionId)
Return the number of edges in a partition.
|
Iterable<Integer> |
getPartitionIds()
Return the ids of all the stored partitions as an Iterable.
|
long |
getPartitionVertexCount(Integer partitionId)
Return the number of vertices in a partition.
|
boolean |
hasPartition(Integer partitionId)
Whether a specific partition is present in the store.
|
void |
initialize()
Called at the beginning of the computation.
|
boolean |
isEmpty()
Whether the partition store is empty.
|
void |
putPartition(Partition<I,V,E> partition)
Put a partition back to the store.
|
Partition<I,V,E> |
removePartition(Integer partitionId)
Remove a partition and return it.
|
void |
shutdown()
Called at the end of the computation.
|
void |
startIteration()
Start the iteration cycle to iterate over partitions.
|
boolean addPartition(Partition<I,V,E> partition)
partition
- Partition to addPartition<I,V,E> removePartition(Integer partitionId)
partitionId
- Partition idboolean hasPartition(Integer partitionId)
partitionId
- Partition idIterable<Integer> getPartitionIds()
int getNumPartitions()
long getPartitionVertexCount(Integer partitionId)
partitionId
- Partition idlong getPartitionEdgeCount(Integer partitionId)
partitionId
- Partition idboolean isEmpty()
void addPartitionVertices(Integer partitionId, ExtendedDataOutput extendedDataOutput)
partitionId
- Partition idextendedDataOutput
- Output containing serialized vertex datavoid shutdown()
void initialize()
void startIteration()
getNextPartition()
to iterate over the partitions.
Each time getNextPartition()
is called an unprocessed partition in
the current iteration is returned. After processing of the partition is
done, partition should be put back in the store using
putPartition(Partition)
. Here is an example of the entire
workflow:
In the main thread:
partitionStore.startIteration();
In multiple threads iterating over the partitions:
Partition partition = partitionStore.getNextPartition();
... do stuff with partition ...
partitionStore.putPartition(partition);
Called from a single thread.Partition<I,V,E> getNextPartition()
putPartition(Partition)
after use. Look at comments on
startIteration()
for more detail.void putPartition(Partition<I,V,E> partition)
getNextPartition()
.
Look at comments on startIteration()
for more detail.partition
- PartitionCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.