Coverage Report - org.apache.giraph.graph.partition.RangeSplitHint
 
Classes in this File Line Coverage Branch Coverage Complexity
RangeSplitHint
0%
0/13
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 java.io.DataInput;
 22  
 import java.io.DataOutput;
 23  
 import java.io.IOException;
 24  
 
 25  
 import org.apache.giraph.graph.BspUtils;
 26  
 import org.apache.hadoop.conf.Configurable;
 27  
 import org.apache.hadoop.conf.Configuration;
 28  
 import org.apache.hadoop.io.Writable;
 29  
 import org.apache.hadoop.io.WritableComparable;
 30  
 
 31  
 /**
 32  
  * Hint to the {@link RangeMasterPartitioner} about how a
 33  
  * {@link RangePartitionOwner} can be split.
 34  
  *
 35  
  * @param <I> Vertex index to split around
 36  
  */
 37  
 @SuppressWarnings("rawtypes")
 38  0
 public class RangeSplitHint<I extends WritableComparable>
 39  
     implements Writable, Configurable {
 40  
   /** Hinted split index */
 41  
   private I splitIndex;
 42  
   /** Number of vertices in this range before the split */
 43  
   private long preSplitVertexCount;
 44  
   /** Number of vertices in this range after the split */
 45  
   private long postSplitVertexCount;
 46  
   /** Configuration */
 47  
   private Configuration conf;
 48  
 
 49  
   @Override
 50  
   public void readFields(DataInput input) throws IOException {
 51  0
     splitIndex = BspUtils.<I>createVertexId(conf);
 52  0
     splitIndex.readFields(input);
 53  0
     preSplitVertexCount = input.readLong();
 54  0
     postSplitVertexCount = input.readLong();
 55  0
   }
 56  
 
 57  
   @Override
 58  
   public void write(DataOutput output) throws IOException {
 59  0
     splitIndex.write(output);
 60  0
     output.writeLong(preSplitVertexCount);
 61  0
     output.writeLong(postSplitVertexCount);
 62  0
   }
 63  
 
 64  
   @Override
 65  
   public Configuration getConf() {
 66  0
     return conf;
 67  
   }
 68  
 
 69  
   @Override
 70  
   public void setConf(Configuration conf) {
 71  0
     this.conf = conf;
 72  0
   }
 73  
 }