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 org.apache.hadoop.classification.InterfaceAudience;
19 import org.apache.hadoop.classification.InterfaceStability;
20
21 import java.io.IOException;
22
23 /**
24 * Coprocess interface.
25 */
26 @InterfaceAudience.Public
27 @InterfaceStability.Evolving
28 public interface Coprocessor {
29 int VERSION = 1;
30
31 /** Highest installation priority */
32 int PRIORITY_HIGHEST = 0;
33 /** High (system) installation priority */
34 int PRIORITY_SYSTEM = Integer.MAX_VALUE / 4;
35 /** Default installation priority for user coprocessors */
36 int PRIORITY_USER = Integer.MAX_VALUE / 2;
37 /** Lowest installation priority */
38 int PRIORITY_LOWEST = Integer.MAX_VALUE;
39
40 /**
41 * Lifecycle state of a given coprocessor instance.
42 */
43 enum State {
44 UNINSTALLED,
45 INSTALLED,
46 STARTING,
47 ACTIVE,
48 STOPPING,
49 STOPPED
50 }
51
52 // Interface
53 void start(CoprocessorEnvironment env) throws IOException;
54
55 void stop(CoprocessorEnvironment env) throws IOException;
56 }