HBASE-23798 Remove hbase-prototcol module (#1360)
[hbase.git] / hbase-client / src / main / java / org / apache / hadoop / hbase / HColumnDescriptor.java
blob58b5d0148a3e198179234cd08e6ca3a27156c12d
1 /**
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 package org.apache.hadoop.hbase;
21 import java.util.Map;
23 import org.apache.yetus.audience.InterfaceAudience;
24 import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
25 import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
26 import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder.ModifyableColumnFamilyDescriptor;
27 import org.apache.hadoop.hbase.client.MobCompactPartitionPolicy;
28 import org.apache.hadoop.hbase.exceptions.DeserializationException;
29 import org.apache.hadoop.hbase.exceptions.HBaseException;
30 import org.apache.hadoop.hbase.io.compress.Compression;
31 import org.apache.hadoop.hbase.io.encoding.DataBlockEncoding;
32 import org.apache.hadoop.hbase.regionserver.BloomType;
33 import org.apache.hadoop.hbase.util.Bytes;
34 import org.apache.hadoop.hbase.util.PrettyPrinter.Unit;
36 /**
37 * An HColumnDescriptor contains information about a column family such as the
38 * number of versions, compression settings, etc.
40 * It is used as input when creating a table or adding a column.
42 @InterfaceAudience.Public
43 @Deprecated // remove it in 3.0
44 public class HColumnDescriptor implements ColumnFamilyDescriptor, Comparable<HColumnDescriptor> {
45 public static final String IN_MEMORY_COMPACTION = ColumnFamilyDescriptorBuilder.IN_MEMORY_COMPACTION;
46 public static final String COMPRESSION = ColumnFamilyDescriptorBuilder.COMPRESSION;
47 public static final String COMPRESSION_COMPACT = ColumnFamilyDescriptorBuilder.COMPRESSION_COMPACT;
48 public static final String ENCODE_ON_DISK = "ENCODE_ON_DISK";
49 public static final String DATA_BLOCK_ENCODING = ColumnFamilyDescriptorBuilder.DATA_BLOCK_ENCODING;
50 public static final String BLOCKCACHE = ColumnFamilyDescriptorBuilder.BLOCKCACHE;
51 public static final String CACHE_DATA_ON_WRITE = ColumnFamilyDescriptorBuilder.CACHE_DATA_ON_WRITE;
52 public static final String CACHE_INDEX_ON_WRITE = ColumnFamilyDescriptorBuilder.CACHE_INDEX_ON_WRITE;
53 public static final String CACHE_BLOOMS_ON_WRITE = ColumnFamilyDescriptorBuilder.CACHE_BLOOMS_ON_WRITE;
54 public static final String EVICT_BLOCKS_ON_CLOSE = ColumnFamilyDescriptorBuilder.EVICT_BLOCKS_ON_CLOSE;
55 public static final String CACHE_DATA_IN_L1 = "CACHE_DATA_IN_L1";
56 public static final String PREFETCH_BLOCKS_ON_OPEN = ColumnFamilyDescriptorBuilder.PREFETCH_BLOCKS_ON_OPEN;
57 public static final String BLOCKSIZE = ColumnFamilyDescriptorBuilder.BLOCKSIZE;
58 public static final String LENGTH = "LENGTH";
59 public static final String TTL = ColumnFamilyDescriptorBuilder.TTL;
60 public static final String BLOOMFILTER = ColumnFamilyDescriptorBuilder.BLOOMFILTER;
61 public static final String FOREVER = "FOREVER";
62 public static final String REPLICATION_SCOPE = ColumnFamilyDescriptorBuilder.REPLICATION_SCOPE;
63 public static final byte[] REPLICATION_SCOPE_BYTES = Bytes.toBytes(REPLICATION_SCOPE);
64 public static final String MIN_VERSIONS = ColumnFamilyDescriptorBuilder.MIN_VERSIONS;
65 public static final String KEEP_DELETED_CELLS = ColumnFamilyDescriptorBuilder.KEEP_DELETED_CELLS;
66 public static final String COMPRESS_TAGS = ColumnFamilyDescriptorBuilder.COMPRESS_TAGS;
67 public static final String ENCRYPTION = ColumnFamilyDescriptorBuilder.ENCRYPTION;
68 public static final String ENCRYPTION_KEY = ColumnFamilyDescriptorBuilder.ENCRYPTION_KEY;
69 public static final String IS_MOB = ColumnFamilyDescriptorBuilder.IS_MOB;
70 public static final byte[] IS_MOB_BYTES = Bytes.toBytes(IS_MOB);
71 public static final String MOB_THRESHOLD = ColumnFamilyDescriptorBuilder.MOB_THRESHOLD;
72 public static final byte[] MOB_THRESHOLD_BYTES = Bytes.toBytes(MOB_THRESHOLD);
73 public static final long DEFAULT_MOB_THRESHOLD = ColumnFamilyDescriptorBuilder.DEFAULT_MOB_THRESHOLD;
74 public static final String MOB_COMPACT_PARTITION_POLICY = ColumnFamilyDescriptorBuilder.MOB_COMPACT_PARTITION_POLICY;
75 public static final byte[] MOB_COMPACT_PARTITION_POLICY_BYTES = Bytes.toBytes(MOB_COMPACT_PARTITION_POLICY);
76 public static final MobCompactPartitionPolicy DEFAULT_MOB_COMPACT_PARTITION_POLICY
77 = ColumnFamilyDescriptorBuilder.DEFAULT_MOB_COMPACT_PARTITION_POLICY;
78 public static final String DFS_REPLICATION = ColumnFamilyDescriptorBuilder.DFS_REPLICATION;
79 public static final short DEFAULT_DFS_REPLICATION = ColumnFamilyDescriptorBuilder.DEFAULT_DFS_REPLICATION;
80 public static final String STORAGE_POLICY = ColumnFamilyDescriptorBuilder.STORAGE_POLICY;
81 public static final String DEFAULT_COMPRESSION = ColumnFamilyDescriptorBuilder.DEFAULT_COMPRESSION.name();
82 public static final boolean DEFAULT_ENCODE_ON_DISK = true;
83 public static final String DEFAULT_DATA_BLOCK_ENCODING = ColumnFamilyDescriptorBuilder.DEFAULT_DATA_BLOCK_ENCODING.name();
84 public static final int DEFAULT_VERSIONS = ColumnFamilyDescriptorBuilder.DEFAULT_MAX_VERSIONS;
85 public static final int DEFAULT_MIN_VERSIONS = ColumnFamilyDescriptorBuilder.DEFAULT_MIN_VERSIONS;
86 public static final boolean DEFAULT_IN_MEMORY = ColumnFamilyDescriptorBuilder.DEFAULT_IN_MEMORY;
87 public static final KeepDeletedCells DEFAULT_KEEP_DELETED = ColumnFamilyDescriptorBuilder.DEFAULT_KEEP_DELETED;
88 public static final boolean DEFAULT_BLOCKCACHE = ColumnFamilyDescriptorBuilder.DEFAULT_BLOCKCACHE;
89 public static final boolean DEFAULT_CACHE_DATA_ON_WRITE = ColumnFamilyDescriptorBuilder.DEFAULT_CACHE_DATA_ON_WRITE;
90 public static final boolean DEFAULT_CACHE_DATA_IN_L1 = false;
91 public static final boolean DEFAULT_CACHE_INDEX_ON_WRITE = ColumnFamilyDescriptorBuilder.DEFAULT_CACHE_INDEX_ON_WRITE;
92 public static final int DEFAULT_BLOCKSIZE = ColumnFamilyDescriptorBuilder.DEFAULT_BLOCKSIZE;
93 public static final String DEFAULT_BLOOMFILTER = ColumnFamilyDescriptorBuilder.DEFAULT_BLOOMFILTER.name();
94 public static final boolean DEFAULT_CACHE_BLOOMS_ON_WRITE = ColumnFamilyDescriptorBuilder.DEFAULT_CACHE_BLOOMS_ON_WRITE;
95 public static final int DEFAULT_TTL = ColumnFamilyDescriptorBuilder.DEFAULT_TTL;
96 public static final int DEFAULT_REPLICATION_SCOPE = ColumnFamilyDescriptorBuilder.DEFAULT_REPLICATION_SCOPE;
97 public static final boolean DEFAULT_EVICT_BLOCKS_ON_CLOSE = ColumnFamilyDescriptorBuilder.DEFAULT_EVICT_BLOCKS_ON_CLOSE;
98 public static final boolean DEFAULT_COMPRESS_TAGS = ColumnFamilyDescriptorBuilder.DEFAULT_COMPRESS_TAGS;
99 public static final boolean DEFAULT_PREFETCH_BLOCKS_ON_OPEN = ColumnFamilyDescriptorBuilder.DEFAULT_PREFETCH_BLOCKS_ON_OPEN;
100 public static final String NEW_VERSION_BEHAVIOR = ColumnFamilyDescriptorBuilder.NEW_VERSION_BEHAVIOR;
101 public static final boolean DEFAULT_NEW_VERSION_BEHAVIOR = ColumnFamilyDescriptorBuilder.DEFAULT_NEW_VERSION_BEHAVIOR;
102 protected final ModifyableColumnFamilyDescriptor delegatee;
105 * Construct a column descriptor specifying only the family name
106 * The other attributes are defaulted.
108 * @param familyName Column family name. Must be 'printable' -- digit or
109 * letter -- and may not contain a <code>:</code>
110 * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
111 * (<a href="https://issues.apache.org/jira/browse/HBASE-18433">HBASE-18433</a>).
112 * Use {@link ColumnFamilyDescriptorBuilder#of(String)}.
114 @Deprecated
115 public HColumnDescriptor(final String familyName) {
116 this(new ModifyableColumnFamilyDescriptor(Bytes.toBytes(familyName)));
120 * Construct a column descriptor specifying only the family name
121 * The other attributes are defaulted.
123 * @param familyName Column family name. Must be 'printable' -- digit or
124 * letter -- and may not contain a <code>:</code>
125 * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
126 * (<a href="https://issues.apache.org/jira/browse/HBASE-18433">HBASE-18433</a>).
127 * Use {@link ColumnFamilyDescriptorBuilder#of(byte[])}.
129 @Deprecated
130 public HColumnDescriptor(final byte [] familyName) {
131 this(new ModifyableColumnFamilyDescriptor(familyName));
135 * Constructor.
136 * Makes a deep copy of the supplied descriptor.
137 * Can make a modifiable descriptor from an UnmodifyableHColumnDescriptor.
139 * @param desc The descriptor.
140 * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
141 * (<a href="https://issues.apache.org/jira/browse/HBASE-18433">HBASE-18433</a>).
142 * Use {@link ColumnFamilyDescriptorBuilder#copy(ColumnFamilyDescriptor)}.
144 @Deprecated
145 public HColumnDescriptor(HColumnDescriptor desc) {
146 this(desc, true);
149 protected HColumnDescriptor(HColumnDescriptor desc, boolean deepClone) {
150 this(deepClone ? new ModifyableColumnFamilyDescriptor(desc)
151 : desc.delegatee);
154 protected HColumnDescriptor(ModifyableColumnFamilyDescriptor delegate) {
155 this.delegatee = delegate;
159 * @return Name of this column family
161 @Override
162 public byte [] getName() {
163 return delegatee.getName();
167 * @return The name string of this column family
169 @Override
170 public String getNameAsString() {
171 return delegatee.getNameAsString();
175 * @param key The key.
176 * @return The value.
178 @Override
179 public byte[] getValue(byte[] key) {
180 return delegatee.getValue(key);
184 * @param key The key.
185 * @return The value as a string.
187 public String getValue(String key) {
188 byte[] value = getValue(Bytes.toBytes(key));
189 return value == null ? null : Bytes.toString(value);
192 @Override
193 public Map<Bytes, Bytes> getValues() {
194 return delegatee.getValues();
198 * @param key The key.
199 * @param value The value.
200 * @return this (for chained invocation)
202 public HColumnDescriptor setValue(byte[] key, byte[] value) {
203 getDelegateeForModification().setValue(key, value);
204 return this;
208 * @param key Key whose key and value we're to remove from HCD parameters.
210 public void remove(final byte [] key) {
211 getDelegateeForModification().removeValue(new Bytes(key));
215 * @param key The key.
216 * @param value The value.
217 * @return this (for chained invocation)
219 public HColumnDescriptor setValue(String key, String value) {
220 getDelegateeForModification().setValue(key, value);
221 return this;
225 * @return compression type being used for the column family
226 * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
227 * (<a href="https://issues.apache.org/jira/browse/HBASE-13655">HBASE-13655</a>).
228 * Use {@link #getCompressionType()}.
230 @Deprecated
231 public Compression.Algorithm getCompression() {
232 return getCompressionType();
236 * @return compression type being used for the column family for major compaction
237 * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0
238 * (<a href="https://issues.apache.org/jira/browse/HBASE-13655">HBASE-13655</a>).
239 * Use {@link #getCompactionCompressionType()}.
241 @Deprecated
242 public Compression.Algorithm getCompactionCompression() {
243 return getCompactionCompressionType();
246 @Override
247 public int getMaxVersions() {
248 return delegatee.getMaxVersions();
252 * @param value maximum number of versions
253 * @return this (for chained invocation)
255 public HColumnDescriptor setMaxVersions(int value) {
256 getDelegateeForModification().setMaxVersions(value);
257 return this;
261 * Set minimum and maximum versions to keep
263 * @param minVersions minimal number of versions
264 * @param maxVersions maximum number of versions
265 * @return this (for chained invocation)
267 public HColumnDescriptor setVersions(int minVersions, int maxVersions) {
268 if (minVersions <= 0) {
269 // TODO: Allow minVersion and maxVersion of 0 to be the way you say "Keep all versions".
270 // Until there is support, consider 0 or < 0 -- a configuration error.
271 throw new IllegalArgumentException("Minimum versions must be positive");
274 if (maxVersions < minVersions) {
275 throw new IllegalArgumentException("Unable to set MaxVersion to " + maxVersions
276 + " and set MinVersion to " + minVersions
277 + ", as maximum versions must be >= minimum versions.");
279 setMinVersions(minVersions);
280 setMaxVersions(maxVersions);
281 return this;
284 @Override
285 public int getBlocksize() {
286 return delegatee.getBlocksize();
290 * @param value Blocksize to use when writing out storefiles/hfiles on this
291 * column family.
292 * @return this (for chained invocation)
294 public HColumnDescriptor setBlocksize(int value) {
295 getDelegateeForModification().setBlocksize(value);
296 return this;
299 @Override
300 public Compression.Algorithm getCompressionType() {
301 return delegatee.getCompressionType();
305 * Compression types supported in hbase.
306 * LZO is not bundled as part of the hbase distribution.
307 * See <a href="http://hbase.apache.org/book.html#lzo.compression">LZO Compression</a>
308 * for how to enable it.
309 * @param value Compression type setting.
310 * @return this (for chained invocation)
312 public HColumnDescriptor setCompressionType(Compression.Algorithm value) {
313 getDelegateeForModification().setCompressionType(value);
314 return this;
317 @Override
318 public DataBlockEncoding getDataBlockEncoding() {
319 return delegatee.getDataBlockEncoding();
323 * Set data block encoding algorithm used in block cache.
324 * @param value What kind of data block encoding will be used.
325 * @return this (for chained invocation)
327 public HColumnDescriptor setDataBlockEncoding(DataBlockEncoding value) {
328 getDelegateeForModification().setDataBlockEncoding(value);
329 return this;
333 * Set whether the tags should be compressed along with DataBlockEncoding. When no
334 * DataBlockEncoding is been used, this is having no effect.
336 * @param value
337 * @return this (for chained invocation)
339 public HColumnDescriptor setCompressTags(boolean value) {
340 getDelegateeForModification().setCompressTags(value);
341 return this;
344 @Override
345 public boolean isCompressTags() {
346 return delegatee.isCompressTags();
349 @Override
350 public Compression.Algorithm getCompactionCompressionType() {
351 return delegatee.getCompactionCompressionType();
355 * Compression types supported in hbase.
356 * LZO is not bundled as part of the hbase distribution.
357 * See <a href="http://hbase.apache.org/book.html#lzo.compression">LZO Compression</a>
358 * for how to enable it.
359 * @param value Compression type setting.
360 * @return this (for chained invocation)
362 public HColumnDescriptor setCompactionCompressionType(Compression.Algorithm value) {
363 getDelegateeForModification().setCompactionCompressionType(value);
364 return this;
367 @Override
368 public boolean isInMemory() {
369 return delegatee.isInMemory();
373 * @param value True if we are to favor keeping all values for this column family in the
374 * HRegionServer cache
375 * @return this (for chained invocation)
377 public HColumnDescriptor setInMemory(boolean value) {
378 getDelegateeForModification().setInMemory(value);
379 return this;
382 @Override
383 public MemoryCompactionPolicy getInMemoryCompaction() {
384 return delegatee.getInMemoryCompaction();
388 * @param value the prefered in-memory compaction policy
389 * for this column family
390 * @return this (for chained invocation)
392 public HColumnDescriptor setInMemoryCompaction(MemoryCompactionPolicy value) {
393 getDelegateeForModification().setInMemoryCompaction(value);
394 return this;
397 @Override
398 public KeepDeletedCells getKeepDeletedCells() {
399 return delegatee.getKeepDeletedCells();
403 * @param value True if deleted rows should not be collected
404 * immediately.
405 * @return this (for chained invocation)
407 public HColumnDescriptor setKeepDeletedCells(KeepDeletedCells value) {
408 getDelegateeForModification().setKeepDeletedCells(value);
409 return this;
413 * By default, HBase only consider timestamp in versions. So a previous Delete with higher ts
414 * will mask a later Put with lower ts. Set this to true to enable new semantics of versions.
415 * We will also consider mvcc in versions. See HBASE-15968 for details.
417 @Override
418 public boolean isNewVersionBehavior() {
419 return delegatee.isNewVersionBehavior();
422 public HColumnDescriptor setNewVersionBehavior(boolean newVersionBehavior) {
423 getDelegateeForModification().setNewVersionBehavior(newVersionBehavior);
424 return this;
428 @Override
429 public int getTimeToLive() {
430 return delegatee.getTimeToLive();
434 * @param value Time-to-live of cell contents, in seconds.
435 * @return this (for chained invocation)
437 public HColumnDescriptor setTimeToLive(int value) {
438 getDelegateeForModification().setTimeToLive(value);
439 return this;
443 * @param value Time to live of cell contents, in human readable format
444 * @see org.apache.hadoop.hbase.util.PrettyPrinter#format(String, Unit)
445 * @return this (for chained invocation)
447 public HColumnDescriptor setTimeToLive(String value) throws HBaseException {
448 getDelegateeForModification().setTimeToLive(value);
449 return this;
452 @Override
453 public int getMinVersions() {
454 return delegatee.getMinVersions();
458 * @param value The minimum number of versions to keep.
459 * (used when timeToLive is set)
460 * @return this (for chained invocation)
462 public HColumnDescriptor setMinVersions(int value) {
463 getDelegateeForModification().setMinVersions(value);
464 return this;
467 @Override
468 public boolean isBlockCacheEnabled() {
469 return delegatee.isBlockCacheEnabled();
473 * @param value True if hfile DATA type blocks should be cached (We always cache
474 * INDEX and BLOOM blocks; you cannot turn this off).
475 * @return this (for chained invocation)
477 public HColumnDescriptor setBlockCacheEnabled(boolean value) {
478 getDelegateeForModification().setBlockCacheEnabled(value);
479 return this;
482 @Override
483 public BloomType getBloomFilterType() {
484 return delegatee.getBloomFilterType();
488 * @param value bloom filter type
489 * @return this (for chained invocation)
491 public HColumnDescriptor setBloomFilterType(final BloomType value) {
492 getDelegateeForModification().setBloomFilterType(value);
493 return this;
496 @Override
497 public int getScope() {
498 return delegatee.getScope();
502 * @param value the scope tag
503 * @return this (for chained invocation)
505 public HColumnDescriptor setScope(int value) {
506 getDelegateeForModification().setScope(value);
507 return this;
510 @Override
511 public boolean isCacheDataOnWrite() {
512 return delegatee.isCacheDataOnWrite();
516 * @param value true if we should cache data blocks on write
517 * @return this (for chained invocation)
519 public HColumnDescriptor setCacheDataOnWrite(boolean value) {
520 getDelegateeForModification().setCacheDataOnWrite(value);
521 return this;
525 * This is a noop call from HBase 2.0 onwards
527 * @return this (for chained invocation)
528 * @deprecated Since 2.0 and will be removed in 3.0 with out any replacement. Caching data in on
529 * heap Cache, when there are both on heap LRU Cache and Bucket Cache will no longer
530 * be supported from 2.0.
532 @Deprecated
533 public HColumnDescriptor setCacheDataInL1(boolean value) {
534 return this;
537 @Override
538 public boolean isCacheIndexesOnWrite() {
539 return delegatee.isCacheIndexesOnWrite();
543 * @param value true if we should cache index blocks on write
544 * @return this (for chained invocation)
546 public HColumnDescriptor setCacheIndexesOnWrite(boolean value) {
547 getDelegateeForModification().setCacheIndexesOnWrite(value);
548 return this;
551 @Override
552 public boolean isCacheBloomsOnWrite() {
553 return delegatee.isCacheBloomsOnWrite();
557 * @param value true if we should cache bloomfilter blocks on write
558 * @return this (for chained invocation)
560 public HColumnDescriptor setCacheBloomsOnWrite(boolean value) {
561 getDelegateeForModification().setCacheBloomsOnWrite(value);
562 return this;
565 @Override
566 public boolean isEvictBlocksOnClose() {
567 return delegatee.isEvictBlocksOnClose();
571 * @param value true if we should evict cached blocks from the blockcache on
572 * close
573 * @return this (for chained invocation)
575 public HColumnDescriptor setEvictBlocksOnClose(boolean value) {
576 getDelegateeForModification().setEvictBlocksOnClose(value);
577 return this;
580 @Override
581 public boolean isPrefetchBlocksOnOpen() {
582 return delegatee.isPrefetchBlocksOnOpen();
586 * @param value true if we should prefetch blocks into the blockcache on open
587 * @return this (for chained invocation)
589 public HColumnDescriptor setPrefetchBlocksOnOpen(boolean value) {
590 getDelegateeForModification().setPrefetchBlocksOnOpen(value);
591 return this;
595 * @see java.lang.Object#toString()
597 @Override
598 public String toString() {
599 return delegatee.toString();
603 * @return Column family descriptor with only the customized attributes.
605 @Override
606 public String toStringCustomizedValues() {
607 return delegatee.toStringCustomizedValues();
610 public static Unit getUnit(String key) {
611 return ColumnFamilyDescriptorBuilder.getUnit(key);
614 public static Map<String, String> getDefaultValues() {
615 return ColumnFamilyDescriptorBuilder.getDefaultValues();
619 * @see java.lang.Object#equals(java.lang.Object)
621 @Override
622 public boolean equals(Object obj) {
623 if (this == obj) {
624 return true;
626 if (obj instanceof HColumnDescriptor) {
627 return delegatee.equals(((HColumnDescriptor) obj).delegatee);
629 return false;
633 * @see java.lang.Object#hashCode()
635 @Override
636 public int hashCode() {
637 return delegatee.hashCode();
640 @Override
641 public int compareTo(HColumnDescriptor other) {
642 return COMPARATOR.compare(this, other);
646 * @return This instance serialized with pb with pb magic prefix
647 * @see #parseFrom(byte[])
649 public byte[] toByteArray() {
650 return ColumnFamilyDescriptorBuilder.toByteArray(delegatee);
654 * @param bytes A pb serialized {@link HColumnDescriptor} instance with pb magic prefix
655 * @return An instance of {@link HColumnDescriptor} made from <code>bytes</code>
656 * @throws DeserializationException
657 * @see #toByteArray()
659 public static HColumnDescriptor parseFrom(final byte [] bytes) throws DeserializationException {
660 ColumnFamilyDescriptor desc = ColumnFamilyDescriptorBuilder.parseFrom(bytes);
661 if (desc instanceof ModifyableColumnFamilyDescriptor) {
662 return new HColumnDescriptor((ModifyableColumnFamilyDescriptor) desc);
663 } else {
664 return new HColumnDescriptor(new ModifyableColumnFamilyDescriptor(desc));
668 @Override
669 public String getConfigurationValue(String key) {
670 return delegatee.getConfigurationValue(key);
673 @Override
674 public Map<String, String> getConfiguration() {
675 return delegatee.getConfiguration();
679 * Setter for storing a configuration setting.
680 * @param key Config key. Same as XML config key e.g. hbase.something.or.other.
681 * @param value String value. If null, removes the configuration.
683 public HColumnDescriptor setConfiguration(String key, String value) {
684 getDelegateeForModification().setConfiguration(key, value);
685 return this;
689 * Remove a configuration setting represented by the key.
691 public void removeConfiguration(final String key) {
692 getDelegateeForModification().removeConfiguration(key);
695 @Override
696 public String getEncryptionType() {
697 return delegatee.getEncryptionType();
701 * Set the encryption algorithm for use with this family
702 * @param value
704 public HColumnDescriptor setEncryptionType(String value) {
705 getDelegateeForModification().setEncryptionType(value);
706 return this;
709 @Override
710 public byte[] getEncryptionKey() {
711 return delegatee.getEncryptionKey();
714 /** Set the raw crypto key attribute for the family */
715 public HColumnDescriptor setEncryptionKey(byte[] value) {
716 getDelegateeForModification().setEncryptionKey(value);
717 return this;
720 @Override
721 public long getMobThreshold() {
722 return delegatee.getMobThreshold();
726 * Sets the mob threshold of the family.
727 * @param value The mob threshold.
728 * @return this (for chained invocation)
730 public HColumnDescriptor setMobThreshold(long value) {
731 getDelegateeForModification().setMobThreshold(value);
732 return this;
735 @Override
736 public boolean isMobEnabled() {
737 return delegatee.isMobEnabled();
741 * Enables the mob for the family.
742 * @param value Whether to enable the mob for the family.
743 * @return this (for chained invocation)
745 public HColumnDescriptor setMobEnabled(boolean value) {
746 getDelegateeForModification().setMobEnabled(value);
747 return this;
750 @Override
751 public MobCompactPartitionPolicy getMobCompactPartitionPolicy() {
752 return delegatee.getMobCompactPartitionPolicy();
756 * Set the mob compact partition policy for the family.
757 * @param value policy type
758 * @return this (for chained invocation)
760 public HColumnDescriptor setMobCompactPartitionPolicy(MobCompactPartitionPolicy value) {
761 getDelegateeForModification().setMobCompactPartitionPolicy(value);
762 return this;
765 @Override
766 public short getDFSReplication() {
767 return delegatee.getDFSReplication();
771 * Set the replication factor to hfile(s) belonging to this family
772 * @param value number of replicas the blocks(s) belonging to this CF should have, or
773 * {@link #DEFAULT_DFS_REPLICATION} for the default replication factor set in the
774 * filesystem
775 * @return this (for chained invocation)
777 public HColumnDescriptor setDFSReplication(short value) {
778 getDelegateeForModification().setDFSReplication(value);
779 return this;
782 @Override
783 public String getStoragePolicy() {
784 return delegatee.getStoragePolicy();
788 * Set the storage policy for use with this family
789 * @param value the policy to set, valid setting includes: <i>"LAZY_PERSIST"</i>,
790 * <i>"ALL_SSD"</i>, <i>"ONE_SSD"</i>, <i>"HOT"</i>, <i>"WARM"</i>, <i>"COLD"</i>
792 public HColumnDescriptor setStoragePolicy(String value) {
793 getDelegateeForModification().setStoragePolicy(value);
794 return this;
797 @Override
798 public Bytes getValue(Bytes key) {
799 return delegatee.getValue(key);
802 protected ModifyableColumnFamilyDescriptor getDelegateeForModification() {
803 return delegatee;