aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/difftree/internal/merkletrie/noder.go
blob: 3566657436b3474a3010b3bddacd3637b8fc1139 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package merkletrie

// The Noder interface is implemented by the elements of a Merkle Trie.
type Noder interface {
	// Hash returns the hash of the element.
	Hash() []byte
	// Key returns the key of the element.
	Key() string
	// Children returns the children of the element, sorted
	// in reverse key alphabetical order.
	Children() []Noder
	// NumChildren returns the number of children this element has.
	//
	// This method is an optimization: the number of children is easily
	// calculated as the length of the value returned by the Children
	// method (above); yet, some implementations will be able to
	// implement NumChildren in O(1) while Children is usually more
	// complex.
	NumChildren() int
}