Record Class WanMerkleTree
java.lang.Object
java.lang.Record
com.loomcache.server.wan.WanMerkleTree
public record WanMerkleTree(int bucketCount, @NonNull String rootHash, @NonNull List<String> bucketHashes, @NonNull Map<String, Map<String,String>> entryHashesByMap)
extends Record
Deterministic Merkle digest for WAN-replicated map state.
The tree stores per-entry hashes in deterministic map/key order so a source
cluster can plan exact PUT/DELETE deltas after comparing bucket and entry hashes
from a remote cluster. JCache distributed-mode caches participate through their
qualified jcache.<cacheName> backing maps. Values are never stored in
the tree.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of thebucketCountrecord component.Returns the value of thebucketHashesrecord component.static @NonNull WanMerkleTreedeserialize(byte @NonNull [] data) @NonNull WanMerkleTree.WanMerkleDiffdiff(@NonNull WanMerkleTree remote) intReturns the value of theentryHashesByMaprecord component.final booleanIndicates whether some other object is "equal to" this one.static @NonNull WanMerkleTreestatic @NonNull WanMerkleTreefinal inthashCode()Returns a hash code value for this object.booleanisConsistentWith(@NonNull WanMerkleTree remote) @NonNull StringrootHash()Returns the value of therootHashrecord component.byte @NonNull []final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_BUCKET_COUNT
public static final int DEFAULT_BUCKET_COUNT- See Also:
-
-
Constructor Details
-
WanMerkleTree
public WanMerkleTree(int bucketCount, @NonNull String rootHash, @NonNull List<String> bucketHashes, @NonNull Map<String, Map<String, String>> entryHashesByMap) Creates an instance of aWanMerkleTreerecord class.- Parameters:
bucketCount- the value for thebucketCountrecord componentrootHash- the value for therootHashrecord componentbucketHashes- the value for thebucketHashesrecord componententryHashesByMap- the value for theentryHashesByMaprecord component
-
-
Method Details
-
fromEntries
-
fromEntries
-
diff
-
serialize
public byte @NonNull [] serialize() -
deserialize
-
isConsistentWith
-
entryCount
public int entryCount() -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
bucketCount
public int bucketCount()Returns the value of thebucketCountrecord component.- Returns:
- the value of the
bucketCountrecord component
-
rootHash
Returns the value of therootHashrecord component.- Returns:
- the value of the
rootHashrecord component
-
bucketHashes
-
entryHashesByMap
-