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

## Class GridDhtPartitionsSingleMessage

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.GridCacheMessage
  - - org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsAbstractMessage
    - - org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage

All Implemented Interfaces:
  Serializable, Message

    public class GridDhtPartitionsSingleMessage
    extends GridDhtPartitionsAbstractMessage

Information about partitions of a single node.

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsAbstractMessage

`flags`

### Fields inherited from class org.apache.ignite.internal.processors.cache.GridCacheMessage

`addDepInfo, CACHE_MSG_INDEX_FIELD_NAME, forceAddDepInfo, MAX_CACHE_MSG_LOOKUP_INDEX`

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

`DIRECT_TYPE_SIZE`

### Constructor Summary

Constructors
Constructor and Description
`GridDhtPartitionsSingleMessage()` Required by `Externalizable`.
`GridDhtPartitionsSingleMessage(GridDhtPartitionExchangeId exchId, boolean client, GridCacheVersion lastVer, boolean compress)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addLocalPartitionMap(int cacheId, GridDhtPartitionMap locMap, Integer dupDataCache)`
`void` `addPartitionSizes(int grpId, Map<Integer,Long> partSizesMap)` Adds partition sizes map for specified `grpId` to the current message.
`void` `addPartitionUpdateCounters(int grpId, Object cntrMap)`
`Collection<Integer>` `cacheGroupsAffinityRequest()`
`boolean` `client()`
`short` `directType()` Gets message type.
`byte` `fieldsCount()` Gets fields count.
`void` `finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr)` This method is called after the message is deserialized and is responsible for unmarshalling state marshalled in `GridCacheMessage.prepareMarshal(GridCacheSharedContext)` method.
`Exception` `getError()`
`int` `handlerId()`
`void` `partitionHistoryCounters(int grpId, Map<Integer,Long> cntrMap)`
`Map<Integer,GridDhtPartitionMap>` `partitions()`
`Map<Integer,Long>` `partitionSizes(int grpId)` Returns partition sizes map for specified `grpId`.
`CachePartitionPartialCountersMap` `partitionUpdateCounters(int grpId, int partsCnt)`
`void` `prepareMarshal(GridCacheSharedContext ctx)` This method is called before the whole message is serialized and is responsible for pre-marshalling state.
`boolean` `readFrom(ByteBuffer buf, MessageReader reader)` Reads this message from provided byte buffer.
`void` `setError(Exception ex)`
`String` `toString()`
`boolean` `writeTo(ByteBuffer buf, MessageWriter writer)` Writes this message to provided byte buffer.

### Methods inherited from class org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsAbstractMessage

`addDeploymentInfo, cacheGroupMessage, compressed, compressed, exchangeId, exchangeId, lastVersion, partition, partitionExchangeMessage, restoreState`

### Methods inherited from class org.apache.ignite.internal.processors.cache.GridCacheMessage

`appendFlag, classError, deployInfo, error, finishUnmarshalCacheObjects, finishUnmarshalCacheObjects, ignoreClassErrors, lookupIndex, marshalCollection, marshalInfo, marshalInfos, marshalInvokeArguments, marshalTx, messageId, messageLogger, nextIndexId, onAckReceived, onClassError, prepare, prepareMarshalCacheObject, prepareMarshalCacheObjects, prepareMarshalCacheObjects, prepareObject, prepareObject, topologyVersion, transferExpiryPolicy, unmarshalCollection, unmarshalInfo, unmarshalInfos, unmarshalInvokeArguments, unmarshalTx`

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

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

### Constructor Detail

#### GridDhtPartitionsSingleMessage

    public GridDhtPartitionsSingleMessage()

Required by `Externalizable`.

#### GridDhtPartitionsSingleMessage

    public GridDhtPartitionsSingleMessage(GridDhtPartitionExchangeId exchId,
                                          boolean client,
                                          @Nullable
                                          GridCacheVersion lastVer,
                                          boolean compress)

Parameters:
  `exchId` - Exchange ID.
  `client` - Client message flag.
  `lastVer` - Last version.
  `compress` - `True` if it is possible to use compression for message.

### Method Detail

#### cacheGroupsAffinityRequest

    @Nullable
    public Collection<Integer> cacheGroupsAffinityRequest()

Returns:
  Cache groups to get affinity for (affinity is requested when node joins cluster).

#### handlerId

    public int handlerId()

Specified by:
  `handlerId` in class `GridCacheMessage`
Returns:
  ID to distinguish message handlers for the same messages but for different caches/cache groups.

#### client

    public boolean client()

Returns:
  `True` if sent from client node.

#### addLocalPartitionMap

    public void addLocalPartitionMap(int cacheId,
                                     GridDhtPartitionMap locMap,
                                     @Nullable
                                     Integer dupDataCache)

Parameters:
  `cacheId` - Cache ID to add local partition for.
  `locMap` - Local partition map.
  `dupDataCache` - Optional ID of cache with the same partition state map.

#### addPartitionUpdateCounters

    public void addPartitionUpdateCounters(int grpId,
                                           Object cntrMap)

Parameters:
  `grpId` - Cache group ID.
  `cntrMap` - Partition update counters.

#### partitionUpdateCounters

    public CachePartitionPartialCountersMap partitionUpdateCounters(int grpId,
                                                                    int partsCnt)

Parameters:
  `grpId` - Cache group ID.
  `partsCnt` - Total cache partitions.
Returns:
  Partition update counters.

#### addPartitionSizes

    public void addPartitionSizes(int grpId,
                                  Map<Integer,Long> partSizesMap)

Adds partition sizes map for specified `grpId` to the current message.

Parameters:
  `grpId` - Group id.
  `partSizesMap` - Partition sizes map.

#### partitionSizes

    public Map<Integer,Long> partitionSizes(int grpId)

Returns partition sizes map for specified `grpId`.

Parameters:
  `grpId` - Group id.
Returns:
  Partition sizes map (partId, partSize).

#### partitionHistoryCounters

    public void partitionHistoryCounters(int grpId,
                                         Map<Integer,Long> cntrMap)

Parameters:
  `grpId` - Cache group ID.
  `cntrMap` - Partition history counters.

#### partitions

    public Map<Integer,GridDhtPartitionMap> partitions()

Returns:
  Local partitions.

#### setError

    public void setError(Exception ex)

Parameters:
  `ex` - Exception.

#### getError

    @Nullable
    public Exception getError()

Returns:
  Not null exception if exchange processing failed.

#### prepareMarshal

    public void prepareMarshal(GridCacheSharedContext ctx)
                        throws IgniteCheckedException

This method is called before the whole message is serialized and is responsible for pre-marshalling state.

Overrides:
  `prepareMarshal` in class `GridCacheMessage`
Parameters:
  `ctx` -
Throws:
  `IgniteCheckedException` - If failed.

#### finishUnmarshal

    public void finishUnmarshal(GridCacheSharedContext ctx,
                                ClassLoader ldr)
                         throws IgniteCheckedException

This method is called after the message is deserialized and is responsible for unmarshalling state marshalled in `GridCacheMessage.prepareMarshal(GridCacheSharedContext)` method.

Overrides:
  `finishUnmarshal` in class `GridCacheMessage`
Parameters:
  `ctx` - Context.
  `ldr` - Class loader.
Throws:
  `IgniteCheckedException` - If failed.

#### writeTo

    public boolean writeTo(ByteBuffer buf,
                           MessageWriter writer)

Writes this message to provided byte buffer.

Specified by:
  `writeTo` in interface `Message`
Overrides:
  `writeTo` in class `GridDhtPartitionsAbstractMessage`
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`
Overrides:
  `readFrom` in class `GridDhtPartitionsAbstractMessage`
Parameters:
  `buf` - Byte buffer.
  `reader` - Reader.
Returns:
  Whether message was fully read.

#### directType

    public short directType()

Gets message type.

Returns:
  Message type.

#### fieldsCount

    public byte fieldsCount()

Gets fields count.

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

#### toString

    public String toString()

Overrides:
  `toString` in class `GridDhtPartitionsAbstractMessage`

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 2.6.0
Release Date | : July 10 2018