public class IntFloatMessageStore extends Object implements MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
Constructor and Description |
---|
IntFloatMessageStore(PartitionSplitInfo<org.apache.hadoop.io.IntWritable> partitionInfo,
MessageCombiner<? super org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable> messageCombiner)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addMessage(org.apache.hadoop.io.IntWritable vertexId,
org.apache.hadoop.io.FloatWritable message)
Adds a message for a particular vertex
The method is used by InternalMessageStore to send local messages; for
the general case, use a more efficient addPartitionMessages
|
void |
addPartitionMessages(int partitionId,
VertexIdMessages<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable> 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(org.apache.hadoop.io.IntWritable 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<org.apache.hadoop.io.IntWritable> |
getPartitionDestinationVertices(int partitionId)
Gets vertex ids from selected partition which we have messages for
|
Iterable<org.apache.hadoop.io.FloatWritable> |
getVertexMessages(org.apache.hadoop.io.IntWritable vertexId)
Gets messages for a vertex.
|
boolean |
hasMessagesForPartition(int partitionId)
Check if we have messages for some partition
|
boolean |
hasMessagesForVertex(org.apache.hadoop.io.IntWritable 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 IntFloatMessageStore(PartitionSplitInfo<org.apache.hadoop.io.IntWritable> partitionInfo, MessageCombiner<? super org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable> messageCombiner)
partitionInfo
- Partition split infomessageCombiner
- Message messageCombinerpublic boolean isPointerListEncoding()
MessageStore
isPointerListEncoding
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
public void addPartitionMessages(int partitionId, VertexIdMessages<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable> messages)
MessageStore
addPartitionMessages
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
partitionId
- Id of partitionmessages
- Collection of vertex ids and messages we want to addpublic void addMessage(org.apache.hadoop.io.IntWritable vertexId, org.apache.hadoop.io.FloatWritable message) throws IOException
MessageStore
addMessage
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
vertexId
- Id of target vertexmessage
- A message to sendIOException
public void finalizeStore()
MessageStore
finalizeStore
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
public void clearPartition(int partitionId)
MessageStore
clearPartition
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
partitionId
- Partition id for which we want to clear messagespublic boolean hasMessagesForVertex(org.apache.hadoop.io.IntWritable vertexId)
MessageStore
hasMessagesForVertex
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
vertexId
- Id of vertex which we want to checkpublic boolean hasMessagesForPartition(int partitionId)
MessageStore
hasMessagesForPartition
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
partitionId
- Id of partition which we want to checkpublic Iterable<org.apache.hadoop.io.FloatWritable> getVertexMessages(org.apache.hadoop.io.IntWritable vertexId)
MessageStore
getVertexMessages
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
vertexId
- Vertex id for which we want to get messagespublic void clearVertexMessages(org.apache.hadoop.io.IntWritable vertexId)
MessageStore
clearVertexMessages
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
vertexId
- Vertex id for which we want to clear messagespublic void clearAll()
MessageStore
clearAll
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
public Iterable<org.apache.hadoop.io.IntWritable> getPartitionDestinationVertices(int partitionId)
MessageStore
getPartitionDestinationVertices
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
partitionId
- Id of partitionpublic void writePartition(DataOutput out, int partitionId) throws IOException
MessageStore
writePartition
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
out
- DataOutput
to serialize this object intopartitionId
- Id of partitionIOException
public void readFieldsForPartition(DataInput in, int partitionId) throws IOException
MessageStore
readFieldsForPartition
in interface MessageStore<org.apache.hadoop.io.IntWritable,org.apache.hadoop.io.FloatWritable>
in
- DataInput
to deserialize this object
from.partitionId
- Id of partitionIOException
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.