1 /*
2 * Copyright 2010 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package org.apache.hadoop.hbase;
18
19 import java.io.IOException;
20
21 /**
22 * Coprocess interface.
23 */
24 public interface Coprocessor {
25 static final int VERSION = 1;
26
27 /** Highest installation priority */
28 static final int PRIORITY_HIGHEST = 0;
29 /** High (system) installation priority */
30 static final int PRIORITY_SYSTEM = Integer.MAX_VALUE / 4;
31 /** Default installation priority for user coprocessors */
32 static final int PRIORITY_USER = Integer.MAX_VALUE / 2;
33 /** Lowest installation priority */
34 static final int PRIORITY_LOWEST = Integer.MAX_VALUE;
35
36 /**
37 * Lifecycle state of a given coprocessor instance.
38 */
39 public enum State {
40 UNINSTALLED,
41 INSTALLED,
42 STARTING,
43 ACTIVE,
44 STOPPING,
45 STOPPED
46 }
47
48 // Interface
49 void start(CoprocessorEnvironment env) throws IOException;
50
51 void stop(CoprocessorEnvironment env) throws IOException;
52 }