MerkleTree

merkle.MerkleTree
See theMerkleTree companion object
sealed abstract class MerkleTree

A Merkle tree is a data structure which consists of leaves – that hash their data contents according to user-provided procedure and data interpretation, and nodes – which hash the hashes of their subtrees.

This allows for fast comparison between two trees, as we only need to compared the root node hashes

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Leaf
class Node

Members list

Value members

Abstract methods

Hash of this node contents. IMPORTANT: hash computation is lazy and cached. The only reason this is a def and not a lazy val is that Scala does not allow abstract lazy values

Hash of this node contents. IMPORTANT: hash computation is lazy and cached. The only reason this is a def and not a lazy val is that Scala does not allow abstract lazy values

Attributes

def hasher: Hasher

Instance of the Hasher used to produce hashes

Instance of the Hasher used to produce hashes

Attributes

def label: String

Human-readable label for this node. Labels are important – they are preserved in (de-)serialisation, are present in the rendering, and are used for structural checks when constructing a DiffTree

Human-readable label for this node. Labels are important – they are preserved in (de-)serialisation, are present in the rendering, and are used for structural checks when constructing a DiffTree

Attributes

Concrete methods

def render(colors: Boolean = ...): Vector[String]

Renders the tree as a list of strings.

Renders the tree as a list of strings.

Value parameters

colors

whether to use ASCII colours or not

Attributes

def renderToString(colors: Boolean = ...): String
def serialise(toHashID: Hasher => Option[String] = ..., toBytesID: (ToBytes[Any]) => Option[String] = ...): Result[Vector[String]]
def serialiseToString(toHashID: Hasher => Option[String] = ..., toBytesID: (ToBytes[Any]) => Option[String] = ...): Result[String]

Concrete fields

lazy val hashString: Result[String]

Stringified hex representation of the hash of the data (see hash)

Stringified hex representation of the hash of the data (see hash)

Attributes