Coverage Report - org.apache.giraph.comm.WorkerClient
 
Classes in this File Line Coverage Branch Coverage Complexity
WorkerClient
N/A
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 
 19  
 package org.apache.giraph.comm;
 20  
 
 21  
 import org.apache.giraph.graph.Vertex;
 22  
 import org.apache.giraph.graph.Edge;
 23  
 import org.apache.giraph.graph.WorkerInfo;
 24  
 import org.apache.giraph.graph.partition.Partition;
 25  
 
 26  
 import org.apache.hadoop.io.Writable;
 27  
 import org.apache.hadoop.io.WritableComparable;
 28  
 
 29  
 import java.io.IOException;
 30  
 
 31  
 /**
 32  
  * Public interface for workers to do message communication
 33  
  *
 34  
  * @param <I> Vertex id
 35  
  * @param <V> Vertex value
 36  
  * @param <E> Edge value
 37  
  * @param <M> Message data
 38  
  */
 39  
 @SuppressWarnings("rawtypes")
 40  
 public interface WorkerClient<I extends WritableComparable,
 41  
     V extends Writable, E extends Writable, M extends Writable> {
 42  
   /**
 43  
    *  Setup the client.
 44  
    */
 45  
   void setup();
 46  
 
 47  
   /**
 48  
    * Fix changes to the workers and the mapping between partitions and
 49  
    * workers.
 50  
    */
 51  
   void fixPartitionIdToSocketAddrMap();
 52  
 
 53  
   /**
 54  
    * Sends a message to destination vertex.
 55  
    *
 56  
    * @param destVertexId Destination vertex id.
 57  
    * @param message Message to send.
 58  
    */
 59  
   void sendMessageRequest(I destVertexId, M message);
 60  
 
 61  
   /**
 62  
    * Sends a partition to the appropriate partition owner
 63  
    *
 64  
    * @param workerInfo Owner the vertices belong to
 65  
    * @param partition Partition to send
 66  
    */
 67  
   void sendPartitionRequest(WorkerInfo workerInfo,
 68  
                             Partition<I, V, E, M> partition);
 69  
 
 70  
   /**
 71  
    * Sends a request to the appropriate vertex range owner to add an edge
 72  
    *
 73  
    * @param vertexIndex Index of the vertex to get the request
 74  
    * @param edge Edge to be added
 75  
    * @throws IOException
 76  
    */
 77  
   void addEdgeRequest(I vertexIndex, Edge<I, E> edge) throws IOException;
 78  
 
 79  
   /**
 80  
    * Sends a request to the appropriate vertex range owner to remove an edge
 81  
    *
 82  
    * @param vertexIndex Index of the vertex to get the request
 83  
    * @param destinationVertexIndex Index of the edge to be removed
 84  
    * @throws IOException
 85  
    */
 86  
   void removeEdgeRequest(I vertexIndex, I destinationVertexIndex)
 87  
     throws IOException;
 88  
 
 89  
   /**
 90  
    * Sends a request to the appropriate vertex range owner to add a vertex
 91  
    *
 92  
    * @param vertex Vertex to be added
 93  
    * @throws IOException
 94  
    */
 95  
   void addVertexRequest(Vertex<I, V, E, M> vertex) throws IOException;
 96  
 
 97  
   /**
 98  
    * Sends a request to the appropriate vertex range owner to remove a vertex
 99  
    *
 100  
    * @param vertexIndex Index of the vertex to be removed
 101  
    * @throws IOException
 102  
    */
 103  
   void removeVertexRequest(I vertexIndex) throws IOException;
 104  
 
 105  
   /**
 106  
    * Flush all outgoing messages.  This will synchronously ensure that all
 107  
    * messages have been send and delivered prior to returning.
 108  
    *
 109  
    * @throws IOException
 110  
    */
 111  
   void flush() throws IOException;
 112  
 
 113  
   /**
 114  
    * Get the messages sent during this superstep and clear them.
 115  
    *
 116  
    * @return Number of messages sent before the reset.
 117  
    */
 118  
   long resetMessageCount();
 119  
 
 120  
   /**
 121  
    * Closes all connections.
 122  
    *
 123  
    * @throws IOException
 124  
    */
 125  
   void closeConnections() throws IOException;
 126  
 }