KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > nutch > mapReduce > Partitioner


1 /* Copyright (c) 2005 The Nutch Organization. All rights reserved. */
2 /* Use subject to the conditions in http://www.nutch.org/LICENSE.txt. */
3
4 package net.nutch.mapReduce;
5
6 import net.nutch.io.Writable;
7 import net.nutch.io.WritableComparable;
8
9 /** Partitions the key space. A partition is created for each reduce task. */
10 public interface Partitioner {
11   /** Returns the paritition number for a given key given the total number of
12    * partitions. Typically a hash function on a all or a subset of the key.
13    *
14    * @param key the key
15    * @param numPartitions the number of partitions
16    * @return the partition number
17    */

18   int getPartition(WritableComparable key, int numPartitions);
19 }
20
Popular Tags