public class MerkleTreeConfig extends Object implements IdentifiedDataSerializable
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.
Constructor and Description |
---|
MerkleTreeConfig() |
MerkleTreeConfig(MerkleTreeConfig config)
Clones a
MerkleTreeConfig . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
getClassId()
Returns type identifier for this class.
|
int |
getDepth()
Returns the depth of the merkle tree.
|
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
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.
|
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public MerkleTreeConfig()
public MerkleTreeConfig(MerkleTreeConfig config)
MerkleTreeConfig
.config
- the merkle tree config to cloneNullPointerException
- if the config is nullpublic int getDepth()
public MerkleTreeConfig setDepth(int depth)
depth
- the depth of the merkle treeInvalidConfigurationException
- if the depth
is greater than
or less than public boolean isEnabled()
true
if the merkle tree is enabled, false
otherwisepublic MerkleTreeConfig setEnabled(boolean enabled)
enabled
- true
if enabled, false
otherwise.public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getClassId()
IdentifiedDataSerializable
getClassId
in interface IdentifiedDataSerializable
public void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.Copyright © 2022 Hazelcast, Inc.. All rights reserved.