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