blob: 6c5050b76b5073e9e66a19a3020c5bf0d0f61d0b [file] [log] [blame]
<!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>
<link rel="canonical" href="https://ignite.apache.org/releases/1.9.0/dotnetdoc/interface_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_i_affinity_function.html" />
<META NAME="ROBOTS" CONTENT="NOINDEX">
<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.9.1"/>
<title>Apache Ignite.NET: Apache.Ignite.Core.Cache.Affinity.IAffinityFunction Interface 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">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-61232409-1', 'auto');
ga('send', 'pageview');
</script></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="projectlogo"><img alt="Logo" src="ignite_logo.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Apache Ignite.NET
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
</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">
$(document).ready(function(){initNavTree('interface_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_i_affinity_function.html','');});
</script>
<div id="doc-content">
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#properties">Properties</a> &#124;
<a href="interface_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_i_affinity_function-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">Apache.Ignite.Core.Cache.Affinity.IAffinityFunction Interface Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Represents a function that maps cache keys to cluster nodes.
<a href="interface_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_i_affinity_function.html#details">More...</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:ab925b9d86321a855499acb36f5d734eb"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_i_affinity_function.html#ab925b9d86321a855499acb36f5d734eb">GetPartition</a> (object key)</td></tr>
<tr class="memdesc:ab925b9d86321a855499acb36f5d734eb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets partition number for a given key starting from 0. Partitioned caches should make sure that keys are about evenly distributed across all partitions from 0 to <a class="el" href="interface_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_i_affinity_function.html#a35d160ca20050641171048473746306f" title="Gets the total number of partitions. ">Partitions</a> for best performance. <a href="#ab925b9d86321a855499acb36f5d734eb">More...</a><br /></td></tr>
<tr class="separator:ab925b9d86321a855499acb36f5d734eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad72080a914f72e057787487b6d02ed24"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_i_affinity_function.html#ad72080a914f72e057787487b6d02ed24">RemoveNode</a> (Guid nodeId)</td></tr>
<tr class="memdesc:ad72080a914f72e057787487b6d02ed24"><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes node from affinity. This method is called when it is safe to remove disconnected node from affinity mapping. <a href="#ad72080a914f72e057787487b6d02ed24">More...</a><br /></td></tr>
<tr class="separator:ad72080a914f72e057787487b6d02ed24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6c72007bd20c58de58c8a194fbbc690f"><td class="memItemLeft" align="right" valign="top">IEnumerable&lt; IEnumerable&lt; <a class="el" href="interface_apache_1_1_ignite_1_1_core_1_1_cluster_1_1_i_cluster_node.html">IClusterNode</a> &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_i_affinity_function.html#a6c72007bd20c58de58c8a194fbbc690f">AssignPartitions</a> (<a class="el" href="class_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_affinity_function_context.html">AffinityFunctionContext</a> context)</td></tr>
<tr class="memdesc:a6c72007bd20c58de58c8a194fbbc690f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets affinity nodes for a partition. In case of replicated cache, all returned nodes are updated in the same manner. In case of partitioned cache, the returned list should contain only the primary and back up nodes with primary node being always first. &lt;pare&gt; Note that partitioned affinity must obey the following contract: given that node <a href="#a6c72007bd20c58de58c8a194fbbc690f">More...</a><br /></td></tr>
<tr class="separator:a6c72007bd20c58de58c8a194fbbc690f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="properties"></a>
Properties</h2></td></tr>
<tr class="memitem:a35d160ca20050641171048473746306f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="interface_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_i_affinity_function.html#a35d160ca20050641171048473746306f">Partitions</a><code> [get]</code></td></tr>
<tr class="memdesc:a35d160ca20050641171048473746306f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the total number of partitions. <a href="#a35d160ca20050641171048473746306f">More...</a><br /></td></tr>
<tr class="separator:a35d160ca20050641171048473746306f"><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>Predefined implementations: RendezvousAffinityFunction, FairAffinityFunction. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a6c72007bd20c58de58c8a194fbbc690f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">IEnumerable&lt;IEnumerable&lt;<a class="el" href="interface_apache_1_1_ignite_1_1_core_1_1_cluster_1_1_i_cluster_node.html">IClusterNode</a>&gt; &gt; Apache.Ignite.Core.Cache.Affinity.IAffinityFunction.AssignPartitions </td>
<td>(</td>
<td class="paramtype"><a class="el" href="class_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_affinity_function_context.html">AffinityFunctionContext</a>&#160;</td>
<td class="paramname"><em>context</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p><code>N</code> is primary for some key <code>K</code>, if any other node(s) leave grid and no node joins grid, node <code>N</code> will remain primary for key <code>K</code>. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">context</td><td>The affinity function context.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>A collection of partitions, where each partition is a collection of nodes, where first node is a primary node, and other nodes are backup nodes. </dd></dl>
</div>
</div>
<a class="anchor" id="ab925b9d86321a855499acb36f5d734eb"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int Apache.Ignite.Core.Cache.Affinity.IAffinityFunction.GetPartition </td>
<td>(</td>
<td class="paramtype">object&#160;</td>
<td class="paramname"><em>key</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Note that for fully replicated caches it is possible to segment key sets among different grid node groups. In that case each node group should return a unique partition number. However, unlike partitioned cache, mappings of keys to nodes in replicated caches are constant and a node cannot migrate from one partition to another. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">key</td><td>Key to get partition for.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Partition number for a given key.</dd></dl>
</div>
</div>
<a class="anchor" id="ad72080a914f72e057787487b6d02ed24"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Apache.Ignite.Core.Cache.Affinity.IAffinityFunction.RemoveNode </td>
<td>(</td>
<td class="paramtype">Guid&#160;</td>
<td class="paramname"><em>nodeId</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">nodeId</td><td>The node identifier.</td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2 class="groupheader">Property Documentation</h2>
<a class="anchor" id="a35d160ca20050641171048473746306f"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int Apache.Ignite.Core.Cache.Affinity.IAffinityFunction.Partitions</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">get</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>All caches should always provide correct partition count which should be the same on all participating nodes. Note that partitions should always be numbered from 0 inclusively to N exclusively without any gaps. </p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="namespace_apache.html">Apache</a></li><li class="navelem"><a class="el" href="namespace_apache_1_1_ignite.html">Ignite</a></li><li class="navelem"><a class="el" href="namespace_apache_1_1_ignite_1_1_core.html">Core</a></li><li class="navelem"><a class="el" href="namespace_apache_1_1_ignite_1_1_core_1_1_cache.html">Cache</a></li><li class="navelem"><a class="el" href="namespace_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity.html">Affinity</a></li><li class="navelem"><a class="el" href="interface_apache_1_1_ignite_1_1_core_1_1_cache_1_1_affinity_1_1_i_affinity_function.html">IAffinityFunction</a></li>
<li class="footer">Generated on Thu Mar 2 2017 17:22:55 for Apache Ignite.NET by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.9.1 </li>
</ul>
</div>
</body>
</html>