|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectbamboo.dmgr.MerkleTree.Node
public class MerkleTree.Node
A node in the tree. Most tree operations are done on these objects.
To get the root node, call MerkleTree.root ().
| Nested Class Summary | |
|---|---|
class |
MerkleTree.Node.Iter
A class for iterating over this node's children. |
| Field Summary | |
|---|---|
protected long |
earliest_expiry_usec
The earliest expiration time in subtree below this node. |
protected byte[] |
hash
The hash of this node's children; may be null, in which case fill_holes may be called to fill it in. |
protected long |
leaves_below
A count of how many leaves are below this node, so that fill_holes knows when we need to create or remove
child nodes. |
protected int |
level
This node's level in the tree; leaves are below level 0. |
protected long |
low
The lowest timestamp value that this node is a parent of. |
| Constructor Summary | |
|---|---|
MerkleTree.Node(int level,
long low)
|
|
| Method Summary | |
|---|---|
boolean |
children_are_leaves()
|
MerkleTree.Node.Iter |
children()
Returns an iterator over this node's children. |
long |
earliest_expiry_usec()
|
protected MerkleTree.FillHolesState |
fill_holes_have_children(MerkleTree.FillHolesState state,
long now_ms)
|
protected MerkleTree.FillHolesState |
fill_holes_no_children(MerkleTree.FillHolesState state,
long now_ms)
|
MerkleTree.FillHolesState |
fill_holes(MerkleTree.FillHolesState state,
long now_ms)
Fills in the holes in the tree. |
boolean |
has_children()
|
byte[] |
hash()
|
void |
invalidate_path(long time_usec)
Invalidate all nodes between this one and the one which has (or would have) timestamp time_usec as its leaf. |
void |
invalidate()
Notify this node that its current hash value should be recomputed, presumably because of a change in the underlying database. |
long |
leaves_below()
|
int |
level()
This node's level in the tree; leaves are below level 0. |
protected long |
max()
|
long |
range_high()
Returns the highest timestamp covered by this node. |
long |
range_low()
Returns the lowest timestamp covered by this node. |
void |
set_earliest_expiry_usec(long e_e)
|
void |
set_hash(byte[] value)
|
void |
set_leaves_below(long value)
|
String |
toString()
|
boolean |
valid(long now_ms)
Is the hash of this node up to date? Have any of this node's progeny expired? |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected long low
protected int level
protected byte[] hash
fill_holes may be called to fill it in.
protected long earliest_expiry_usec
protected long leaves_below
fill_holes knows when we need to create or remove
child nodes. If there are less than or equal to
2^expansion leaves below this node, it'll have no
children, otherwise, it'll have at least two.
| Constructor Detail |
|---|
public MerkleTree.Node(int level,
long low)
| Method Detail |
|---|
public long range_low()
public long range_high()
public MerkleTree.Node.Iter children()
UnsupportedOperationException - if this node is at level 0public boolean has_children()
public void invalidate()
public boolean valid(long now_ms)
public int level()
public boolean children_are_leaves()
public long leaves_below()
public void set_leaves_below(long value)
public byte[] hash()
public long earliest_expiry_usec()
public void set_hash(byte[] value)
public void set_earliest_expiry_usec(long e_e)
public String toString()
toString in class Objectpublic void invalidate_path(long time_usec)
time_usec as its leaf.
public MerkleTree.FillHolesState fill_holes(MerkleTree.FillHolesState state,
long now_ms)
hash
and leaves_below data members for this node correctly
and return null. Otherwise, it will discover a range
of data for which it needs a hash and a count of the number of
items before it can complete successfully. In this case, it will
return a FillHoleState to indicate the range it needs.
The caller should perform the scan over the range
range_low to range_high inclusive. If
there are less than or equal to max_leaves_below items
in the range, it should set leaves_below to the total
number of items and store their digest in digest.
Otherwise, it should set leaves_below to the number of
items read and set digest to null. It
should not change range_low, range_high,
or max_leaves_below.
protected MerkleTree.FillHolesState fill_holes_have_children(MerkleTree.FillHolesState state,
long now_ms)
protected long max()
protected MerkleTree.FillHolesState fill_holes_no_children(MerkleTree.FillHolesState state,
long now_ms)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||