com.hazelcast.config

## Class MerkleTreeConfig

- java.lang.Object
- - com.hazelcast.config.MerkleTreeConfig

- All Implemented Interfaces:
    DataSerializable, IdentifiedDataSerializable

      public class MerkleTreeConfig
      extends Object
      implements IdentifiedDataSerializable

  Configuration for a merkle tree. The merkle tree is a data structure used for efficient comparison of the difference in the contents of large data structures. The precision of such a comparison mechanism is defined by the depth of the merkle tree.

  A larger depth means that a data synchronization mechanism will be able to pinpoint a smaller subset of the data structure contents in which a change occurred. This causes the synchronization mechanism to be more efficient. On the other hand, a larger tree depth means the merkle tree will consume more memory.

  A smaller depth means the data synchronization mechanism will have to transfer larger chunks of the data structure in which a possible change happened. On the other hand, a shallower tree consumes less memory. The depth must be between and (exclusive). The default depth is .

  As the comparison mechanism is iterative, a larger depth will also prolong the duration of the comparison mechanism. Care must be taken to not have large tree depths if the latency of the comparison operation is high. The default depth is .

  See https://en.wikipedia.org/wiki/Merkle_tree.

  Since:
    3.11

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MerkleTreeConfig()`
    `MerkleTreeConfig(MerkleTreeConfig config)` Clones a `MerkleTreeConfig`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `int` | `getDepth()` Returns the depth of the merkle tree.
    `int` | `getFactoryId()` Returns DataSerializableFactory factory ID for this class.
    `int` | `getId()` Returns type identifier for this class.
    `String` | `getMapName()` Returns the map name to which this config applies.
    `int` | `hashCode()`
    `boolean` | `isEnabled()` Returns if the merkle tree is enabled.
    `void` | `readData(ObjectDataInput in)` Reads fields from the input stream
    `MerkleTreeConfig` | `setDepth(int depth)` Sets the depth of the merkle tree.
    `MerkleTreeConfig` | `setEnabled(boolean enabled)` Enables or disables the merkle tree.
    `MerkleTreeConfig` | `setMapName(String mapName)` Sets the map name to which this config applies.
    `String` | `toString()`
    `void` | `writeData(ObjectDataOutput out)` Writes object fields to output stream

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

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

- - ### Constructor Detail

    - #### MerkleTreeConfig

          public MerkleTreeConfig()

    - #### MerkleTreeConfig

          public MerkleTreeConfig(MerkleTreeConfig config)

      Clones a `MerkleTreeConfig`.
      Parameters:
        `config` - the merkle tree config to clone
      Throws:
        `NullPointerException` - if the config is null

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getDepth

          public int getDepth()

      Returns the depth of the merkle tree. The default depth is .

    - #### setDepth

          public MerkleTreeConfig setDepth(int depth)

      Sets the depth of the merkle tree. The depth must be between and (exclusive).
      Parameters:
        `depth` - the depth of the merkle tree
      Returns:
        the updated config
      Throws:
        `ConfigurationException` - if the `depth` is greater than or less than

    - #### isEnabled

          public boolean isEnabled()

      Returns if the merkle tree is enabled.
      Returns:
        `true` if the merkle tree is enabled, `false` otherwise

    - #### setEnabled

          public MerkleTreeConfig setEnabled(boolean enabled)

      Enables or disables the merkle tree.
      Parameters:
        `enabled` - `true` if enabled, `false` otherwise.
      Returns:
        the updated config

    - #### getMapName

          public String getMapName()

      Returns the map name to which this config applies.
      Returns:
        the map name

    - #### setMapName

          public MerkleTreeConfig setMapName(String mapName)

      Sets the map name to which this config applies. Map names are also matched by pattern and merkle with map name "default" applies to all maps that do not have more specific merkle tree configs.
      Parameters:
        `mapName` - the map name
      Returns:
        the merkle tree config
      Throws:
        `IllegalArgumentException` - if the `mapName` is `null` or empty.

    - #### getFactoryId

          public int getFactoryId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns DataSerializableFactory factory ID for this class.
      Specified by:
        `getFactoryId` in interface `IdentifiedDataSerializable`
      Returns:
        factory ID

    - #### getId

          public int getId()

      Description copied from interface: `IdentifiedDataSerializable`
      Returns type identifier for this class. It should be unique per DataSerializableFactory.
      Specified by:
        `getId` in interface `IdentifiedDataSerializable`
      Returns:
        type ID

    - #### writeData

          public void writeData(ObjectDataOutput out)
                         throws IOException

      Description copied from interface: `DataSerializable`
      Writes object fields to output stream
      Specified by:
        `writeData` in interface `DataSerializable`
      Parameters:
        `out` - output
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the output stream has been closed.

    - #### readData

          public void readData(ObjectDataInput in)
                        throws IOException

      Description copied from interface: `DataSerializable`
      Reads fields from the input stream
      Specified by:
        `readData` in interface `DataSerializable`
      Parameters:
        `in` - input
      Throws:
        `IOException` - if an I/O error occurs. In particular, an `IOException` may be thrown if the input stream has been closed.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

Copyright © 2019. All rights reserved.