Coverage Report - org.apache.giraph.graph.partition.WorkerGraphPartitioner
 
Classes in this File Line Coverage Branch Coverage Complexity
WorkerGraphPartitioner
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.graph.partition;
 20  
 
 21  
 import org.apache.giraph.graph.WorkerInfo;
 22  
 import org.apache.hadoop.io.Writable;
 23  
 import org.apache.hadoop.io.WritableComparable;
 24  
 
 25  
 import java.util.Collection;
 26  
 
 27  
 /**
 28  
  * Stores the {@link PartitionOwner} objects from the master and provides the
 29  
  * mapping of vertex to {@link PartitionOwner}. Also generates the partition
 30  
  * owner implementation.
 31  
  *
 32  
  * @param <I> Vertex id
 33  
  * @param <V> Vertex value
 34  
  * @param <E> Edge value
 35  
  * @param <M> Message data
 36  
  */
 37  
 @SuppressWarnings("rawtypes")
 38  
 public interface WorkerGraphPartitioner<I extends WritableComparable,
 39  
     V extends Writable, E extends Writable, M extends Writable> {
 40  
   /**
 41  
    * Instantiate the {@link PartitionOwner} implementation used to read the
 42  
    * master assignments.
 43  
    *
 44  
    * @return Instantiated {@link PartitionOwner} object
 45  
    */
 46  
   PartitionOwner createPartitionOwner();
 47  
 
 48  
   /**
 49  
    * Figure out the owner of a vertex
 50  
    *
 51  
    * @param vertexId Vertex id to get the partition for
 52  
    * @return Correct partition owner
 53  
    */
 54  
   PartitionOwner getPartitionOwner(I vertexId);
 55  
 
 56  
   /**
 57  
    * At the end of a superstep, workers have {@link PartitionStats} generated
 58  
    * for each of their partitions.  This method will allow the user to
 59  
    * modify or create their own {@link PartitionStats} interfaces to send to
 60  
    * the master.
 61  
    *
 62  
    * @param workerPartitionStats Stats generated by the infrastructure during
 63  
    *        the superstep
 64  
    * @param partitionStore Partition store for this worker
 65  
    *        (could be used to provide more useful stat information)
 66  
    * @return Final partition stats
 67  
    */
 68  
   Collection<PartitionStats> finalizePartitionStats(
 69  
       Collection<PartitionStats> workerPartitionStats,
 70  
       PartitionStore<I, V, E, M> partitionStore);
 71  
 
 72  
   /**
 73  
    * Get the partitions owners and update locally.  Returns the partitions
 74  
    * to send to other workers and other dependencies.
 75  
    *
 76  
    * @param myWorkerInfo Worker info.
 77  
    * @param masterSetPartitionOwners Master set partition owners, received
 78  
    *        prior to beginning the superstep
 79  
    * @param partitionStore Partition store for this worker
 80  
    *        (can be used to fill the return map of partitions to send)
 81  
    * @return Information for the partition exchange.
 82  
    */
 83  
   PartitionExchange updatePartitionOwners(
 84  
       WorkerInfo myWorkerInfo,
 85  
       Collection<? extends PartitionOwner> masterSetPartitionOwners,
 86  
       PartitionStore<I, V, E, M> partitionStore);
 87  
 
 88  
   /**
 89  
    * Get a collection of the {@link PartitionOwner} objects.
 90  
    *
 91  
    * @return Collection of owners for every partition.
 92  
    */
 93  
   Collection<? extends PartitionOwner> getPartitionOwners();
 94  
 }