View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.hadoop.hbase.ipc;
19  
20  import java.net.InetAddress;
21  
22  import org.apache.hadoop.hbase.security.User;
23  
24  import org.apache.hadoop.hbase.protobuf.generated.RPCProtos.VersionInfo;
25  
26  public interface RpcCallContext extends Delayable {
27    /**
28     * Check if the caller who made this IPC call has disconnected.
29     * If called from outside the context of IPC, this does nothing.
30     * @return < 0 if the caller is still connected. The time in ms
31     *  since the disconnection otherwise
32     */
33    long disconnectSince();
34  
35    /**
36     * If the client connected and specified a codec to use, then we will use this codec making
37     * cellblocks to return.  If the client did not specify a codec, we assume it does not support
38     * cellblocks and will return all content protobuf'd (though it makes our serving slower).
39     * We need to ask this question per call because a server could be hosting both clients that
40     * support cellblocks while fielding requests from clients that do not.
41     * @return True if the client supports cellblocks, else return all content in pb
42     */
43    boolean isClientCellBlockSupport();
44  
45    /**
46     * Returns the user credentials associated with the current RPC request or
47     * <code>null</code> if no credentials were provided.
48     * @return A User
49     */
50    User getRequestUser();
51  
52    /**
53     * @return Current request's user name or null if none ongoing.
54     */
55    String getRequestUserName();
56  
57    /**
58     * @return Address of remote client if a request is ongoing, else null
59     */
60    InetAddress getRemoteAddress();
61  
62    /**
63     * @return the client version info, or null if the information is not present
64     */
65    VersionInfo getClientVersionInfo();
66  }