本文整理汇总了Java中org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor类的典型用法代码示例。如果您正苦于以下问题:Java AFamilyDescriptor类的具体用法?Java AFamilyDescriptor怎么用?Java AFamilyDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AFamilyDescriptor类属于org.apache.hadoop.hbase.avro.generated包,在下文中一共展示了AFamilyDescriptor类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: htdToATD
import org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor; //导入依赖的package包/类
static public ATableDescriptor htdToATD(HTableDescriptor table) throws IOException {
ATableDescriptor atd = new ATableDescriptor();
atd.name = ByteBuffer.wrap(table.getName());
Collection<HColumnDescriptor> families = table.getFamilies();
Schema afdSchema = Schema.createArray(AFamilyDescriptor.SCHEMA$);
GenericData.Array<AFamilyDescriptor> afamilies = null;
if (families.size() > 0) {
afamilies = new GenericData.Array<AFamilyDescriptor>(families.size(), afdSchema);
for (HColumnDescriptor hcd : families) {
AFamilyDescriptor afamily = hcdToAFD(hcd);
afamilies.add(afamily);
}
} else {
afamilies = new GenericData.Array<AFamilyDescriptor>(0, afdSchema);
}
atd.families = afamilies;
atd.maxFileSize = table.getMaxFileSize();
atd.memStoreFlushSize = table.getMemStoreFlushSize();
atd.rootRegion = table.isRootRegion();
atd.metaRegion = table.isMetaRegion();
atd.metaTable = table.isMetaTable();
atd.readOnly = table.isReadOnly();
atd.deferredLogFlush = table.isDeferredLogFlush();
return atd;
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:26,代码来源:AvroUtil.java
示例2: atdToHTD
import org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor; //导入依赖的package包/类
static public HTableDescriptor atdToHTD(ATableDescriptor atd) throws IOException, AIllegalArgument {
HTableDescriptor htd = new HTableDescriptor(Bytes.toBytes(atd.name));
if (atd.families != null && atd.families.size() > 0) {
for (AFamilyDescriptor afd : atd.families) {
htd.addFamily(afdToHCD(afd));
}
}
if (atd.maxFileSize != null) {
htd.setMaxFileSize(atd.maxFileSize);
}
if (atd.memStoreFlushSize != null) {
htd.setMemStoreFlushSize(atd.memStoreFlushSize);
}
if (atd.readOnly != null) {
htd.setReadOnly(atd.readOnly);
}
if (atd.deferredLogFlush != null) {
htd.setDeferredLogFlush(atd.deferredLogFlush);
}
if (atd.rootRegion != null || atd.metaRegion != null || atd.metaTable != null) {
AIllegalArgument aie = new AIllegalArgument();
aie.message = new Utf8("Can't set root or meta flag on create table.");
throw aie;
}
return htd;
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:27,代码来源:AvroUtil.java
示例3: hcdToAFD
import org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor; //导入依赖的package包/类
static public AFamilyDescriptor hcdToAFD(HColumnDescriptor hcd) throws IOException {
AFamilyDescriptor afamily = new AFamilyDescriptor();
afamily.name = ByteBuffer.wrap(hcd.getName());
String compressionAlgorithm = hcd.getCompressionType().getName();
if (compressionAlgorithm == "LZO") {
afamily.compression = ACompressionAlgorithm.LZO;
} else if (compressionAlgorithm == "GZ") {
afamily.compression = ACompressionAlgorithm.GZ;
} else {
afamily.compression = ACompressionAlgorithm.NONE;
}
afamily.maxVersions = hcd.getMaxVersions();
afamily.blocksize = hcd.getBlocksize();
afamily.inMemory = hcd.isInMemory();
afamily.timeToLive = hcd.getTimeToLive();
afamily.blockCacheEnabled = hcd.isBlockCacheEnabled();
return afamily;
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:19,代码来源:AvroUtil.java
示例4: describeFamily
import org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor; //导入依赖的package包/类
public AFamilyDescriptor describeFamily(ByteBuffer table, ByteBuffer family) throws AIOError {
try {
HTableDescriptor htd = admin.getTableDescriptor(Bytes.toBytes(table));
return AvroUtil.hcdToAFD(htd.getFamily(Bytes.toBytes(family)));
} catch (IOException e) {
AIOError ioe = new AIOError();
ioe.message = new Utf8(e.getMessage());
throw ioe;
}
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:AvroServer.java
示例5: addFamily
import org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor; //导入依赖的package包/类
public Void addFamily(ByteBuffer table, AFamilyDescriptor family) throws AIOError {
try {
admin.addColumn(Bytes.toBytes(table),
AvroUtil.afdToHCD(family));
return null;
} catch (IOException e) {
AIOError ioe = new AIOError();
ioe.message = new Utf8(e.getMessage());
throw ioe;
}
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:12,代码来源:AvroServer.java
示例6: modifyFamily
import org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor; //导入依赖的package包/类
public Void modifyFamily(ByteBuffer table, ByteBuffer familyName, AFamilyDescriptor familyDescriptor) throws AIOError {
try {
admin.modifyColumn(Bytes.toBytes(table), AvroUtil.afdToHCD(familyDescriptor));
return null;
} catch (IOException e) {
AIOError ioe = new AIOError();
ioe.message = new Utf8(e.getMessage());
throw ioe;
}
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:AvroServer.java
示例7: afdToHCD
import org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor; //导入依赖的package包/类
static public HColumnDescriptor afdToHCD(AFamilyDescriptor afd) throws IOException {
HColumnDescriptor hcd = new HColumnDescriptor(Bytes.toBytes(afd.name));
ACompressionAlgorithm compressionAlgorithm = afd.compression;
if (compressionAlgorithm == ACompressionAlgorithm.LZO) {
hcd.setCompressionType(Compression.Algorithm.LZO);
} else if (compressionAlgorithm == ACompressionAlgorithm.GZ) {
hcd.setCompressionType(Compression.Algorithm.GZ);
} else {
hcd.setCompressionType(Compression.Algorithm.NONE);
}
if (afd.maxVersions != null) {
hcd.setMaxVersions(afd.maxVersions);
}
if (afd.blocksize != null) {
hcd.setBlocksize(afd.blocksize);
}
if (afd.inMemory != null) {
hcd.setInMemory(afd.inMemory);
}
if (afd.timeToLive != null) {
hcd.setTimeToLive(afd.timeToLive);
}
if (afd.blockCacheEnabled != null) {
hcd.setBlockCacheEnabled(afd.blockCacheEnabled);
}
return hcd;
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:34,代码来源:AvroUtil.java
示例8: testFamilyAdminAndMetadata
import org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor; //导入依赖的package包/类
/**
* Tests for creating, modifying, and deleting column families.
*
* @throws Exception
*/
@Test
public void testFamilyAdminAndMetadata() throws Exception {
AvroServer.HBaseImpl impl =
new AvroServer.HBaseImpl(TEST_UTIL.getConfiguration());
ATableDescriptor tableA = new ATableDescriptor();
tableA.name = tableAname;
AFamilyDescriptor familyA = new AFamilyDescriptor();
familyA.name = familyAname;
Schema familyArraySchema = Schema.createArray(AFamilyDescriptor.SCHEMA$);
GenericArray<AFamilyDescriptor> families = new GenericData.Array<AFamilyDescriptor>(1, familyArraySchema);
families.add(familyA);
tableA.families = families;
impl.createTable(tableA);
assertEquals(impl.describeTable(tableAname).families.size(), 1);
impl.disableTable(tableAname);
assertFalse(impl.isTableEnabled(tableAname));
familyA.maxVersions = 123456;
impl.modifyFamily(tableAname, familyAname, familyA);
assertEquals((int) impl.describeFamily(tableAname, familyAname).maxVersions, 123456);
impl.deleteFamily(tableAname, familyAname);
assertEquals(impl.describeTable(tableAname).families.size(), 0);
impl.deleteTable(tableAname);
}
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:34,代码来源:TestAvroServer.java
注:本文中的org.apache.hadoop.hbase.avro.generated.AFamilyDescriptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论