blob: df7915a32717ad7ba30e875005a92064d1d97ff5 [file] [log] [blame]
<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Kudu C++ client API: include/kudu/client/write_op.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.6.1 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<img id="MSearchSelect" src="search/search.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</div>
</li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul>
</div>
<h1>include/kudu/client/write_op.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Licensed to the Apache Software Foundation (ASF) under one</span>
<a name="l00002"></a>00002 <span class="comment">// or more contributor license agreements. See the NOTICE file</span>
<a name="l00003"></a>00003 <span class="comment">// distributed with this work for additional information</span>
<a name="l00004"></a>00004 <span class="comment">// regarding copyright ownership. The ASF licenses this file</span>
<a name="l00005"></a>00005 <span class="comment">// to you under the Apache License, Version 2.0 (the</span>
<a name="l00006"></a>00006 <span class="comment">// &quot;License&quot;); you may not use this file except in compliance</span>
<a name="l00007"></a>00007 <span class="comment">// with the License. You may obtain a copy of the License at</span>
<a name="l00008"></a>00008 <span class="comment">//</span>
<a name="l00009"></a>00009 <span class="comment">// http://www.apache.org/licenses/LICENSE-2.0</span>
<a name="l00010"></a>00010 <span class="comment">//</span>
<a name="l00011"></a>00011 <span class="comment">// Unless required by applicable law or agreed to in writing,</span>
<a name="l00012"></a>00012 <span class="comment">// software distributed under the License is distributed on an</span>
<a name="l00013"></a>00013 <span class="comment">// &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</span>
<a name="l00014"></a>00014 <span class="comment">// KIND, either express or implied. See the License for the</span>
<a name="l00015"></a>00015 <span class="comment">// specific language governing permissions and limitations</span>
<a name="l00016"></a>00016 <span class="comment">// under the License.</span>
<a name="l00017"></a>00017 <span class="preprocessor">#ifndef KUDU_CLIENT_WRITE_OP_H</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span><span class="preprocessor">#define KUDU_CLIENT_WRITE_OP_H</span>
<a name="l00019"></a>00019 <span class="preprocessor"></span>
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00021"></a>00021
<a name="l00022"></a>00022 <span class="preprocessor">#include &quot;<a class="code" href="shared__ptr_8h.html" title="Smart pointer typedefs for externally-faced code.">kudu/client/shared_ptr.h</a>&quot;</span>
<a name="l00023"></a>00023 <span class="preprocessor">#include &quot;kudu/common/partial_row.h&quot;</span>
<a name="l00024"></a>00024 <span class="preprocessor">#include &quot;kudu/util/kudu_export.h&quot;</span>
<a name="l00025"></a>00025
<a name="l00026"></a>00026 <span class="keyword">namespace </span>kudu {
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <span class="keyword">class </span>EncodedKey;
<a name="l00029"></a>00029
<a name="l00030"></a>00030 <span class="keyword">namespace </span>client {
<a name="l00031"></a>00031
<a name="l00032"></a>00032 <span class="keyword">namespace </span>internal {
<a name="l00033"></a>00033 <span class="keyword">class </span>Batcher;
<a name="l00034"></a>00034 <span class="keyword">class </span>WriteRpc;
<a name="l00035"></a>00035 } <span class="comment">// namespace internal</span>
<a name="l00036"></a>00036
<a name="l00037"></a>00037 <span class="keyword">class </span>KuduTable;
<a name="l00038"></a>00038
<a name="l00055"></a><a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html">00055</a> <span class="keyword">class </span>KUDU_EXPORT <a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html" title="A single-row write operation to be sent to a Kudu table.">KuduWriteOperation</a> {
<a name="l00056"></a>00056 <span class="keyword">public</span>:
<a name="l00058"></a><a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html#a87d94ee5801a6b16fc6d1f44ee2e4357">00058</a> <span class="keyword">enum</span> <a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html#a87d94ee5801a6b16fc6d1f44ee2e4357" title="Write operation types.">Type</a> {
<a name="l00059"></a>00059 INSERT = 1,
<a name="l00060"></a>00060 UPDATE = 2,
<a name="l00061"></a>00061 DELETE = 3,
<a name="l00062"></a>00062 UPSERT = 4
<a name="l00063"></a>00063 };
<a name="l00064"></a>00064 <span class="keyword">virtual</span> ~<a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html" title="A single-row write operation to be sent to a Kudu table.">KuduWriteOperation</a>();
<a name="l00065"></a>00065
<a name="l00069"></a><a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html#a973b342ced786b23754b57fd83b34aa3">00069</a> <span class="keyword">const</span> <a class="code" href="classkudu_1_1KuduPartialRow.html" title="A row which may only contain values for a subset of the columns.">KuduPartialRow</a>&amp; <a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html#a973b342ced786b23754b57fd83b34aa3">row</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> row_; }
<a name="l00070"></a>00070
<a name="l00074"></a><a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html#a8889770ce62e2ca0ce5d55c9c90af6bc">00074</a> <a class="code" href="classkudu_1_1KuduPartialRow.html" title="A row which may only contain values for a subset of the columns.">KuduPartialRow</a>* <a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html#a8889770ce62e2ca0ce5d55c9c90af6bc">mutable_row</a>() { <span class="keywordflow">return</span> &amp;row_; }
<a name="l00075"></a>00075
<a name="l00077"></a>00077 <span class="keyword">virtual</span> std::string ToString() <span class="keyword">const</span> = 0;
<a name="l00078"></a>00078 <span class="keyword">protected</span>:
<a name="l00080"></a>00080
<a name="l00085"></a>00085 <span class="keyword">explicit</span> <a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html" title="A single-row write operation to be sent to a Kudu table.">KuduWriteOperation</a>(<span class="keyword">const</span> sp::shared_ptr&lt;KuduTable&gt;&amp; table);
<a name="l00086"></a>00086
<a name="l00088"></a>00088 <span class="keyword">virtual</span> Type type() <span class="keyword">const</span> = 0;
<a name="l00089"></a>00089
<a name="l00093"></a>00093 sp::shared_ptr&lt;KuduTable&gt; <span class="keyword">const</span> table_;
<a name="l00094"></a>00094
<a name="l00096"></a>00096 <a class="code" href="classkudu_1_1KuduPartialRow.html" title="A row which may only contain values for a subset of the columns.">KuduPartialRow</a> row_;
<a name="l00097"></a>00097
<a name="l00099"></a>00099
<a name="l00100"></a>00100 <span class="keyword">private</span>:
<a name="l00101"></a>00101 <span class="keyword">friend</span> <span class="keyword">class </span>internal::Batcher;
<a name="l00102"></a>00102 <span class="keyword">friend</span> <span class="keyword">class </span>internal::WriteRpc;
<a name="l00103"></a>00103
<a name="l00104"></a>00104 <span class="comment">// Create and encode the key for this write (key must be set)</span>
<a name="l00105"></a>00105 <span class="comment">//</span>
<a name="l00106"></a>00106 <span class="comment">// Caller takes ownership of the allocated memory.</span>
<a name="l00107"></a>00107 EncodedKey* CreateKey() <span class="keyword">const</span>;
<a name="l00108"></a>00108
<a name="l00109"></a>00109 <span class="keyword">const</span> <a class="code" href="classkudu_1_1client_1_1KuduTable.html" title="A representation of a table on a particular cluster.">KuduTable</a>* table()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> table_.get(); }
<a name="l00110"></a>00110
<a name="l00111"></a>00111 <span class="comment">// Return the number of bytes required to buffer this operation,</span>
<a name="l00112"></a>00112 <span class="comment">// including direct and indirect data. Once called, the result is cached</span>
<a name="l00113"></a>00113 <span class="comment">// so subsequent calls will return the size previously computed.</span>
<a name="l00114"></a>00114 int64_t SizeInBuffer() <span class="keyword">const</span>;
<a name="l00115"></a>00115
<a name="l00116"></a>00116 <span class="keyword">mutable</span> int64_t size_in_buffer_;
<a name="l00117"></a>00117
<a name="l00118"></a>00118 DISALLOW_COPY_AND_ASSIGN(KuduWriteOperation);
<a name="l00119"></a>00119 };
<a name="l00120"></a>00120
<a name="l00121"></a>00121
<a name="l00126"></a><a class="code" href="classkudu_1_1client_1_1KuduInsert.html">00126</a> <span class="keyword">class </span>KUDU_EXPORT <a class="code" href="classkudu_1_1client_1_1KuduInsert.html" title="A single row insert to be sent to the cluster.">KuduInsert</a> : <span class="keyword">public</span> <a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html" title="A single-row write operation to be sent to a Kudu table.">KuduWriteOperation</a> {
<a name="l00127"></a>00127 <span class="keyword">public</span>:
<a name="l00128"></a>00128 <span class="keyword">virtual</span> ~<a class="code" href="classkudu_1_1client_1_1KuduInsert.html" title="A single row insert to be sent to the cluster.">KuduInsert</a>();
<a name="l00129"></a>00129
<a name="l00131"></a><a class="code" href="classkudu_1_1client_1_1KuduInsert.html#a7c0fb45a5bfa96574b6328be392ba240">00131</a> <span class="keyword">virtual</span> std::string <a class="code" href="classkudu_1_1client_1_1KuduInsert.html#a7c0fb45a5bfa96574b6328be392ba240">ToString</a>() const OVERRIDE { <span class="keywordflow">return</span> <span class="stringliteral">&quot;INSERT &quot;</span> + row_.ToString(); }
<a name="l00132"></a>00132
<a name="l00133"></a>00133 <span class="keyword">protected</span>:
<a name="l00135"></a>00135
<a name="l00137"></a>00137 <span class="keyword">virtual</span> Type type() const OVERRIDE {
<a name="l00138"></a>00138 <span class="keywordflow">return</span> INSERT;
<a name="l00139"></a>00139 }
<a name="l00140"></a>00140
<a name="l00142"></a>00142
<a name="l00143"></a>00143 <span class="keyword">private</span>:
<a name="l00144"></a>00144 <span class="keyword">friend</span> <span class="keyword">class </span>KuduTable;
<a name="l00145"></a>00145 <span class="keyword">explicit</span> KuduInsert(<span class="keyword">const</span> sp::shared_ptr&lt;KuduTable&gt;&amp; table);
<a name="l00146"></a>00146 };
<a name="l00147"></a>00147
<a name="l00151"></a><a class="code" href="classkudu_1_1client_1_1KuduUpsert.html">00151</a> <span class="keyword">class </span>KUDU_EXPORT <a class="code" href="classkudu_1_1client_1_1KuduUpsert.html" title="A single row upsert to be sent to the cluster.">KuduUpsert</a> : <span class="keyword">public</span> <a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html" title="A single-row write operation to be sent to a Kudu table.">KuduWriteOperation</a> {
<a name="l00152"></a>00152 <span class="keyword">public</span>:
<a name="l00153"></a>00153 <span class="keyword">virtual</span> ~<a class="code" href="classkudu_1_1client_1_1KuduUpsert.html" title="A single row upsert to be sent to the cluster.">KuduUpsert</a>();
<a name="l00154"></a>00154
<a name="l00156"></a><a class="code" href="classkudu_1_1client_1_1KuduUpsert.html#a0608280ef5b4eb2a53c0b303db7401c8">00156</a> <span class="keyword">virtual</span> std::string <a class="code" href="classkudu_1_1client_1_1KuduUpsert.html#a0608280ef5b4eb2a53c0b303db7401c8">ToString</a>() const OVERRIDE { <span class="keywordflow">return</span> <span class="stringliteral">&quot;UPSERT &quot;</span> + row_.ToString(); }
<a name="l00157"></a>00157
<a name="l00158"></a>00158 <span class="keyword">protected</span>:
<a name="l00160"></a>00160
<a name="l00162"></a>00162 <span class="keyword">virtual</span> Type type() const OVERRIDE {
<a name="l00163"></a>00163 <span class="keywordflow">return</span> UPSERT;
<a name="l00164"></a>00164 }
<a name="l00165"></a>00165
<a name="l00167"></a>00167
<a name="l00168"></a>00168 <span class="keyword">private</span>:
<a name="l00169"></a>00169 <span class="keyword">friend</span> <span class="keyword">class </span>KuduTable;
<a name="l00170"></a>00170 <span class="keyword">explicit</span> KuduUpsert(<span class="keyword">const</span> sp::shared_ptr&lt;KuduTable&gt;&amp; table);
<a name="l00171"></a>00171 };
<a name="l00172"></a>00172
<a name="l00173"></a>00173
<a name="l00178"></a><a class="code" href="classkudu_1_1client_1_1KuduUpdate.html">00178</a> <span class="keyword">class </span>KUDU_EXPORT <a class="code" href="classkudu_1_1client_1_1KuduUpdate.html" title="A single row update to be sent to the cluster.">KuduUpdate</a> : <span class="keyword">public</span> <a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html" title="A single-row write operation to be sent to a Kudu table.">KuduWriteOperation</a> {
<a name="l00179"></a>00179 <span class="keyword">public</span>:
<a name="l00180"></a>00180 <span class="keyword">virtual</span> ~<a class="code" href="classkudu_1_1client_1_1KuduUpdate.html" title="A single row update to be sent to the cluster.">KuduUpdate</a>();
<a name="l00181"></a>00181
<a name="l00183"></a><a class="code" href="classkudu_1_1client_1_1KuduUpdate.html#af05d202ea529554b6d033d51ec942718">00183</a> <span class="keyword">virtual</span> std::string <a class="code" href="classkudu_1_1client_1_1KuduUpdate.html#af05d202ea529554b6d033d51ec942718">ToString</a>() const OVERRIDE { <span class="keywordflow">return</span> <span class="stringliteral">&quot;UPDATE &quot;</span> + row_.ToString(); }
<a name="l00184"></a>00184
<a name="l00185"></a>00185 <span class="keyword">protected</span>:
<a name="l00187"></a>00187
<a name="l00189"></a>00189 <span class="keyword">virtual</span> Type type() const OVERRIDE {
<a name="l00190"></a>00190 <span class="keywordflow">return</span> UPDATE;
<a name="l00191"></a>00191 }
<a name="l00192"></a>00192
<a name="l00194"></a>00194
<a name="l00195"></a>00195 <span class="keyword">private</span>:
<a name="l00196"></a>00196 <span class="keyword">friend</span> <span class="keyword">class </span>KuduTable;
<a name="l00197"></a>00197 <span class="keyword">explicit</span> KuduUpdate(<span class="keyword">const</span> sp::shared_ptr&lt;KuduTable&gt;&amp; table);
<a name="l00198"></a>00198 };
<a name="l00199"></a>00199
<a name="l00200"></a>00200
<a name="l00205"></a><a class="code" href="classkudu_1_1client_1_1KuduDelete.html">00205</a> <span class="keyword">class </span>KUDU_EXPORT <a class="code" href="classkudu_1_1client_1_1KuduDelete.html" title="A single row delete to be sent to the cluster.">KuduDelete</a> : <span class="keyword">public</span> <a class="code" href="classkudu_1_1client_1_1KuduWriteOperation.html" title="A single-row write operation to be sent to a Kudu table.">KuduWriteOperation</a> {
<a name="l00206"></a>00206 <span class="keyword">public</span>:
<a name="l00207"></a>00207 <span class="keyword">virtual</span> ~<a class="code" href="classkudu_1_1client_1_1KuduDelete.html" title="A single row delete to be sent to the cluster.">KuduDelete</a>();
<a name="l00208"></a>00208
<a name="l00210"></a><a class="code" href="classkudu_1_1client_1_1KuduDelete.html#a586dc46e1d10118465e3b834ac578de0">00210</a> <span class="keyword">virtual</span> std::string <a class="code" href="classkudu_1_1client_1_1KuduDelete.html#a586dc46e1d10118465e3b834ac578de0">ToString</a>() const OVERRIDE { <span class="keywordflow">return</span> <span class="stringliteral">&quot;DELETE &quot;</span> + row_.ToString(); }
<a name="l00211"></a>00211
<a name="l00212"></a>00212 <span class="keyword">protected</span>:
<a name="l00214"></a>00214
<a name="l00216"></a>00216 <span class="keyword">virtual</span> Type type() const OVERRIDE {
<a name="l00217"></a>00217 <span class="keywordflow">return</span> DELETE;
<a name="l00218"></a>00218 }
<a name="l00219"></a>00219
<a name="l00221"></a>00221
<a name="l00222"></a>00222 <span class="keyword">private</span>:
<a name="l00223"></a>00223 <span class="keyword">friend</span> <span class="keyword">class </span>KuduTable;
<a name="l00224"></a>00224 <span class="keyword">explicit</span> KuduDelete(<span class="keyword">const</span> sp::shared_ptr&lt;KuduTable&gt;&amp; table);
<a name="l00225"></a>00225 };
<a name="l00226"></a>00226
<a name="l00227"></a>00227 } <span class="comment">// namespace client</span>
<a name="l00228"></a>00228 } <span class="comment">// namespace kudu</span>
<a name="l00229"></a>00229
<a name="l00230"></a>00230 <span class="preprocessor">#endif</span>
</pre></div></div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&nbsp;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&nbsp;</span>Defines</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<!-- start footer part -->
<hr class="footer"/>
<address class="footer">
<small>Generated for Kudu version 1.0.1 on Tue Oct 11 08:52:01 2016 by Doxygen 1.6.1</small>
<br>
<small>Copyright © 2016 The Apache Software Foundation.</small>
</address>
</body>
</html>