001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.hbase;
019
020import java.io.IOException;
021import java.util.Map;
022
023import org.apache.yetus.audience.InterfaceAudience;
024import org.apache.hadoop.hbase.client.TableDescriptor;
025
026/**
027 * Get, remove and modify table descriptors.
028 * Used by servers to host descriptors.
029 */
030@InterfaceAudience.Private
031public interface TableDescriptors {
032  /**
033   * @param tableName
034   * @return TableDescriptor for tablename
035   * @throws IOException
036   */
037  TableDescriptor get(final TableName tableName)
038      throws IOException;
039
040  /**
041   * Get Map of all NamespaceDescriptors for a given namespace.
042   * @return Map of all descriptors.
043   * @throws IOException
044   */
045  Map<String, TableDescriptor> getByNamespace(String name)
046  throws IOException;
047
048  /**
049   * Get Map of all TableDescriptors. Populates the descriptor cache as a
050   * side effect.
051   * @return Map of all descriptors.
052   * @throws IOException
053   */
054  Map<String, TableDescriptor> getAll()
055  throws IOException;
056
057  /**
058   * Add or update descriptor
059   * @param htd Descriptor to set into TableDescriptors
060   * @throws IOException
061   */
062  void add(final TableDescriptor htd)
063  throws IOException;
064
065  /**
066   * @param tablename
067   * @return Instance of table descriptor or null if none found.
068   * @throws IOException
069   */
070  TableDescriptor remove(final TableName tablename)
071  throws IOException;
072
073  /**
074   * Enables the tabledescriptor cache
075   */
076  void setCacheOn() throws IOException;
077
078  /**
079   * Disables the tabledescriptor cache
080   */
081  void setCacheOff() throws IOException;
082}