org.apache.hadoop.hbase
Class HColumnDescriptor

java.lang.Object
  extended by org.apache.hadoop.hbase.HColumnDescriptor
All Implemented Interfaces:
Comparable, Writable, WritableComparable

public class HColumnDescriptor
extends Object
implements WritableComparable

An HColumnDescriptor contains information about a column family such as the number of versions, compression settings, etc. It is used as input when creating a table or adding a column. Once set, the parameters that specify a column cannot be changed without deleting the column and recreating it. If there is data stored in the column, it will be deleted when the column is deleted.


Nested Class Summary
static class HColumnDescriptor.CompressionType
          The type of compression.
 
Field Summary
static BloomFilterDescriptor DEFAULT_BLOOM_FILTER_DESCRIPTOR
          Default bloom filter description.
static HColumnDescriptor.CompressionType DEFAULT_COMPRESSION_TYPE
          Default compression type.
static boolean DEFAULT_IN_MEMORY
          Default setting for whether to serve from memory or not.
static int DEFAULT_MAX_VALUE_LENGTH
          Default maximum length of cell contents.
static int DEFAULT_N_VERSIONS
          Default number of versions of a record to keep.
static Pattern LEGAL_FAMILY_NAME
          Legal family names can only contain 'word characters' and end in a colon.
 
Constructor Summary
HColumnDescriptor()
          Default constructor.
HColumnDescriptor(String columnName)
          Construct a column descriptor specifying only the family name The other attributes are defaulted.
HColumnDescriptor(Text name, int maxVersions, HColumnDescriptor.CompressionType compression, boolean inMemory, int maxValueLength, BloomFilterDescriptor bloomFilter)
          Constructor Specify all parameters.
 
Method Summary
 int compareTo(Object o)
          
 boolean equals(Object obj)
          
 BloomFilterDescriptor getBloomFilter()
           
 HColumnDescriptor.CompressionType getCompression()
           
 HColumnDescriptor.CompressionType getCompressionType()
           
 Text getFamilyName()
           
 int getMaxValueLength()
           
 int getMaxVersions()
           
 Text getName()
           
 int hashCode()
          
 boolean isInMemory()
           
 void readFields(DataInput in)
          Deserialize the fields of this object from in.
 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
 

Field Detail

LEGAL_FAMILY_NAME

public static final Pattern LEGAL_FAMILY_NAME
Legal family names can only contain 'word characters' and end in a colon.


DEFAULT_COMPRESSION_TYPE

public static final HColumnDescriptor.CompressionType DEFAULT_COMPRESSION_TYPE
Default compression type.


DEFAULT_N_VERSIONS

public static final int DEFAULT_N_VERSIONS
Default number of versions of a record to keep.

See Also:
Constant Field Values

DEFAULT_IN_MEMORY

public static final boolean DEFAULT_IN_MEMORY
Default setting for whether to serve from memory or not.

See Also:
Constant Field Values

DEFAULT_MAX_VALUE_LENGTH

public static final int DEFAULT_MAX_VALUE_LENGTH
Default maximum length of cell contents.

See Also:
Constant Field Values

DEFAULT_BLOOM_FILTER_DESCRIPTOR

public static final BloomFilterDescriptor DEFAULT_BLOOM_FILTER_DESCRIPTOR
Default bloom filter description.

Constructor Detail

HColumnDescriptor

public HColumnDescriptor()
Default constructor. Must be present for Writable.


HColumnDescriptor

public HColumnDescriptor(String columnName)
Construct a column descriptor specifying only the family name The other attributes are defaulted.

Parameters:
columnName - - column family name

HColumnDescriptor

public HColumnDescriptor(Text name,
                         int maxVersions,
                         HColumnDescriptor.CompressionType compression,
                         boolean inMemory,
                         int maxValueLength,
                         BloomFilterDescriptor bloomFilter)
Constructor Specify all parameters.

Parameters:
name - Column family name
maxVersions - Maximum number of versions to keep
compression - Compression type
inMemory - If true, column data should be kept in an HRegionServer's cache
maxValueLength - Restrict values to <= this value
bloomFilter - Enable the specified bloom filter for this column
Throws:
IllegalArgumentException - if passed a family name that is made of other than 'word' characters: i.e. [a-zA-Z_0-9] and does not end in a :
IllegalArgumentException - if the number of versions is <= 0
Method Detail

getName

public Text getName()
Returns:
name of column family

getFamilyName

public Text getFamilyName()
Returns:
name of column family without trailing ':'

getCompression

public HColumnDescriptor.CompressionType getCompression()
Returns:
compression type being used for the column family

getMaxVersions

public int getMaxVersions()
Returns:
maximum number of versions

getCompressionType

public HColumnDescriptor.CompressionType getCompressionType()
Returns:
Compression type setting.

isInMemory

public boolean isInMemory()
Returns:
True if we are to keep all in use HRegionServer cache.

getMaxValueLength

public int getMaxValueLength()
Returns:
Maximum value length.

getBloomFilter

public BloomFilterDescriptor getBloomFilter()
Returns:
Bloom filter descriptor or null if none set.

toString

public String toString()

Overrides:
toString in class Object

equals

public boolean equals(Object obj)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

readFields

public void readFields(DataInput in)
                throws IOException
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

write

public void write(DataOutput out)
           throws IOException
Serialize the fields of this object to out.

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

compareTo

public int compareTo(Object o)

Specified by:
compareTo in interface Comparable


Copyright © 2006 The Apache Software Foundation