blob: 730a9f40b4e3206e6a0f2e8d3b3032002b1da12d [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>Source code</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="source: package: org.apache.hadoop.hbase.ipc, interface: RpcCallContext">
<meta name="generator" content="javadoc/SourceToHTMLConverter">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body class="source-page">
<main role="main">
<div class="source-container">
<pre><span class="source-line-no">001</span><span id="line-1">/*</span>
<span class="source-line-no">002</span><span id="line-2"> * Licensed to the Apache Software Foundation (ASF) under one</span>
<span class="source-line-no">003</span><span id="line-3"> * or more contributor license agreements. See the NOTICE file</span>
<span class="source-line-no">004</span><span id="line-4"> * distributed with this work for additional information</span>
<span class="source-line-no">005</span><span id="line-5"> * regarding copyright ownership. The ASF licenses this file</span>
<span class="source-line-no">006</span><span id="line-6"> * to you under the Apache License, Version 2.0 (the</span>
<span class="source-line-no">007</span><span id="line-7"> * "License"); you may not use this file except in compliance</span>
<span class="source-line-no">008</span><span id="line-8"> * with the License. You may obtain a copy of the License at</span>
<span class="source-line-no">009</span><span id="line-9"> *</span>
<span class="source-line-no">010</span><span id="line-10"> * http://www.apache.org/licenses/LICENSE-2.0</span>
<span class="source-line-no">011</span><span id="line-11"> *</span>
<span class="source-line-no">012</span><span id="line-12"> * Unless required by applicable law or agreed to in writing, software</span>
<span class="source-line-no">013</span><span id="line-13"> * distributed under the License is distributed on an "AS IS" BASIS,</span>
<span class="source-line-no">014</span><span id="line-14"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span>
<span class="source-line-no">015</span><span id="line-15"> * See the License for the specific language governing permissions and</span>
<span class="source-line-no">016</span><span id="line-16"> * limitations under the License.</span>
<span class="source-line-no">017</span><span id="line-17"> */</span>
<span class="source-line-no">018</span><span id="line-18">package org.apache.hadoop.hbase.ipc;</span>
<span class="source-line-no">019</span><span id="line-19"></span>
<span class="source-line-no">020</span><span id="line-20">import java.net.InetAddress;</span>
<span class="source-line-no">021</span><span id="line-21">import java.security.cert.X509Certificate;</span>
<span class="source-line-no">022</span><span id="line-22">import java.util.Optional;</span>
<span class="source-line-no">023</span><span id="line-23">import org.apache.hadoop.hbase.security.User;</span>
<span class="source-line-no">024</span><span id="line-24">import org.apache.yetus.audience.InterfaceAudience;</span>
<span class="source-line-no">025</span><span id="line-25"></span>
<span class="source-line-no">026</span><span id="line-26">import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.VersionInfo;</span>
<span class="source-line-no">027</span><span id="line-27"></span>
<span class="source-line-no">028</span><span id="line-28">/**</span>
<span class="source-line-no">029</span><span id="line-29"> * Interface of all necessary to carry out a RPC service invocation on the server. This interface</span>
<span class="source-line-no">030</span><span id="line-30"> * focus on the information needed or obtained during the actual execution of the service method.</span>
<span class="source-line-no">031</span><span id="line-31"> */</span>
<span class="source-line-no">032</span><span id="line-32">@InterfaceAudience.Private</span>
<span class="source-line-no">033</span><span id="line-33">public interface RpcCallContext {</span>
<span class="source-line-no">034</span><span id="line-34"> /**</span>
<span class="source-line-no">035</span><span id="line-35"> * Check if the caller who made this IPC call has disconnected. If called from outside the context</span>
<span class="source-line-no">036</span><span id="line-36"> * of IPC, this does nothing.</span>
<span class="source-line-no">037</span><span id="line-37"> * @return &amp;lt; 0 if the caller is still connected. The time in ms since the disconnection</span>
<span class="source-line-no">038</span><span id="line-38"> * otherwise</span>
<span class="source-line-no">039</span><span id="line-39"> */</span>
<span class="source-line-no">040</span><span id="line-40"> long disconnectSince();</span>
<span class="source-line-no">041</span><span id="line-41"></span>
<span class="source-line-no">042</span><span id="line-42"> /**</span>
<span class="source-line-no">043</span><span id="line-43"> * If the client connected and specified a codec to use, then we will use this codec making</span>
<span class="source-line-no">044</span><span id="line-44"> * cellblocks to return. If the client did not specify a codec, we assume it does not support</span>
<span class="source-line-no">045</span><span id="line-45"> * cellblocks and will return all content protobuf'd (though it makes our serving slower). We need</span>
<span class="source-line-no">046</span><span id="line-46"> * to ask this question per call because a server could be hosting both clients that support</span>
<span class="source-line-no">047</span><span id="line-47"> * cellblocks while fielding requests from clients that do not.</span>
<span class="source-line-no">048</span><span id="line-48"> * @return True if the client supports cellblocks, else return all content in pb</span>
<span class="source-line-no">049</span><span id="line-49"> */</span>
<span class="source-line-no">050</span><span id="line-50"> boolean isClientCellBlockSupported();</span>
<span class="source-line-no">051</span><span id="line-51"></span>
<span class="source-line-no">052</span><span id="line-52"> /**</span>
<span class="source-line-no">053</span><span id="line-53"> * Returns the user credentials associated with the current RPC request or not present if no</span>
<span class="source-line-no">054</span><span id="line-54"> * credentials were provided.</span>
<span class="source-line-no">055</span><span id="line-55"> * @return A User</span>
<span class="source-line-no">056</span><span id="line-56"> */</span>
<span class="source-line-no">057</span><span id="line-57"> Optional&lt;User&gt; getRequestUser();</span>
<span class="source-line-no">058</span><span id="line-58"></span>
<span class="source-line-no">059</span><span id="line-59"> /** Returns Current request's user name or not present if none ongoing. */</span>
<span class="source-line-no">060</span><span id="line-60"> default Optional&lt;String&gt; getRequestUserName() {</span>
<span class="source-line-no">061</span><span id="line-61"> return getRequestUser().map(User::getShortName);</span>
<span class="source-line-no">062</span><span id="line-62"> }</span>
<span class="source-line-no">063</span><span id="line-63"></span>
<span class="source-line-no">064</span><span id="line-64"> /**</span>
<span class="source-line-no">065</span><span id="line-65"> * Returns the TLS certificate(s) that the client presented to this HBase server when making its</span>
<span class="source-line-no">066</span><span id="line-66"> * connection. TLS is orthogonal to Kerberos, so this is unrelated to</span>
<span class="source-line-no">067</span><span id="line-67"> * {@link RpcCallContext#getRequestUser()}. Both, one, or neither may be present.</span>
<span class="source-line-no">068</span><span id="line-68"> */</span>
<span class="source-line-no">069</span><span id="line-69"> Optional&lt;X509Certificate[]&gt; getClientCertificateChain();</span>
<span class="source-line-no">070</span><span id="line-70"></span>
<span class="source-line-no">071</span><span id="line-71"> /** Returns Address of remote client in this call */</span>
<span class="source-line-no">072</span><span id="line-72"> InetAddress getRemoteAddress();</span>
<span class="source-line-no">073</span><span id="line-73"></span>
<span class="source-line-no">074</span><span id="line-74"> /** Returns the client version info, or null if the information is not present */</span>
<span class="source-line-no">075</span><span id="line-75"> VersionInfo getClientVersionInfo();</span>
<span class="source-line-no">076</span><span id="line-76"></span>
<span class="source-line-no">077</span><span id="line-77"> /**</span>
<span class="source-line-no">078</span><span id="line-78"> * Sets a callback which has to be executed at the end of this RPC call. Such a callback is an</span>
<span class="source-line-no">079</span><span id="line-79"> * optional one for any Rpc call.</span>
<span class="source-line-no">080</span><span id="line-80"> */</span>
<span class="source-line-no">081</span><span id="line-81"> void setCallBack(RpcCallback callback);</span>
<span class="source-line-no">082</span><span id="line-82"></span>
<span class="source-line-no">083</span><span id="line-83"> boolean isRetryImmediatelySupported();</span>
<span class="source-line-no">084</span><span id="line-84"></span>
<span class="source-line-no">085</span><span id="line-85"> /**</span>
<span class="source-line-no">086</span><span id="line-86"> * The size of response cells that have been accumulated so far. This along with the corresponding</span>
<span class="source-line-no">087</span><span id="line-87"> * increment call is used to ensure that multi's or scans dont get too excessively large</span>
<span class="source-line-no">088</span><span id="line-88"> */</span>
<span class="source-line-no">089</span><span id="line-89"> long getResponseCellSize();</span>
<span class="source-line-no">090</span><span id="line-90"></span>
<span class="source-line-no">091</span><span id="line-91"> /**</span>
<span class="source-line-no">092</span><span id="line-92"> * Add on the given amount to the retained cell size. This is not thread safe and not synchronized</span>
<span class="source-line-no">093</span><span id="line-93"> * at all. If this is used by more than one thread then everything will break. Since this is</span>
<span class="source-line-no">094</span><span id="line-94"> * called for every row synchronization would be too onerous.</span>
<span class="source-line-no">095</span><span id="line-95"> */</span>
<span class="source-line-no">096</span><span id="line-96"> void incrementResponseCellSize(long cellSize);</span>
<span class="source-line-no">097</span><span id="line-97"></span>
<span class="source-line-no">098</span><span id="line-98"> /**</span>
<span class="source-line-no">099</span><span id="line-99"> * Get the number of block bytes scanned by the current call. In order to serve a response, 1 or</span>
<span class="source-line-no">100</span><span id="line-100"> * more lower level blocks must be loaded (from disk or cache) and scanned for the requested</span>
<span class="source-line-no">101</span><span id="line-101"> * cells. This value includes the total block size for each block loaded for the request.</span>
<span class="source-line-no">102</span><span id="line-102"> */</span>
<span class="source-line-no">103</span><span id="line-103"> long getBlockBytesScanned();</span>
<span class="source-line-no">104</span><span id="line-104"></span>
<span class="source-line-no">105</span><span id="line-105"> /**</span>
<span class="source-line-no">106</span><span id="line-106"> * Increment the number of block bytes scanned by the current call. See</span>
<span class="source-line-no">107</span><span id="line-107"> * {@link #getBlockBytesScanned()} for details.</span>
<span class="source-line-no">108</span><span id="line-108"> */</span>
<span class="source-line-no">109</span><span id="line-109"> void incrementBlockBytesScanned(long blockSize);</span>
<span class="source-line-no">110</span><span id="line-110"></span>
<span class="source-line-no">111</span><span id="line-111"> long getResponseExceptionSize();</span>
<span class="source-line-no">112</span><span id="line-112"></span>
<span class="source-line-no">113</span><span id="line-113"> void incrementResponseExceptionSize(long exceptionSize);</span>
<span class="source-line-no">114</span><span id="line-114">}</span>
</pre>
</div>
</main>
</body>
</html>