Shard (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.contrib.index.mapred
Class Shard

    java.lang.Object
      org.apache.hadoop.contrib.index.mapred.Shard

All Implemented Interfaces:
  Comparable, Writable, WritableComparable

    public class Shard

extends Object
implements WritableComparable

This class represents the metadata of a shard. Version is the version number of the entire index. Directory is the directory where this shard resides in. Generation is the Lucene index's generation. Version and generation are reserved for future use. Note: Currently the version number of the entire index is not used and defaults to -1.

Constructor Summary
`Shard()` Constructor.
`Shard(long version, String dir, long gen)` Construct a shard from a versio number, a directory and a generation number.
`Shard(Shard shard)` Construct using a shard object.

Method Summary
`int` | `compareTo(Object o)`
`int` | `compareTo(Shard other)` Compare to another shard.
`boolean` | `equals(Object o)`
`String` | `getDirectory()` Get the directory where this shard resides.
`long` | `getGeneration()` Get the generation of the Lucene instance.
`static Shard[]` | `getIndexShards(IndexUpdateConfiguration conf)`
`long` | `getVersion()` Get the version number of the entire index.
`int` | `hashCode()`
`static String` | `normalizePath(String path)`
`void` | `readFields(DataInput in)` Deserialize the fields of this object from `in`.
`static void` | `setIndexShards(IndexUpdateConfiguration conf, Shard[] shards)`
`String` | `toString()`
`void` | `write(DataOutput out)` Serialize the fields of this object to `out`.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Shard

    public Shard()

  Constructor.

### Shard

    public Shard(long version,
                 String dir,
                 long gen)

  Construct a shard from a versio number, a directory and a generation number.

  Parameters:
    `version` - the version number of the entire index
    `dir` - the directory where this shard resides
    `gen` - the generation of the Lucene instance

### Shard

    public Shard(Shard shard)

  Construct using a shard object.

  Parameters:
    `shard` - the shard used by the constructor

Method Detail

### normalizePath

    public static String normalizePath(String path)

### setIndexShards

    public static void setIndexShards(IndexUpdateConfiguration conf,
                                      Shard[] shards)

### getIndexShards

    public static Shard[] getIndexShards(IndexUpdateConfiguration conf)

### getVersion

    public long getVersion()

  Get the version number of the entire index.

  Returns:
    the version number of the entire index

### getDirectory

    public String getDirectory()

  Get the directory where this shard resides.

  Returns:
    the directory where this shard resides

### getGeneration

    public long getGeneration()

  Get the generation of the Lucene instance.

  Returns:
    the generation of the Lucene instance

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### write

    public void write(DataOutput out)
               throws IOException

  Description copied from interface: `Writable`
  Serialize the fields of this object to `out`.

  Specified by:
    `write` in interface `Writable`
  Parameters:
    `out` - `DataOuput` to serialize this object into.
  Throws:
    `IOException`

### readFields

    public void readFields(DataInput in)
                    throws IOException

  Description copied from interface: `Writable`
  Deserialize the fields of this object from `in`.

  For efficiency, implementations should attempt to re-use storage in the existing object where possible.

  Specified by:
    `readFields` in interface `Writable`
  Parameters:
    `in` - `DataInput` to deseriablize this object from.
  Throws:
    `IOException`

### compareTo

    public int compareTo(Object o)

  Specified by:
    `compareTo` in interface `Comparable`

### compareTo

    public int compareTo(Shard other)

  Compare to another shard.

  Parameters:
    `other` - another shard
  Returns:
    compare version first, then directory and finally generation

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation