|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.HColumnDescriptor
public class HColumnDescriptor
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.
Field Summary | |
---|---|
static java.lang.String |
BLOCKCACHE
|
static java.lang.String |
BLOCKSIZE
Size of storefile/hfile 'blocks'. |
static java.lang.String |
BLOOMFILTER
|
static java.lang.String |
CACHE_BLOOMS_ON_WRITE
|
static java.lang.String |
CACHE_DATA_ON_WRITE
|
static java.lang.String |
CACHE_INDEX_ON_WRITE
|
static java.lang.String |
COMPRESSION
|
static java.lang.String |
COMPRESSION_COMPACT
|
static java.lang.String |
DATA_BLOCK_ENCODING
|
static boolean |
DEFAULT_BLOCKCACHE
Default setting for whether to use a block cache or not. |
static int |
DEFAULT_BLOCKSIZE
Default size of blocks in files stored to the filesytem (hfiles). |
static java.lang.String |
DEFAULT_BLOOMFILTER
Default setting for whether or not to use bloomfilters. |
static boolean |
DEFAULT_CACHE_BLOOMS_ON_WRITE
Default setting for whether to cache bloom filter blocks on write if block caching is enabled. |
static boolean |
DEFAULT_CACHE_DATA_ON_WRITE
Default setting for whether to cache data blocks on write if block caching is enabled. |
static boolean |
DEFAULT_CACHE_INDEX_ON_WRITE
Default setting for whether to cache index blocks on write if block caching is enabled. |
static java.lang.String |
DEFAULT_COMPRESSION
Default compression type. |
static java.lang.String |
DEFAULT_DATA_BLOCK_ENCODING
Default data block encoding algorithm. |
static boolean |
DEFAULT_ENCODE_ON_DISK
Default value of the flag that enables data block encoding on disk, as opposed to encoding in cache only. |
static boolean |
DEFAULT_EVICT_BLOCKS_ON_CLOSE
Default setting for whether to evict cached blocks from the blockcache on close. |
static boolean |
DEFAULT_IN_MEMORY
Default setting for whether to serve from memory or not. |
static boolean |
DEFAULT_KEEP_DELETED
Default setting for preventing deleted from being collected immediately. |
static int |
DEFAULT_MIN_VERSIONS
Default is not to keep a minimum of versions. |
static int |
DEFAULT_REPLICATION_SCOPE
Default scope. |
static int |
DEFAULT_TTL
Default time to live of cell contents. |
static int |
DEFAULT_VERSIONS
Default number of versions of a record to keep. |
static java.lang.String |
ENCODE_ON_DISK
|
static java.lang.String |
EVICT_BLOCKS_ON_CLOSE
|
static java.lang.String |
FOREVER
|
static java.lang.String |
KEEP_DELETED_CELLS
|
static java.lang.String |
LENGTH
|
static java.lang.String |
MIN_VERSIONS
|
static java.lang.String |
REPLICATION_SCOPE
|
static java.lang.String |
TTL
|
protected java.util.Map<ImmutableBytesWritable,ImmutableBytesWritable> |
values
|
Constructor Summary | |
---|---|
HColumnDescriptor()
Default constructor. |
|
HColumnDescriptor(byte[] familyName)
Construct a column descriptor specifying only the family name The other attributes are defaulted. |
|
HColumnDescriptor(byte[] familyName,
int minVersions,
int maxVersions,
boolean keepDeletedCells,
java.lang.String compression,
boolean encodeOnDisk,
java.lang.String dataBlockEncoding,
boolean inMemory,
boolean blockCacheEnabled,
int blocksize,
int timeToLive,
java.lang.String bloomFilter,
int scope)
Deprecated. use HColumnDescriptor(String) and setters |
|
HColumnDescriptor(byte[] familyName,
int maxVersions,
java.lang.String compression,
boolean inMemory,
boolean blockCacheEnabled,
int blocksize,
int timeToLive,
java.lang.String bloomFilter,
int scope)
Deprecated. use HColumnDescriptor(String) and setters |
|
HColumnDescriptor(byte[] familyName,
int maxVersions,
java.lang.String compression,
boolean inMemory,
boolean blockCacheEnabled,
int timeToLive,
java.lang.String bloomFilter)
Deprecated. use HColumnDescriptor(String) and setters |
|
HColumnDescriptor(HColumnDescriptor desc)
Constructor. |
|
HColumnDescriptor(java.lang.String familyName)
Construct a column descriptor specifying only the family name The other attributes are defaulted. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String COMPRESSION
public static final java.lang.String COMPRESSION_COMPACT
public static final java.lang.String ENCODE_ON_DISK
public static final java.lang.String DATA_BLOCK_ENCODING
public static final java.lang.String BLOCKCACHE
public static final java.lang.String CACHE_DATA_ON_WRITE
public static final java.lang.String CACHE_INDEX_ON_WRITE
public static final java.lang.String CACHE_BLOOMS_ON_WRITE
public static final java.lang.String EVICT_BLOCKS_ON_CLOSE
public static final java.lang.String BLOCKSIZE
DEFAULT_BLOCKSIZE
.
Use smaller block sizes for faster random-access at expense of larger
indices (more memory consumption).
public static final java.lang.String LENGTH
public static final java.lang.String TTL
public static final java.lang.String BLOOMFILTER
public static final java.lang.String FOREVER
public static final java.lang.String REPLICATION_SCOPE
public static final java.lang.String MIN_VERSIONS
public static final java.lang.String KEEP_DELETED_CELLS
public static final java.lang.String DEFAULT_COMPRESSION
public static final boolean DEFAULT_ENCODE_ON_DISK
DATA_BLOCK_ENCODING
is not NONE.
public static final java.lang.String DEFAULT_DATA_BLOCK_ENCODING
public static final int DEFAULT_VERSIONS
public static final int DEFAULT_MIN_VERSIONS
public static final boolean DEFAULT_IN_MEMORY
public static final boolean DEFAULT_KEEP_DELETED
public static final boolean DEFAULT_BLOCKCACHE
public static final boolean DEFAULT_CACHE_DATA_ON_WRITE
public static final boolean DEFAULT_CACHE_INDEX_ON_WRITE
public static final int DEFAULT_BLOCKSIZE
public static final java.lang.String DEFAULT_BLOOMFILTER
public static final boolean DEFAULT_CACHE_BLOOMS_ON_WRITE
public static final int DEFAULT_TTL
public static final int DEFAULT_REPLICATION_SCOPE
public static final boolean DEFAULT_EVICT_BLOCKS_ON_CLOSE
protected java.util.Map<ImmutableBytesWritable,ImmutableBytesWritable> values
Constructor Detail |
---|
public HColumnDescriptor()
public HColumnDescriptor(java.lang.String familyName)
familyName
- Column family name. Must be 'printable' -- digit or
letter -- and may not contain a :
public HColumnDescriptor(byte[] familyName)
familyName
- Column family name. Must be 'printable' -- digit or
letter -- and may not contain a :
public HColumnDescriptor(HColumnDescriptor desc)
desc
- The descriptor.@Deprecated public HColumnDescriptor(byte[] familyName, int maxVersions, java.lang.String compression, boolean inMemory, boolean blockCacheEnabled, int timeToLive, java.lang.String bloomFilter)
HColumnDescriptor(String)
and setters
familyName
- Column family name. Must be 'printable' -- digit or
letter -- and may not contain a :maxVersions
- Maximum number of versions to keepcompression
- Compression typeinMemory
- If true, column data should be kept in an HRegionServer's
cacheblockCacheEnabled
- If true, MapFile blocks should be cachedtimeToLive
- Time-to-live of cell contents, in seconds
(use HConstants.FOREVER for unlimited TTL)bloomFilter
- Bloom filter type for this column
- Throws:
java.lang.IllegalArgumentException
- if passed a family name that is made of
other than 'word' characters: i.e. [a-zA-Z_0-9]
or contains
a :
java.lang.IllegalArgumentException
- if the number of versions is <= 0
@Deprecated public HColumnDescriptor(byte[] familyName, int maxVersions, java.lang.String compression, boolean inMemory, boolean blockCacheEnabled, int blocksize, int timeToLive, java.lang.String bloomFilter, int scope)
HColumnDescriptor(String)
and setters
familyName
- Column family name. Must be 'printable' -- digit or
letter -- and may not contain a :maxVersions
- Maximum number of versions to keepcompression
- Compression typeinMemory
- If true, column data should be kept in an HRegionServer's
cacheblockCacheEnabled
- If true, MapFile blocks should be cachedblocksize
- Block size to use when writing out storefiles. Use
smaller block sizes for faster random-access at expense of larger indices
(more memory consumption). Default is usually 64k.timeToLive
- Time-to-live of cell contents, in seconds
(use HConstants.FOREVER for unlimited TTL)bloomFilter
- Bloom filter type for this columnscope
- The scope tag for this column
- Throws:
java.lang.IllegalArgumentException
- if passed a family name that is made of
other than 'word' characters: i.e. [a-zA-Z_0-9]
or contains
a :
java.lang.IllegalArgumentException
- if the number of versions is <= 0
@Deprecated public HColumnDescriptor(byte[] familyName, int minVersions, int maxVersions, boolean keepDeletedCells, java.lang.String compression, boolean encodeOnDisk, java.lang.String dataBlockEncoding, boolean inMemory, boolean blockCacheEnabled, int blocksize, int timeToLive, java.lang.String bloomFilter, int scope)
HColumnDescriptor(String)
and setters
familyName
- Column family name. Must be 'printable' -- digit or
letter -- and may not contain a :minVersions
- Minimum number of versions to keepmaxVersions
- Maximum number of versions to keepkeepDeletedCells
- Whether to retain deleted cells until they expire
up to maxVersions versions.compression
- Compression typeencodeOnDisk
- whether to use the specified data block encoding
on disk. If false, the encoding will be used in cache only.dataBlockEncoding
- data block encodinginMemory
- If true, column data should be kept in an HRegionServer's
cacheblockCacheEnabled
- If true, MapFile blocks should be cachedblocksize
- Block size to use when writing out storefiles. Use
smaller blocksizes for faster random-access at expense of larger indices
(more memory consumption). Default is usually 64k.timeToLive
- Time-to-live of cell contents, in seconds
(use HConstants.FOREVER for unlimited TTL)bloomFilter
- Bloom filter type for this columnscope
- The scope tag for this column
- Throws:
java.lang.IllegalArgumentException
- if passed a family name that is made of
other than 'word' characters: i.e. [a-zA-Z_0-9]
or contains
a :
java.lang.IllegalArgumentException
- if the number of versions is <= 0
Method Detail |
---|
public static byte[] isLegalFamilyName(byte[] b)
b
- Family name.
b
java.lang.IllegalArgumentException
- If not null and not a legitimate family
name: i.e. 'printable' and ends in a ':' (Null passes are allowed because
b
can be null when deserializing). Cannot start with a '.'
either.public byte[] getName()
public java.lang.String getNameAsString()
public byte[] getValue(byte[] key)
key
- The key.
public java.lang.String getValue(java.lang.String key)
key
- The key.
public java.util.Map<ImmutableBytesWritable,ImmutableBytesWritable> getValues()
public HColumnDescriptor setValue(byte[] key, byte[] value)
key
- The key.value
- The value.
public void remove(byte[] key)
key
- Key whose key and value we're to remove from HCD parameters.public HColumnDescriptor setValue(java.lang.String key, java.lang.String value)
key
- The key.value
- The value.
public Compression.Algorithm getCompression()
public Compression.Algorithm getCompactionCompression()
public int getMaxVersions()
public HColumnDescriptor setMaxVersions(int maxVersions)
maxVersions
- maximum number of versions
public int getBlocksize()
public HColumnDescriptor setBlocksize(int s)
s
- Blocksize to use when writing out storefiles/hfiles on this
column family.
public Compression.Algorithm getCompressionType()
public HColumnDescriptor setCompressionType(Compression.Algorithm type)
type
- Compression type setting.
public DataBlockEncoding getDataBlockEncodingOnDisk()
public HColumnDescriptor setEncodeOnDisk(boolean encodeOnDisk)
public DataBlockEncoding getDataBlockEncoding()
public HColumnDescriptor setDataBlockEncoding(DataBlockEncoding type)
type
- What kind of data block encoding will be used.
public Compression.Algorithm getCompactionCompressionType()
public HColumnDescriptor setCompactionCompressionType(Compression.Algorithm type)
type
- Compression type setting.
public boolean isInMemory()
public HColumnDescriptor setInMemory(boolean inMemory)
inMemory
- True if we are to keep all values in the HRegionServer
cache
public boolean getKeepDeletedCells()
public HColumnDescriptor setKeepDeletedCells(boolean keepDeletedCells)
keepDeletedCells
- True if deleted rows should not be collected
immediately.
public int getTimeToLive()
public HColumnDescriptor setTimeToLive(int timeToLive)
timeToLive
- Time-to-live of cell contents, in seconds.
public int getMinVersions()
public HColumnDescriptor setMinVersions(int minVersions)
minVersions
- The minimum number of versions to keep.
(used when timeToLive is set)
public boolean isBlockCacheEnabled()
public HColumnDescriptor setBlockCacheEnabled(boolean blockCacheEnabled)
blockCacheEnabled
- True if MapFile blocks should be cached.
public StoreFile.BloomType getBloomFilterType()
public HColumnDescriptor setBloomFilterType(StoreFile.BloomType bt)
bt
- bloom filter type
public int getScope()
public HColumnDescriptor setScope(int scope)
scope
- the scope tag
public boolean shouldCacheDataOnWrite()
public HColumnDescriptor setCacheDataOnWrite(boolean value)
value
- true if we should cache data blocks on write
public boolean shouldCacheIndexesOnWrite()
public HColumnDescriptor setCacheIndexesOnWrite(boolean value)
value
- true if we should cache index blocks on write
public boolean shouldCacheBloomsOnWrite()
public HColumnDescriptor setCacheBloomsOnWrite(boolean value)
value
- true if we should cache bloomfilter blocks on write
public boolean shouldEvictBlocksOnClose()
public HColumnDescriptor setEvictBlocksOnClose(boolean value)
value
- true if we should evict cached blocks from the blockcache on
close
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public java.lang.String toStringCustomizedValues()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public void readFields(java.io.DataInput in) throws java.io.IOException
readFields
in interface org.apache.hadoop.io.Writable
java.io.IOException
public void write(java.io.DataOutput out) throws java.io.IOException
write
in interface org.apache.hadoop.io.Writable
java.io.IOException
public int compareTo(HColumnDescriptor o)
compareTo
in interface java.lang.Comparable<HColumnDescriptor>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |