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.FileNotFoundException;
21 import java.io.IOException;
22 import java.util.Map;
23
24 /**
25 * Get, remove and modify table descriptors.
26 * Used by servers to host descriptors.
27 */
28 public interface TableDescriptors {
29 /**
30 * @param tablename
31 * @return HTableDescriptor for tablename
32 * @throws TableExistsException
33 * @throws FileNotFoundException
34 * @throws IOException
35 */
36 public HTableDescriptor get(final String tablename)
37 throws TableExistsException, FileNotFoundException, IOException;
38
39 /**
40 * @param tablename
41 * @return HTableDescriptor for tablename
42 * @throws TableExistsException
43 * @throws FileNotFoundException
44 * @throws IOException
45 */
46 public HTableDescriptor get(final byte[] tablename)
47 throws TableExistsException, FileNotFoundException, IOException;
48
49 /**
50 * Get Map of all HTableDescriptors. Populates the descriptor cache as a
51 * side effect.
52 * @return Map of all descriptors.
53 * @throws IOException
54 */
55 public Map<String, HTableDescriptor> getAll()
56 throws IOException;
57
58 /**
59 * Add or update descriptor
60 * @param htd Descriptor to set into TableDescriptors
61 * @throws IOException
62 */
63 public void add(final HTableDescriptor htd)
64 throws IOException;
65
66 /**
67 * @param tablename
68 * @return Instance of table descriptor or null if none found.
69 * @throws IOException
70 */
71 public HTableDescriptor remove(final String tablename)
72 throws IOException;
73 }