Builder

merkle.Builder
class Builder(hasher: Hasher)

Helpers for construction of MerkleTree instances

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def bool(label: String, value: Boolean): MerkleTree

Store a bool value as a leaf node. The value is converted to String and then serialised with string

Store a bool value as a leaf node. The value is converted to String and then serialised with string

Attributes

def leaf(label: String, data: Array[Byte], tb: ToBytes[Any]): MerkleTree
def nest[T](label: String)(fields: T => Seq[MerkleTree]): T => Node

Creates a new node in the tree from a function that takes some value as input and produces a sequence of subtrees.

Creates a new node in the tree from a function that takes some value as input and produces a sequence of subtrees.

This is the primary function for implementing a case class to MerkleTree mapping

Attributes

def node(label: String, subtrees: Seq[MerkleTree]): MerkleTree
def path(label: String, p: Path, tb: ToBytes[Path]): MerkleTree

Store a path as a leaf node using a given ToBytes instance. The absolute path is converted to a String and used as input to ToBytes

Store a path as a leaf node using a given ToBytes instance. The absolute path is converted to a String and used as input to ToBytes

Attributes

def sortedPaths(label: String, s: Seq[Path], tb: ToBytes[Path]): MerkleTree

A node that contains given sequence of paths as sequence of individually hashed leaf nodes using a given ToBytes instance. The paths are sorted before being added to the tree

A node that contains given sequence of paths as sequence of individually hashed leaf nodes using a given ToBytes instance. The paths are sorted before being added to the tree

Attributes

A node that contains given sequence as strings as sequence of individually hashed leaf nodes. The strings are sorted before being added to the tree

A node that contains given sequence as strings as sequence of individually hashed leaf nodes. The strings are sorted before being added to the tree

Attributes

def string(label: String, s: String): MerkleTree
def strings(label: String, s: Seq[String]): MerkleTree

A node that contains given sequence as strings as sequence of individually hashed leaf nodes. Strings are added to the tree in the order they are given, without sorting

A node that contains given sequence as strings as sequence of individually hashed leaf nodes. Strings are added to the tree in the order they are given, without sorting

Attributes