Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 63D8C10A14 for ; Wed, 2 Apr 2014 20:49:57 +0000 (UTC) Received: (qmail 91096 invoked by uid 500); 2 Apr 2014 20:49:56 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 91026 invoked by uid 500); 2 Apr 2014 20:49:54 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 90888 invoked by uid 99); 2 Apr 2014 20:49:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2014 20:49:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Apr 2014 20:49:50 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6258C2388BCD; Wed, 2 Apr 2014 20:49:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@hbase.apache.org From: liyin@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140402204917.6258C2388BCD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(); +}