View Javadoc

1   /**
2    * Copyright 2011 The Apache Software Foundation
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  package org.apache.hadoop.hbase.security.access;
21  
22  import org.apache.hadoop.hbase.ipc.CoprocessorProtocol;
23  import org.apache.hadoop.hbase.security.TokenInfo;
24  import org.apache.hadoop.hbase.util.Pair;
25  import org.apache.hadoop.security.token.Token;
26  
27  import java.io.IOException;
28  import java.util.List;
29  
30  /**
31   * Provides a secure way to bulk load data onto HBase
32   * These are internal API. Bulk load should be initiated
33   * via {@link org.apache.hadoop.hbase.mapreduce.LoadIncrementalHFiles}
34   * with security enabled.
35   */
36  @TokenInfo("HBASE_AUTH_TOKEN")
37  public interface SecureBulkLoadProtocol extends CoprocessorProtocol {
38  
39    /**
40     * Prepare for bulk load.
41     * Will be called before bulkLoadHFiles()
42     * @param tableName
43     * @return a bulkToken which uniquely identifies the bulk session
44     * @throws IOException
45     */
46    String prepareBulkLoad(byte[] tableName) throws IOException;
47  
48    /**
49     * Cleanup after bulk load.
50     * Will be called after bulkLoadHFiles().
51     * @param bulkToken
52     * @throws IOException
53     */
54    void cleanupBulkLoad(String bulkToken) throws IOException;
55  
56    /**
57     * Secure version of HRegionServer.bulkLoadHFiles().
58     * @param familyPaths column family to HFile path pairs
59     * @param userToken requesting user's HDFS delegation token
60     * @param bulkToken
61     * @return
62     * @throws IOException
63     */
64    boolean bulkLoadHFiles(List<Pair<byte[], String>> familyPaths,
65                           Token<?> userToken, String bulkToken) throws IOException;
66  
67  }