Search Results for

    Show / Hide Table of Contents

    Class AffinityFunctionBase

    Base class for predefined affinity functions.

    Inheritance
    System.Object
    AffinityFunctionBase
    RendezvousAffinityFunction
    Implements
    IAffinityFunction
    Namespace: Apache.Ignite.Core.Cache.Affinity
    Assembly: Apache.Ignite.Core.dll
    Syntax
    public abstract class AffinityFunctionBase : object, IAffinityFunction

    Fields

    DefaultPartitions

    The default value for Partitions property.

    Declaration
    public const int DefaultPartitions = null
    Field Value
    Type Description
    System.Int32

    Properties

    ExcludeNeighbors

    Gets or sets a value indicating whether to exclude same-host-neighbors from being backups of each other.

    Declaration
    public virtual bool ExcludeNeighbors { get; set; }
    Property Value
    Type Description
    System.Boolean

    Partitions

    Gets or sets the total number of partitions.

    Declaration
    public virtual int Partitions { get; set; }
    Property Value
    Type Description
    System.Int32

    Methods

    AssignPartitions(AffinityFunctionContext)

    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. Note that partitioned affinity must obey the following contract: given that node

    N
    is primary for some key
    K
    , if any other node(s) leave

    grid and no node joins grid, node

    N
    will remain primary for key
    K
    .

    Declaration
    public virtual IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
    Parameters
    Type Name Description
    AffinityFunctionContext context

    The affinity function context.

    Returns
    Type Description
    IEnumerable<IEnumerable<IClusterNode>>

    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.

    GetPartition(Object)

    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 Partitions for best performance.

    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.

    Declaration
    public virtual int GetPartition(object key)
    Parameters
    Type Name Description
    System.Object key

    Key to get partition for.

    Returns
    Type Description
    System.Int32

    Partition number for a given key.

    RemoveNode(Guid)

    Removes node from affinity. This method is called when it is safe to remove disconnected node from affinity mapping.

    Declaration
    public virtual void RemoveNode(Guid nodeId)
    Parameters
    Type Name Description
    Guid nodeId

    The node identifier.

    Implements

    IAffinityFunction
    In This Article
    Back to top © 2015 - 2019 The Apache Software Foundation