Search in sources :

Example 11 with TTableDescriptor

use of org.apache.hadoop.hbase.thrift2.generated.TTableDescriptor in project hbase by apache.

the class ThriftUtilities method tableDescriptorFromHBase.

public static TTableDescriptor tableDescriptorFromHBase(TableDescriptor in) {
    TTableDescriptor out = new TTableDescriptor();
    out.setTableName(tableNameFromHBase(in.getTableName()));
    Map<Bytes, Bytes> attributes = in.getValues();
    for (Map.Entry<Bytes, Bytes> attribute : attributes.entrySet()) {
        out.putToAttributes(ByteBuffer.wrap(attribute.getKey().get()), ByteBuffer.wrap(attribute.getValue().get()));
    }
    for (ColumnFamilyDescriptor column : in.getColumnFamilies()) {
        out.addToColumns(columnFamilyDescriptorFromHBase(column));
    }
    out.setDurability(durabilityFromHBase(in.getDurability()));
    return out;
}
Also used : Bytes.getBytes(org.apache.hadoop.hbase.util.Bytes.getBytes) Bytes(org.apache.hadoop.hbase.util.Bytes) TTableDescriptor(org.apache.hadoop.hbase.thrift2.generated.TTableDescriptor) ColumnFamilyDescriptor(org.apache.hadoop.hbase.client.ColumnFamilyDescriptor) TColumnFamilyDescriptor(org.apache.hadoop.hbase.thrift2.generated.TColumnFamilyDescriptor) Map(java.util.Map)

Aggregations

TTableDescriptor (org.apache.hadoop.hbase.thrift2.generated.TTableDescriptor)11 IOException (java.io.IOException)6 TableDescriptor (org.apache.hadoop.hbase.client.TableDescriptor)5 DoNotRetryIOException (org.apache.hadoop.hbase.DoNotRetryIOException)4 TColumnFamilyDescriptor (org.apache.hadoop.hbase.thrift2.generated.TColumnFamilyDescriptor)4 TTableName (org.apache.hadoop.hbase.thrift2.generated.TTableName)4 ByteBuffer (java.nio.ByteBuffer)2 THBaseService (org.apache.hadoop.hbase.thrift2.generated.THBaseService)2 TException (org.apache.thrift.TException)2 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)2 TProtocol (org.apache.thrift.protocol.TProtocol)2 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Pattern (java.util.regex.Pattern)1 TableName (org.apache.hadoop.hbase.TableName)1 ColumnFamilyDescriptor (org.apache.hadoop.hbase.client.ColumnFamilyDescriptor)1 TNamespaceDescriptor (org.apache.hadoop.hbase.thrift2.generated.TNamespaceDescriptor)1 Bytes (org.apache.hadoop.hbase.util.Bytes)1 Bytes.getBytes (org.apache.hadoop.hbase.util.Bytes.getBytes)1