View Javadoc

1   /**
2    * Copyright 2010 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase.ipc;
21  
22  import org.apache.hadoop.hbase.ClusterStatus;
23  import org.apache.hadoop.hbase.HColumnDescriptor;
24  import org.apache.hadoop.hbase.HConstants;
25  import org.apache.hadoop.hbase.HTableDescriptor;
26  import org.apache.hadoop.io.Writable;
27  
28  import java.io.IOException;
29  
30  /**
31   * Clients interact with the HMasterInterface to gain access to meta-level
32   * HBase functionality, like finding an HRegionServer and creating/destroying
33   * tables.
34   *
35   * <p>NOTE: if you change the interface, you must change the RPC version
36   * number in HBaseRPCProtocolVersion
37   *
38   */
39  public interface HMasterInterface extends HBaseRPCProtocolVersion {
40  
41    /** @return true if master is available */
42    public boolean isMasterRunning();
43  
44    // Admin tools would use these cmds
45  
46    /**
47     * Creates a new table.  If splitKeys are specified, then the table will be
48     * created with an initial set of multiple regions.  If splitKeys is null,
49     * the table will be created with a single region.
50     * @param desc table descriptor
51     * @param splitKeys
52     * @throws IOException
53     */
54    public void createTable(HTableDescriptor desc, byte [][] splitKeys)
55    throws IOException;
56  
57    /**
58     * Deletes a table
59     * @param tableName table to delete
60     * @throws IOException e
61     */
62    public void deleteTable(final byte [] tableName) throws IOException;
63  
64    /**
65     * Adds a column to the specified table
66     * @param tableName table to modify
67     * @param column column descriptor
68     * @throws IOException e
69     */
70    public void addColumn(final byte [] tableName, HColumnDescriptor column)
71    throws IOException;
72  
73    /**
74     * Modifies an existing column on the specified table
75     * @param tableName table name
76     * @param columnName name of the column to edit
77     * @param descriptor new column descriptor
78     * @throws IOException e
79     */
80    public void modifyColumn(final byte [] tableName, final byte [] columnName,
81      HColumnDescriptor descriptor)
82    throws IOException;
83  
84  
85    /**
86     * Deletes a column from the specified table. Table must be disabled.
87     * @param tableName table to alter
88     * @param columnName column family to remove
89     * @throws IOException e
90     */
91    public void deleteColumn(final byte [] tableName, final byte [] columnName)
92    throws IOException;
93  
94    /**
95     * Puts the table on-line (only needed if table has been previously taken offline)
96     * @param tableName table to enable
97     * @throws IOException e
98     */
99    public void enableTable(final byte [] tableName) throws IOException;
100 
101   /**
102    * Take table offline
103    *
104    * @param tableName table to take offline
105    * @throws IOException e
106    */
107   public void disableTable(final byte [] tableName) throws IOException;
108 
109   /**
110    * Modify a table's metadata
111    *
112    * @param tableName table to modify
113    * @param op the operation to do
114    * @param args arguments for operation
115    * @throws IOException e
116    */
117   public void modifyTable(byte[] tableName, HConstants.Modify op, Writable[] args)
118     throws IOException;
119 
120   /**
121    * Shutdown an HBase cluster.
122    * @throws IOException e
123    */
124   public void shutdown() throws IOException;
125 
126   /**
127    * Return cluster status.
128    * @return status object
129    */
130   public ClusterStatus getClusterStatus();
131 }