org.apache.ignite.internal.processors.cache.distributed.dht.preloader

## Class CacheGroupAffinityMessage

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CacheGroupAffinityMessage

All Implemented Interfaces:
  Serializable, Message

    public class CacheGroupAffinityMessage
    extends Object
    implements Message

Information about affinity assignment.

See Also:
  Serialized Form

### Field Summary

### Fields inherited from interface org.apache.ignite.plugin.extensions.communication.Message

`DIRECT_TYPE_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`CacheGroupAffinityMessage()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`Map<Integer,GridLongList>` `assignmentsDiff()`
`static Map<Integer,CacheGroupAffinityMessage>` `createAffinityDiffMessages(Map<Integer,Map<Integer,List<Long>>> affDiff)`
`List<List<ClusterNode>>` `createAssignments(Map<Long,ClusterNode> nodesByOrder, DiscoCache discoCache)`
`@Nullable List<List<ClusterNode>>` `createIdealAssignments(Map<Long,ClusterNode> nodesByOrder, DiscoCache discoCache)`
`short` `directType()` Gets message type.
`byte` `fieldsCount()` Gets fields count.
`void` `onAckReceived()` Method called when ack message received.
`boolean` `readFrom(ByteBuffer buf, MessageReader reader)` Reads this message from provided byte buffer.
`static List<ClusterNode>` `toNodes(GridLongList assign, Map<Long,ClusterNode> nodesByOrder, DiscoCache discoCache)`
`String` `toString()`
`boolean` `writeTo(ByteBuffer buf, MessageWriter writer)` Writes this message to provided byte buffer.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### CacheGroupAffinityMessage

    public CacheGroupAffinityMessage()

### Method Detail

#### createAffinityDiffMessages

    public static Map<Integer,CacheGroupAffinityMessage> createAffinityDiffMessages(Map<Integer,Map<Integer,List<Long>>> affDiff)

Parameters:
  `affDiff` - Affinity diff.
Returns:
  Affinity diff messages.

#### toNodes

    public static List<ClusterNode> toNodes(GridLongList assign,
                                            Map<Long,ClusterNode> nodesByOrder,
                                            DiscoCache discoCache)

Parameters:
  `assign` - Nodes orders.
  `nodesByOrder` - Nodes by order cache.
  `discoCache` - Discovery data cache.
Returns:
  Nodes list.

#### createIdealAssignments

    @Nullable
    public @Nullable List<List<ClusterNode>> createIdealAssignments(Map<Long,ClusterNode> nodesByOrder,
                                                                              DiscoCache discoCache)

Parameters:
  `nodesByOrder` - Nodes by order cache.
  `discoCache` - Discovery data cache.
Returns:
  Nodes list.

#### createAssignments

    public List<List<ClusterNode>> createAssignments(Map<Long,ClusterNode> nodesByOrder,
                                                     DiscoCache discoCache)

Parameters:
  `nodesByOrder` - Nodes by order cache.
  `discoCache` - Discovery data cache.
Returns:
  Assignments.

#### assignmentsDiff

    public Map<Integer,GridLongList> assignmentsDiff()

Returns:
  Difference with ideal affinity assignment.

#### writeTo

    public boolean writeTo(ByteBuffer buf,
                           MessageWriter writer)

Writes this message to provided byte buffer.

Specified by:
  `writeTo` in interface `Message`
Parameters:
  `buf` - Byte buffer.
  `writer` - Writer.
Returns:
  Whether message was fully written.

#### readFrom

    public boolean readFrom(ByteBuffer buf,
                            MessageReader reader)

Reads this message from provided byte buffer.

Specified by:
  `readFrom` in interface `Message`
Parameters:
  `buf` - Byte buffer.
  `reader` - Reader.
Returns:
  Whether message was fully read.

#### directType

    public short directType()

Gets message type.

Specified by:
  `directType` in interface `Message`
Returns:
  Message type.

#### fieldsCount

    public byte fieldsCount()

Gets fields count.

Specified by:
  `fieldsCount` in interface `Message`
Returns:
  Fields count.

#### onAckReceived

    public void onAckReceived()

Method called when ack message received.

Specified by:
  `onAckReceived` in interface `Message`

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.13.0
Release Date | : April 20 2022