public class MerkleTree
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
MerkleTree.MerkleTreeSerializer |
static class |
MerkleTree.RowHash
Hash value representing a row, to be used to pass hashes to the MerkleTree.
|
static class |
MerkleTree.TreeDifference |
static class |
MerkleTree.TreeRange
The public interface to a range in the tree.
|
static class |
MerkleTree.TreeRangeIterator
Returns the leaf (range) of a given tree in increasing order.
|
Modifier and Type | Field and Description |
---|---|
static int |
CONSISTENT |
Range<Token> |
fullRange
The top level range that this MerkleTree covers.
|
static int |
FULLY_INCONSISTENT |
byte |
hashdepth |
static int |
PARTIALLY_INCONSISTENT |
static byte |
RECOMMENDED_DEPTH |
static MerkleTree.MerkleTreeSerializer |
serializer |
Constructor and Description |
---|
MerkleTree(IPartitioner partitioner,
Range<Token> range,
byte hashdepth,
long maxsize) |
Modifier and Type | Method and Description |
---|---|
static java.util.List<MerkleTree.TreeRange> |
difference(MerkleTree ltree,
MerkleTree rtree) |
MerkleTree.TreeRange |
get(Token t)
For testing purposes.
|
byte[] |
hash(Range<Token> range)
Hash the given range in the tree.
|
EstimatedHistogram |
histogramOfRowCountPerLeaf() |
EstimatedHistogram |
histogramOfRowSizePerLeaf() |
void |
init()
Initializes this tree by splitting it until hashdepth is reached,
or until an additional level of splits would violate maxsize.
|
void |
invalidate(Token t)
Invalidates the ranges containing the given token.
|
MerkleTree.TreeRangeIterator |
invalids()
Returns a lazy iterator of invalid TreeRanges that need to be filled
in order to make the given Range valid.
|
long |
maxsize() |
void |
maxsize(long maxsize) |
IPartitioner |
partitioner() |
long |
size()
The number of distinct ranges contained in this tree.
|
boolean |
split(Token t)
Splits the range containing the given token, if no tree limits would be
violated.
|
java.lang.String |
toString() |
public static final MerkleTree.MerkleTreeSerializer serializer
public static final byte RECOMMENDED_DEPTH
public static final int CONSISTENT
public static final int FULLY_INCONSISTENT
public static final int PARTIALLY_INCONSISTENT
public final byte hashdepth
public MerkleTree(IPartitioner partitioner, Range<Token> range, byte hashdepth, long maxsize)
partitioner
- The partitioner in use.range
- the range this tree covershashdepth
- The maximum depth of the tree. 100/(2^depth) is the %
of the key space covered by each subrange of a fully populated tree.maxsize
- The maximum number of subranges in the tree.public void init()
public IPartitioner partitioner()
public long size()
public long maxsize()
public void maxsize(long maxsize)
public static java.util.List<MerkleTree.TreeRange> difference(MerkleTree ltree, MerkleTree rtree)
ltree
- First tree.rtree
- Second tree.public MerkleTree.TreeRange get(Token t)
public void invalidate(Token t)
public byte[] hash(Range<Token> range)
public boolean split(Token t)
public MerkleTree.TreeRangeIterator invalids()
public EstimatedHistogram histogramOfRowSizePerLeaf()
public EstimatedHistogram histogramOfRowCountPerLeaf()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2015 The Apache Software Foundation