blob: c6f94fd40760be4aadd8cd30ac0c948fa4ced5cc [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Apache Geode Native C++ Reference: apache::geode::client::PartitionResolver Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Apache Geode Native C++ Reference
&#160;<span id="projectnumber">1.13.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a00747.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> </div>
<div class="headertitle">
<div class="title">apache::geode::client::PartitionResolver Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
</div><!--header-->
<div class="contents">
<p>Implement the <code><a class="el" href="a00747.html" title="Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.">PartitionResolver</a></code> interface to enable custom partitioning on the <code>PartitionedRegion</code>.
<a href="a00747.html#details">More...</a></p>
<p>Inherited by <a class="el" href="a00735.html">apache::geode::client::FixedPartitionResolver</a>.</p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a68793ed428ca0d18ed5aad5bb8e00bf3"><td class="memItemLeft" align="right" valign="top">virtual const std::string &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00747.html#a68793ed428ca0d18ed5aad5bb8e00bf3">getName</a> ()</td></tr>
<tr class="memdesc:a68793ed428ca0d18ed5aad5bb8e00bf3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the name of the <a class="el" href="a00747.html" title="Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.">PartitionResolver</a>. <a href="#a68793ed428ca0d18ed5aad5bb8e00bf3">More...</a><br /></td></tr>
<tr class="separator:a68793ed428ca0d18ed5aad5bb8e00bf3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6492385156922aca28af866905e5f554"><td class="memItemLeft" align="right" valign="top">virtual std::shared_ptr&lt; <a class="el" href="a00339.html">CacheableKey</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00747.html#a6492385156922aca28af866905e5f554">getRoutingObject</a> (const <a class="el" href="a00459.html">EntryEvent</a> &amp;opDetails)=0</td></tr>
<tr class="separator:a6492385156922aca28af866905e5f554"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8c4eac0ea8435f6e28ef2417e0b2cdd9"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00747.html#a8c4eac0ea8435f6e28ef2417e0b2cdd9">~PartitionResolver</a> ()</td></tr>
<tr class="memdesc:a8c4eac0ea8435f6e28ef2417e0b2cdd9"><td class="mdescLeft">&#160;</td><td class="mdescRight">public methods <a href="#a8c4eac0ea8435f6e28ef2417e0b2cdd9">More...</a><br /></td></tr>
<tr class="separator:a8c4eac0ea8435f6e28ef2417e0b2cdd9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:af201d1ddf3ff2a89924a108e047657ec"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00747.html#af201d1ddf3ff2a89924a108e047657ec">PartitionResolver</a> ()</td></tr>
<tr class="memdesc:af201d1ddf3ff2a89924a108e047657ec"><td class="mdescLeft">&#160;</td><td class="mdescRight">constructors <a href="#af201d1ddf3ff2a89924a108e047657ec">More...</a><br /></td></tr>
<tr class="separator:af201d1ddf3ff2a89924a108e047657ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Implement the <code><a class="el" href="a00747.html" title="Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.">PartitionResolver</a></code> interface to enable custom partitioning on the <code>PartitionedRegion</code>. </p>
<p>The Key class or callback arg can implement the <a class="el" href="a00747.html" title="Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.">PartitionResolver</a> interface to enable custom partitioning, or you can configure your own <a class="el" href="a00747.html" title="Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.">PartitionResolver</a> class in partition attributes (for instance when the Key is a primitive type or String):</p><ul>
<li>Implement the appropriate equals. For all implementations, you need to be sure to code the class equals method so it properly verifies equality for the <a class="el" href="a00747.html" title="Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.">PartitionResolver</a> implementation. This might mean verifying that class names are the same or that the returned routing objects are the same etc. When you initiate the partitioned region on multiple nodes, Geode uses the equals method to ensure you are using the same <a class="el" href="a00747.html" title="Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.">PartitionResolver</a> implementation for all of the nodes for the region.</li>
<li>Geode uses the routing object's hashCode to determine where the data is being managed. Say, for example, you want to colocate all Trades by month and year. The key is implemented by a TradeKey class which also implements the <a class="el" href="a00747.html" title="Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.">PartitionResolver</a> interface:</li>
</ul>
<div class="fragment"><div class="line"><span class="keyword">public</span> <span class="keyword">class </span>TradeKey <span class="keyword">implements</span> <a class="code" href="a00747.html#af201d1ddf3ff2a89924a108e047657ec">PartitionResolver</a> {</div><div class="line"> <span class="keyword">private</span> String tradeID;</div><div class="line"> <span class="keyword">private</span> Month month;</div><div class="line"> <span class="keyword">private</span> Year year;</div><div class="line"></div><div class="line"> <span class="keyword">public</span> TradingKey() { }</div><div class="line"> <span class="keyword">public</span> TradingKey(Month month, Year year) {</div><div class="line"> this.month = month;</div><div class="line"> this.year = year;</div><div class="line"> }</div><div class="line"> <span class="keyword">public</span> Serializable <a class="code" href="a00747.html#a6492385156922aca28af866905e5f554">getRoutingObject</a>(EntryOperation opDetails) {</div><div class="line"> <span class="keywordflow">return</span> this.month + this.year;</div><div class="line"> }</div><div class="line">}</div></div><!-- fragment --><p>In the example above, all trade entries with the same month and year are guaranteed to be colocated. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a8c4eac0ea8435f6e28ef2417e0b2cdd9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8c4eac0ea8435f6e28ef2417e0b2cdd9">&#9670;&nbsp;</a></span>~PartitionResolver()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual apache::geode::client::PartitionResolver::~PartitionResolver </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>public methods </p>
<p>destructor </p>
</div>
</div>
<a id="af201d1ddf3ff2a89924a108e047657ec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af201d1ddf3ff2a89924a108e047657ec">&#9670;&nbsp;</a></span>PartitionResolver()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">apache::geode::client::PartitionResolver::PartitionResolver </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>constructors </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a68793ed428ca0d18ed5aad5bb8e00bf3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a68793ed428ca0d18ed5aad5bb8e00bf3">&#9670;&nbsp;</a></span>getName()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual const std::string&amp; apache::geode::client::PartitionResolver::getName </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the name of the <a class="el" href="a00747.html" title="Implement the PartitionResolver interface to enable custom partitioning on the PartitionedRegion.">PartitionResolver</a>. </p>
<dl class="section return"><dt>Returns</dt><dd>String name </dd></dl>
</div>
</div>
<a id="a6492385156922aca28af866905e5f554"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6492385156922aca28af866905e5f554">&#9670;&nbsp;</a></span>getRoutingObject()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">virtual std::shared_ptr&lt;<a class="el" href="a00339.html">CacheableKey</a>&gt; apache::geode::client::PartitionResolver::getRoutingObject </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="a00459.html">EntryEvent</a> &amp;&#160;</td>
<td class="paramname"><em>opDetails</em></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">opDetails</td><td>the detail of the entry event </td></tr>
</table>
</dd>
</dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname">RuntimeException</td><td>- any exception thrown will terminate the operation and the exception will be passed to the calling thread. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>object associated with entry event which allows the Partitioned <a class="el" href="a00815.html" title="This class manages subregions and cached data.">Region</a> to store associated data together </dd></dl>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<HR><address style="align: right;"><small>Apache Geode C++ Cache API Documentation</small></address>