I
- Vertex id typeM
- Message typepublic class IdOneMessagePerVertexStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable> extends Object implements MessageStore<I,M>
Constructor and Description |
---|
IdOneMessagePerVertexStore(MessageValueFactory<M> messageValueFactory,
PartitionSplitInfo<I> partitionInfo,
MessageCombiner<? super I,M> messageCombiner,
ImmutableClassesGiraphConfiguration<I,?,?> config)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addMessage(I vertexId,
M message)
Adds a message for a particular vertex
|
void |
addPartitionMessages(int partitionId,
VertexIdMessages<I,M> messages)
Adds messages for partition
|
void |
clearAll()
Clears all resources used by this store.
|
void |
clearPartition(int partitionId)
Clears messages for a partition.
|
void |
clearVertexMessages(I vertexId)
Clears messages for a vertex.
|
void |
finalizeStore()
Called before start of computation in bspworker
Since it is run from a single thread while the store is not being
accessed by any other thread - this is ensured to be thread-safe
|
Iterable<I> |
getPartitionDestinationVertices(int partitionId)
Gets vertex ids from selected partition which we have messages for
|
Iterable<M> |
getVertexMessages(I vertexId)
Gets messages for a vertex.
|
boolean |
hasMessagesForPartition(int partitionId)
Check if we have messages for some partition
|
boolean |
hasMessagesForVertex(I vertexId)
Check if we have messages for some vertex
|
boolean |
isPointerListEncoding()
True if this message-store encodes messages as a list of long pointers
to compact serialized messages
|
void |
readFieldsForPartition(DataInput in,
int partitionId)
Deserialize messages for one partition
|
void |
writePartition(DataOutput out,
int partitionId)
Serialize messages for one partition.
|
public IdOneMessagePerVertexStore(MessageValueFactory<M> messageValueFactory, PartitionSplitInfo<I> partitionInfo, MessageCombiner<? super I,M> messageCombiner, ImmutableClassesGiraphConfiguration<I,?,?> config)
messageValueFactory
- Message value factorypartitionInfo
- Partition split infomessageCombiner
- Message messageCombinerconfig
- Configpublic void addPartitionMessages(int partitionId, VertexIdMessages<I,M> messages)
MessageStore
addPartitionMessages
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
partitionId
- Id of partitionmessages
- Collection of vertex ids and messages we want to addpublic void addMessage(I vertexId, M message) throws IOException
addMessage
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
vertexId
- Id of target vertexmessage
- A message to sendIOException
public void clearPartition(int partitionId)
MessageStore
clearPartition
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
partitionId
- Partition id for which we want to clear messagespublic boolean hasMessagesForVertex(I vertexId)
MessageStore
hasMessagesForVertex
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
vertexId
- Id of vertex which we want to checkpublic boolean hasMessagesForPartition(int partitionId)
MessageStore
hasMessagesForPartition
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
partitionId
- Id of partition which we want to checkpublic Iterable<M> getVertexMessages(I vertexId)
MessageStore
getVertexMessages
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
vertexId
- Vertex id for which we want to get messagespublic void clearVertexMessages(I vertexId)
MessageStore
clearVertexMessages
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
vertexId
- Vertex id for which we want to clear messagespublic void clearAll()
MessageStore
clearAll
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
public Iterable<I> getPartitionDestinationVertices(int partitionId)
MessageStore
getPartitionDestinationVertices
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
partitionId
- Id of partitionpublic void writePartition(DataOutput out, int partitionId) throws IOException
MessageStore
writePartition
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
out
- DataOutput
to serialize this object intopartitionId
- Id of partitionIOException
public void readFieldsForPartition(DataInput in, int partitionId) throws IOException
MessageStore
readFieldsForPartition
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
in
- DataInput
to deserialize this object
from.partitionId
- Id of partitionIOException
public void finalizeStore()
MessageStore
finalizeStore
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
public boolean isPointerListEncoding()
MessageStore
isPointerListEncoding
in interface MessageStore<I extends org.apache.hadoop.io.WritableComparable,M extends org.apache.hadoop.io.Writable>
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.