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 package org.apache.giraph.comm.messages; 19 20 import org.apache.giraph.partition.Partition; 21 import org.apache.hadoop.io.WritableComparable; 22 23 /** 24 * Interface providing partition split information. 25 * 26 * @param <I> Vertex id type. 27 */ 28 public interface PartitionSplitInfo<I extends WritableComparable> { 29 /** 30 * Get the partition id that a vertex id would belong to. 31 * 32 * @param vertexId Vertex id 33 * @return Partition id 34 */ 35 int getPartitionId(I vertexId); 36 37 /** 38 * Get the ids of all the stored partitions (on current worker) as Iterable 39 * 40 * @return The partition ids 41 */ 42 Iterable<Integer> getPartitionIds(); 43 44 /** 45 * Return the number of vertices in a partition. 46 * 47 * @param partitionId Partition id 48 * @return The number of vertices in the specified partition 49 */ 50 long getPartitionVertexCount(Integer partitionId); 51 52 /** 53 * {@link org.apache.giraph.partition.PartitionStore#startIteration()} 54 */ 55 void startIteration(); 56 57 /** 58 * {@link org.apache.giraph.partition.PartitionStore#getNextPartition()} 59 * 60 * @return The next partition to process 61 */ 62 Partition getNextPartition(); 63 64 /** 65 * {@link org.apache.giraph.partition.PartitionStore#putPartition(Partition)} 66 * 67 * @param partition Partition 68 */ 69 void putPartition(Partition partition); 70 }