I
- Vertex idV
- Vertex valueE
- Edge valueK
- Key corresponding to Vertex idEt
- Entry typepublic abstract class AbstractEdgeStore<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable,K,Et> extends DefaultImmutableClassesGiraphConfigurable<I,V,E> implements EdgeStore<I,V,E>
Modifier and Type | Field and Description |
---|---|
protected ImmutableClassesGiraphConfiguration<I,V,E> |
configuration
Giraph configuration.
|
static ThreadLocalProgressCounter |
PROGRESS_COUNTER
Used to keep track of progress during the move-edges process
|
protected org.apache.hadoop.util.Progressable |
progressable
Progressable to report progress.
|
protected boolean |
reuseEdgeObjects
Whether the chosen
OutEdges implementation allows for Edge
reuse. |
protected CentralizedServiceWorker<I,V,E> |
service
Service worker.
|
protected ConcurrentMap<Integer,Map<K,OutEdges<I,E>>> |
transientEdges
Map used to temporarily store incoming edges.
|
protected boolean |
useInputOutEdges
Whether the
OutEdges class used during input is different
from the one used during computation. |
Constructor and Description |
---|
AbstractEdgeStore(CentralizedServiceWorker<I,V,E> service,
ImmutableClassesGiraphConfiguration<I,V,E> configuration,
org.apache.hadoop.util.Progressable progressable)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPartitionEdges(int partitionId,
VertexIdEdges<I,E> edges)
Add edges belonging to a given partition on this worker.
|
protected abstract I |
createVertexId(Et entry)
Create vertexId from a given key
|
protected abstract OutEdges<I,E> |
getPartitionEdges(Et entry)
Return the OutEdges for a given partition
|
protected abstract Map<K,OutEdges<I,E>> |
getPartitionEdges(int partitionId)
Get OutEdges for a given partition
|
protected abstract Iterator<Et> |
getPartitionEdgesIterator(Map<K,OutEdges<I,E>> partitionEdges)
Get iterator for partition edges
|
protected abstract I |
getVertexId(Et entry,
I representativeVertexId)
Get vertexId for a given key
|
protected abstract OutEdges<I,E> |
getVertexOutEdges(VertexIdEdgeIterator<I,E> vertexIdEdgeIterator,
Map<K,OutEdges<I,E>> partitionEdgesIn)
Get out-edges for a given vertex
|
boolean |
hasEdgesForPartition(int partitionId)
Check if edge store has edge for a given partition
|
void |
moveEdgesToVertices()
Move all edges from temporary storage to their source vertices.
|
void |
readPartitionEdgeStore(int partitionId,
DataInput input)
Serialize the edges of a given partition, and adds it to the partition
store (assumes that the edge store does not have any edge from the
partition already).
|
protected abstract K |
readVertexKey(DataInput input)
Reads the given key from the input
|
void |
writePartitionEdgeStore(int partitionId,
DataOutput output)
Deserialize the edges of a given partition, and removes the associated data
from the store.
|
protected abstract void |
writeVertexKey(K key,
DataOutput output)
Writes the given key to the output
|
getConf, setConf
public static final ThreadLocalProgressCounter PROGRESS_COUNTER
protected CentralizedServiceWorker<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable> service
protected ImmutableClassesGiraphConfiguration<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable> configuration
protected org.apache.hadoop.util.Progressable progressable
protected ConcurrentMap<Integer,Map<K,OutEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>>> transientEdges
protected boolean reuseEdgeObjects
OutEdges
implementation allows for Edge
reuse.protected boolean useInputOutEdges
OutEdges
class used during input is different
from the one used during computation.public AbstractEdgeStore(CentralizedServiceWorker<I,V,E> service, ImmutableClassesGiraphConfiguration<I,V,E> configuration, org.apache.hadoop.util.Progressable progressable)
service
- Service workerconfiguration
- Configurationprogressable
- Progressableprotected abstract I getVertexId(Et entry, I representativeVertexId)
entry
- for vertexId keyrepresentativeVertexId
- representativeVertexIdprotected abstract I createVertexId(Et entry)
entry
- for vertexId keyprotected abstract Map<K,OutEdges<I,E>> getPartitionEdges(int partitionId)
partitionId
- id of partitionprotected abstract OutEdges<I,E> getPartitionEdges(Et entry)
entry
- for vertexId keyprotected abstract void writeVertexKey(K key, DataOutput output) throws IOException
key
- input key to be writtenoutput
- output to write the key toIOException
protected abstract K readVertexKey(DataInput input) throws IOException
input
- input to read the key fromIOException
protected abstract Iterator<Et> getPartitionEdgesIterator(Map<K,OutEdges<I,E>> partitionEdges)
partitionEdges
- map of out-edges for vertices in a partitionpublic boolean hasEdgesForPartition(int partitionId)
EdgeStore
hasEdgesForPartition
in interface EdgeStore<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
partitionId
- Id of partitionpublic void writePartitionEdgeStore(int partitionId, DataOutput output) throws IOException
EdgeStore
writePartitionEdgeStore
in interface EdgeStore<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
partitionId
- Id of partition to deserializeoutput
- Output to write the edge store toIOException
public void readPartitionEdgeStore(int partitionId, DataInput input) throws IOException
EdgeStore
readPartitionEdgeStore
in interface EdgeStore<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
partitionId
- Id of partition to serializeinput
- Input to read the partition fromIOException
protected abstract OutEdges<I,E> getVertexOutEdges(VertexIdEdgeIterator<I,E> vertexIdEdgeIterator, Map<K,OutEdges<I,E>> partitionEdgesIn)
vertexIdEdgeIterator
- vertex Id Edge iteratorpartitionEdgesIn
- map of out-edges for vertices in a partitionpublic void addPartitionEdges(int partitionId, VertexIdEdges<I,E> edges)
EdgeStore
addPartitionEdges
in interface EdgeStore<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
partitionId
- Partition id for the incoming edges.edges
- Incoming edgespublic void moveEdgesToVertices()
EdgeStore
moveEdgesToVertices
in interface EdgeStore<I extends org.apache.hadoop.io.WritableComparable,V extends org.apache.hadoop.io.Writable,E extends org.apache.hadoop.io.Writable>
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.