View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.hadoop.hbase;
19  
20  import java.io.IOException;
21  import java.util.Map;
22  
23  import org.apache.hadoop.classification.InterfaceAudience;
24  
25  /**
26   * Get, remove and modify table descriptors.
27   * Used by servers to host descriptors.
28   */
29  @InterfaceAudience.Private
30  public interface TableDescriptors {
31    /**
32     * @param tableName
33     * @return HTableDescriptor for tablename
34     * @throws IOException
35     */
36    HTableDescriptor get(final TableName tableName)
37    throws IOException;
38  
39    /**
40     * @param tableName
41     * @return TableDescriptor for tablename
42     * @throws IOException
43     */
44    TableDescriptor getDescriptor(final TableName tableName)
45        throws IOException;
46  
47    /**
48     * Get Map of all NamespaceDescriptors for a given namespace.
49     * @return Map of all descriptors.
50     * @throws IOException
51     */
52    Map<String, HTableDescriptor> getByNamespace(String name)
53    throws IOException;
54  
55    /**
56     * Get Map of all HTableDescriptors. Populates the descriptor cache as a
57     * side effect.
58     * @return Map of all descriptors.
59     * @throws IOException
60     */
61    Map<String, HTableDescriptor> getAll()
62    throws IOException;
63  
64    /**
65     * Get Map of all TableDescriptors. Populates the descriptor cache as a
66     * side effect.
67     * @return Map of all descriptors.
68     * @throws IOException
69     */
70    Map<String, TableDescriptor> getAllDescriptors()
71        throws IOException;
72  
73    /**
74     * Add or update descriptor
75     * @param htd Descriptor to set into TableDescriptors
76     * @throws IOException
77     */
78    void add(final HTableDescriptor htd)
79    throws IOException;
80  
81    /**
82     * Add or update descriptor
83     * @param htd Descriptor to set into TableDescriptors
84     * @throws IOException
85     */
86    void add(final TableDescriptor htd)
87        throws IOException;
88  
89    /**
90     * @param tablename
91     * @return Instance of table descriptor or null if none found.
92     * @throws IOException
93     */
94    HTableDescriptor remove(final TableName tablename)
95    throws IOException;
96  }