MerkleTrees (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.utils

## Class MerkleTrees

- java.lang.Object
- - org.apache.cassandra.utils.MerkleTrees

- All Implemented Interfaces:
    java.lang.Iterable<java.util.Map.Entry<Range<Token>,MerkleTree>>

      public class MerkleTrees
      extends java.lang.Object
      implements java.lang.Iterable<java.util.Map.Entry<Range<Token>,MerkleTree>>

  Wrapper class for handling of multiple MerkleTrees at once. The MerkleTree's are divided in Ranges of non-overlapping tokens.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MerkleTrees.MerkleTreesSerializer`
    `class` | `MerkleTrees.TreeRangeIterator`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static MerkleTrees.MerkleTreesSerializer` | `serializer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MerkleTrees(IPartitioner partitioner)` Creates empty MerkleTrees object.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `MerkleTree` | `addMerkleTree(int maxsize, byte hashdepth, Range<Token> range)`
    `MerkleTree` | `addMerkleTree(int maxsize, Range<Token> range)` Add a MerkleTree with the defined size and range.
    `void` | `addMerkleTrees(int maxsize, java.util.Collection<Range<Token>> ranges)` Add merkle tree's with the defined maxsize and ranges.
    `static java.util.List<Range<Token>>` | `difference(MerkleTrees ltree, MerkleTrees rtree)` Get the differences between the two sets of MerkleTrees.
    `MerkleTree.TreeRange` | `get(Token t)` Get the MerkleTree.Range responsible for the given token.
    `MerkleTree` | `getMerkleTree(Range<Token> range)` Get the MerkleTree responsible for the given token range.
    `byte[]` | `hash(Range<Token> range)`
    `void` | `init()` Init all MerkleTree's with an even tree distribution.
    `void` | `init(Range<Token> range)` Init a selected MerkleTree with an even tree distribution.
    `void` | `invalidate(Token t)` Invalidate the MerkleTree responsible for the given token.
    `MerkleTrees.TreeRangeIterator` | `invalids()` Get an iterator for all the invalids generated by the MerkleTrees.
    `java.util.Iterator<java.util.Map.Entry<Range<Token>,MerkleTree>>` | `iterator()` Get an iterator of all ranges and their MerkleTrees.
    `void` | `logRowCountPerLeaf(org.slf4j.Logger logger)` Log the row count per leaf for all MerkleTrees.
    `void` | `logRowSizePerLeaf(org.slf4j.Logger logger)` Log the row size per leaf for all MerkleTrees.
    `void` | `maxsize(Range<Token> range, int maxsize)`
    `IPartitioner` | `partitioner()` Get the partitioner in use.
    `java.util.Collection<Range<Token>>` | `ranges()` Get the ranges that these merkle trees covers.
    `long` | `rowCount()`
    `long` | `size()`
    `boolean` | `split(Token t)` Split the MerkleTree responsible for the given token.

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

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

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Field Detail

    - #### serializer

          public static final MerkleTrees.MerkleTreesSerializer serializer

  - ### Constructor Detail

    - #### MerkleTrees

          public MerkleTrees(IPartitioner partitioner)

      Creates empty MerkleTrees object.
      Parameters:
        `partitioner` - The partitioner to use

  - ### Method Detail

    - #### ranges

          public java.util.Collection<Range<Token>> ranges()

      Get the ranges that these merkle trees covers.
      Returns:

    - #### partitioner

          public IPartitioner partitioner()

      Get the partitioner in use.
      Returns:

    - #### addMerkleTrees

          public void addMerkleTrees(int maxsize,
                                     java.util.Collection<Range<Token>> ranges)

      Add merkle tree's with the defined maxsize and ranges.
      Parameters:
        `maxsize` -
        `ranges` -

    - #### addMerkleTree

          public MerkleTree addMerkleTree(int maxsize,
                                          Range<Token> range)

      Add a MerkleTree with the defined size and range.
      Parameters:
        `maxsize` -
        `range` -
      Returns:
        The created merkle tree.

    - #### addMerkleTree

          public MerkleTree addMerkleTree(int maxsize,
                                          byte hashdepth,
                                          Range<Token> range)

    - #### get

          public MerkleTree.TreeRange get(Token t)

      Get the MerkleTree.Range responsible for the given token.
      Parameters:
        `t` -
      Returns:

    - #### init

          public void init()

      Init all MerkleTree's with an even tree distribution.

    - #### init

          public void init(Range<Token> range)

      Init a selected MerkleTree with an even tree distribution.
      Parameters:
        `range` -

    - #### split

          public boolean split(Token t)

      Split the MerkleTree responsible for the given token.
      Parameters:
        `t` -
      Returns:

    - #### invalidate

          public void invalidate(Token t)

      Invalidate the MerkleTree responsible for the given token.
      Parameters:
        `t` -

    - #### getMerkleTree

          public MerkleTree getMerkleTree(Range<Token> range)

      Get the MerkleTree responsible for the given token range.
      Parameters:
        `range` -
      Returns:

    - #### size

          public long size()

    - #### maxsize

          public void maxsize(Range<Token> range,
                              int maxsize)

    - #### invalids

          public MerkleTrees.TreeRangeIterator invalids()

      Get an iterator for all the invalids generated by the MerkleTrees.
      Returns:

    - #### logRowCountPerLeaf

          public void logRowCountPerLeaf(org.slf4j.Logger logger)

      Log the row count per leaf for all MerkleTrees.
      Parameters:
        `logger` -

    - #### logRowSizePerLeaf

          public void logRowSizePerLeaf(org.slf4j.Logger logger)

      Log the row size per leaf for all MerkleTrees.
      Parameters:
        `logger` -

    - #### hash

          public byte[] hash(Range<Token> range)

    - #### iterator

          public java.util.Iterator<java.util.Map.Entry<Range<Token>,MerkleTree>> iterator()

      Get an iterator of all ranges and their MerkleTrees.
      Specified by:
        `iterator` in interface `java.lang.Iterable<java.util.Map.Entry<Range<Token>,MerkleTree>>`

    - #### rowCount

          public long rowCount()

    - #### difference

          public static java.util.List<Range<Token>> difference(MerkleTrees ltree,
                                                                MerkleTrees rtree)

      Get the differences between the two sets of MerkleTrees.
      Parameters:
        `ltree` -
        `rtree` -
      Returns:

Copyright © 2018 The Apache Software Foundation