org.apache.ignite.internal.jdbc.thin

## Class JdbcThinPartitionAwarenessMappingGroup

- java.lang.Object
- - org.apache.ignite.internal.jdbc.thin.JdbcThinPartitionAwarenessMappingGroup

All Implemented Interfaces:
  JdbcRawBinarylizable

    public class JdbcThinPartitionAwarenessMappingGroup
    extends Object
    implements JdbcRawBinarylizable

Contains cache partitions distributions with corresponding set of cache ids.

### Constructor Summary

Constructors
Constructor and Description
`JdbcThinPartitionAwarenessMappingGroup(@NotNull Integer cacheId, Map<UUID,Set<Integer>> partitionsMappings)` Constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`Set<Integer>` `cacheIds()`
`boolean` `merge(int cacheId, Map<UUID,Set<Integer>> partitionsMappings)` Tries to merge given partitions mappings and corresponding cache id with already existing mappings.
`void` `readBinary(BinaryReaderExImpl reader, JdbcProtocolContext protoCtx)` Reads fields from provided reader.
`static JdbcThinPartitionAwarenessMappingGroup` `readGroup(BinaryReaderExImpl reader, JdbcProtocolContext binCtx)` Reads `JdbcThinPartitionAwarenessMappingGroup` from provided reader.
`UUID[]` `revertMappings(int partsCnt)` Reverts partitions mappings from the form 'node id -> set of partition ids' to the form 'partition id -> node id'.
`void` `writeBinary(BinaryWriterExImpl writer, JdbcProtocolContext protoCtx)` Writes fields to provided writer.

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

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

### Constructor Detail

#### JdbcThinPartitionAwarenessMappingGroup

    public JdbcThinPartitionAwarenessMappingGroup(@NotNull
                                                  @NotNull Integer cacheId,
                                                  Map<UUID,Set<Integer>> partitionsMappings)

Constructor.

Parameters:
  `cacheId` - Cache id.
  `partitionsMappings` - Partitions mappings.

### Method Detail

#### merge

    public boolean merge(int cacheId,
                         Map<UUID,Set<Integer>> partitionsMappings)

Tries to merge given partitions mappings and corresponding cache id with already existing mappings.

Parameters:
  `cacheId` - Cache id.
  `partitionsMappings` - Partitions mappings.
Returns:
  True if merged successfully, false otherwise.

#### revertMappings

    public UUID[] revertMappings(int partsCnt)

Reverts partitions mappings from the form 'node id -> set of partition ids' to the form 'partition id -> node id'. First form is more compact, so it's preferred in case of data transferring, second form is easier to use on client side, cause we mainly retrieve data using partition is as key.

Parameters:
  `partsCnt` - Partitions count.
Returns:
  Reverted form of partitions mapping: partition id -> node id.

#### cacheIds

    public Set<Integer> cacheIds()

Returns:
  Cache ids.

#### writeBinary

    public void writeBinary(BinaryWriterExImpl writer,
                            JdbcProtocolContext protoCtx)
                     throws BinaryObjectException

Writes fields to provided writer.

Specified by:
  `writeBinary` in interface `JdbcRawBinarylizable`
Parameters:
  `writer` - Binary object writer.
  `protoCtx` - JDBC protocol context.
Throws:
  `BinaryObjectException` - In case of error.

#### readBinary

    public void readBinary(BinaryReaderExImpl reader,
                           JdbcProtocolContext protoCtx)
                    throws BinaryObjectException

Reads fields from provided reader.

Specified by:
  `readBinary` in interface `JdbcRawBinarylizable`
Parameters:
  `reader` - Binary object reader.
  `protoCtx` - JDBC protocol context.
Throws:
  `BinaryObjectException` - In case of error.

#### readGroup

    public static JdbcThinPartitionAwarenessMappingGroup readGroup(BinaryReaderExImpl reader,
                                                                   JdbcProtocolContext binCtx)
                                                            throws BinaryObjectException

Reads `JdbcThinPartitionAwarenessMappingGroup` from provided reader.

Parameters:
  `reader` - Binary object reader.
  `binCtx` - Binary context.
Returns:
  Deserialized instance of `JdbcThinPartitionAwarenessMappingGroup`.
Throws:
  `BinaryObjectException` - In case of error.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.9.1
Release Date | : December 9 2020