public class PlatformDotNetAffinityFunction extends Object implements AffinityFunction, Externalizable, LifecycleAware
Constructor and Description |
---|
PlatformDotNetAffinityFunction() |
Modifier and Type | Method and Description |
---|---|
List<List<ClusterNode>> |
assignPartitions(AffinityFunctionContext affCtx)
Gets affinity nodes for a partition.
|
org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction |
getFunc()
Gets the inner func.
|
Map<String,?> |
getProperties()
Get properties.
|
String |
getTypeName()
Gets .NET type name.
|
void |
init(org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction func)
Initializes this instance.
|
int |
partition(Object key)
Gets partition number for a given key starting from
0 . |
int |
partitions()
Gets total number of partitions available.
|
void |
readExternal(ObjectInput in) |
void |
removeNode(UUID nodeId)
Removes node from affinity.
|
void |
reset()
Resets cache affinity to its initial state.
|
PlatformDotNetAffinityFunction |
setProperties(Map<String,?> props)
Set properties.
|
PlatformDotNetAffinityFunction |
setTypeName(String typName)
Sets .NET type name.
|
void |
start()
Starts grid component, called on grid start.
|
void |
stop()
Stops grid component, called on grid shutdown.
|
void |
writeExternal(ObjectOutput out) |
public String getTypeName()
public PlatformDotNetAffinityFunction setTypeName(String typName)
typName
- .NET type name.this
for chaining.public PlatformDotNetAffinityFunction setProperties(Map<String,?> props)
props
- Properties.this
for chaining.public void reset()
reset
in interface AffinityFunction
public int partitions()
0
inclusively to
N
exclusively without any gaps.partitions
in interface AffinityFunction
public int partition(Object key)
0
. Partitioned caches
should make sure that keys are about evenly distributed across all partitions
from 0
to partition count
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.
partition
in interface AffinityFunction
key
- Key to get partition for.public List<List<ClusterNode>> assignPartitions(AffinityFunctionContext affCtx)
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
.
assignPartitions
in interface AffinityFunction
affCtx
- Affinity function context. Will provide all required information to calculate
new partition assignments.public void removeNode(UUID nodeId)
removeNode
in interface AffinityFunction
nodeId
- ID of node to remove.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void init(org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction func)
func
- Underlying func.public void start() throws IgniteException
start
in interface LifecycleAware
IgniteException
- If failed.public void stop() throws IgniteException
stop
in interface LifecycleAware
IgniteException
- If failed.public org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinityFunction getFunc()
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019