hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From li...@apache.org
Subject svn commit: r1584165 - in /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase: Coprocessor.java CoprocessorEnvironment.java
Date Wed, 02 Apr 2014 20:49:17 GMT
Author: liyin
Date: Wed Apr  2 20:49:16 2014
New Revision: 1584165

URL: http://svn.apache.org/r1584165
Log:
[HBASE-2000] Adding Coprocessor and CoprocessorEnvironment

Author: adela

Summary:
two very basic util classes which both David and I are going to use
(ported from opensource)

Test Plan: N/A

Reviewers: daviddeng

Reviewed By: daviddeng

CC: hbase-eng@, liyintang, manukranthk

Differential Revision: https://phabricator.fb.com/D1222934

Added:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/Coprocessor.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java

Added: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/Coprocessor.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/Coprocessor.java?rev=1584165&view=auto
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/Coprocessor.java (added)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/Coprocessor.java Wed Apr
 2 20:49:16 2014
@@ -0,0 +1,48 @@
+/*
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase;
+
+import java.io.IOException;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+
+/**
+ * Coprocessor interface.
+ */
+@InterfaceAudience.Private
+public interface Coprocessor {
+  int VERSION = 1;
+
+  /** Highest installation priority */
+  int PRIORITY_HIGHEST = 0;
+  /** High (system) installation priority */
+  int PRIORITY_SYSTEM = Integer.MAX_VALUE / 4;
+  /** Default installation priority for user coprocessors */
+  int PRIORITY_USER = Integer.MAX_VALUE / 2;
+  /** Lowest installation priority */
+  int PRIORITY_LOWEST = Integer.MAX_VALUE;
+
+  /**
+   * Lifecycle state of a given coprocessor instance.
+   */
+  enum State {
+    UNINSTALLED, INSTALLED, STARTING, ACTIVE, STOPPING, STOPPED
+  }
+
+  void start(CoprocessorEnvironment env) throws IOException;
+
+  void stop(CoprocessorEnvironment env) throws IOException;
+
+}

Added: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java?rev=1584165&view=auto
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java
(added)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/CoprocessorEnvironment.java
Wed Apr  2 20:49:16 2014
@@ -0,0 +1,66 @@
+/*
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hbase;
+
+import java.io.IOException;
+import java.util.concurrent.ExecutorService;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.client.HTableInterface;
+
+/**
+ * Coprocessor environment state.
+ */
+@InterfaceAudience.Private
+public interface CoprocessorEnvironment {
+
+  /** @return the Coprocessor interface version */
+  int getVersion();
+
+  /** @return the HBase version as a string (e.g. "0.21.0") */
+  String getHBaseVersion();
+
+  /** @return the loaded coprocessor instance */
+  Coprocessor getInstance();
+
+  /** @return the priority assigned to the loaded coprocessor */
+  int getPriority();
+
+  /** @return the load sequence number */
+  int getLoadSequence();
+
+  /** @return the configuration */
+  Configuration getConfiguration();
+
+  /**
+   * @return an interface for accessing the given table
+   * @throws IOException
+   */
+  HTableInterface getTable(String tableName) throws IOException;
+
+  /**
+   * @return an interface for accessing the given table using the passed executor to run
batch
+   *         operations
+   * @throws IOException
+   */
+  HTableInterface getTable(String tableName, ExecutorService service) throws IOException;
+
+  /**
+   * @return the classloader for the loaded coprocessor instance
+   */
+  ClassLoader getClassLoader();
+}



Mime
View raw message