...
Code Block |
---|
/** * Executes HBase DDL operations. */ public interface HBaseDDLExecutor { /** * Create the specified namespace if it does not exist. * * @param name the namespace to create * @throws IOException if a remote or network exception occurs */ void createNamespaceIfNotExists(String name) throws IOException; /** * Delete the specified namespace if it exists. * * @param name the namespace to delete * @throws IOException if a remote or network exception occurs * @throws IllegalStateException if there are tables in the namespace */ void deleteNamespaceIfExists(String name) throws IOException; /** * Create the specified table if it does not exist. * * @param descriptor the descriptor for the table to create * @param splitKeys the initial split keys for the table * @throws IOException if a remote or network exception occurs * @throws NotFoundException if the namespace for the specified table does not exist */ void createTableIfNotExists(TableDescriptor descriptor, @Nullable byte[][] splitKeys) throws IOException; /** * Enable the specified table. * * @param namespace the namespace of the table to enable * @param name the name of the table to enable * @throws IOException if a remote or network exception occurs * @throws NotFoundException if the specified table does not exist */ void enableTable(String namespace, String name) throws IOException; /** * Disable the specified table. * * @param namespace the namespace of the table to disable * @param name the name of the table to disable * @throws IOException if a remote or network exception occurs * @throws NotFoundException if the specified table does not exist */ void disableTable(String namespace, String name) throws IOException; /** * Modify the specified table. The table must be disabled. * * @param namespace the namespace of the table to modify * @param name the name of the table to modify * @param descriptor the descriptor for the table * @throws IOException if a remote or network exception occurs * @throws NotFoundException if the specified table does not exist * @throws IllegalStateException if the specified table is not disabled */ void modifyTable(String namespace, String name, TableDescriptor descriptor) throws IOException; /** * Truncate the specified table. The table must be disabled. * * @param namespace the namespace of the table to truncate * @param name the name of the table to truncate * @throws IOException if a remote or network exception occurs * @throws NotFoundException if the specified table does not exist * @throws IllegalStateException if the specified table is not disabled */ void truncateTable(String namespace, String name) throws IOException; /** * Delete the table if it exists. The table must be disabled. * * @param namespace the namespace of the table to delete * @param name the table to delete * @throws IOException if a remote or network exception occurs * @throws NotFoundException if the namespace for the specified table does not exist * @throws IllegalStateException if the specified table is not disabled */ void deleteTableIfExists(String namespace, String name) throws IOException; } /** * Describes an HBase Table. */ public class TableDescriptor { private final String namespace; private final String name; private final Map<String, ColumnFamilyDescriptor> families; // family -> descriptor private final Map<String, CoprocessorDescriptor> coprocessors; // classname -> descriptor private final Map<String, String> properties; } /** * Describes an HBase table coprocessor. */ public class CoprocessorDescriptor { private final String pathdirPath; private final int priority; private final Map<String, String> properties; public String getCoprocessorPath(String cdapVersion, String hbaseVersion) { ... } } /** * Describes an HBase table column family. */ public class ColumnFamilyDescriptor { private final int maxVersions; private final CompressionType compressionType; private final BloomType bloomType; private final Map<String, String> properties; } /** * Types of column family compression. */ public enum CompressionType { LZO, SNAPPY, GZIP, NONE } /** * Types of column family bloom filters. */ public enum BloomType { ROW, ROWCOL, NONE } |
...