1 /*
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 package org.apache.hadoop.hbase;
17
18 import java.io.IOException;
19 import java.util.concurrent.ExecutorService;
20
21 import org.apache.hadoop.hbase.classification.InterfaceAudience;
22 import org.apache.hadoop.conf.Configuration;
23 import org.apache.hadoop.hbase.client.HTableInterface;
24
25 /**
26 * Coprocessor environment state.
27 */
28 @InterfaceAudience.Private
29 public interface CoprocessorEnvironment {
30
31 /** @return the Coprocessor interface version */
32 int getVersion();
33
34 /** @return the HBase version as a string (e.g. "0.21.0") */
35 String getHBaseVersion();
36
37 /** @return the loaded coprocessor instance */
38 Coprocessor getInstance();
39
40 /** @return the priority assigned to the loaded coprocessor */
41 int getPriority();
42
43 /** @return the load sequence number */
44 int getLoadSequence();
45
46 /** @return the configuration */
47 Configuration getConfiguration();
48
49 /**
50 * @return an interface for accessing the given table
51 * @throws IOException
52 */
53 HTableInterface getTable(TableName tableName) throws IOException;
54
55 /**
56 * @return an interface for accessing the given table using the passed executor to run batch
57 * operations
58 * @throws IOException
59 */
60 HTableInterface getTable(TableName tableName, ExecutorService service) throws IOException;
61
62 /**
63 * @return the classloader for the loaded coprocessor instance
64 */
65 ClassLoader getClassLoader();
66 }