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,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.hadoop.hbase;
21  
22  import java.io.IOException;
23  import java.util.concurrent.ExecutorService;
24  
25  import org.apache.hadoop.hbase.classification.InterfaceAudience;
26  import org.apache.hadoop.conf.Configuration;
27  import org.apache.hadoop.hbase.client.HTableInterface;
28  
29  /**
30   * Coprocessor environment state.
31   */
32  @InterfaceAudience.Private
33  public interface CoprocessorEnvironment {
34  
35    /** @return the Coprocessor interface version */
36    int getVersion();
37  
38    /** @return the HBase version as a string (e.g. "0.21.0") */
39    String getHBaseVersion();
40  
41    /** @return the loaded coprocessor instance */
42    Coprocessor getInstance();
43  
44    /** @return the priority assigned to the loaded coprocessor */
45    int getPriority();
46  
47    /** @return the load sequence number */
48    int getLoadSequence();
49  
50    /** @return the configuration */
51    Configuration getConfiguration();
52  
53    /**
54     * @return an interface for accessing the given table
55     * @throws IOException
56     */
57    HTableInterface getTable(TableName tableName) throws IOException;
58  
59    /**
60     * @return an interface for accessing the given table using the passed executor to run batch
61     *         operations
62     * @throws IOException
63     */
64    HTableInterface getTable(TableName tableName, ExecutorService service) throws IOException;
65  
66    /**
67     * @return the classloader for the loaded coprocessor instance
68     */
69    ClassLoader getClassLoader();
70  }