Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Branch ¶
type Branch []Node
Branch is an implementation of node the first Node of the slide is the root tree, the last one the current folder/directory
type Node ¶
type Node interface { Name() string // name of the folder or file PreHash() []byte // hash of the content of the folder or file Hash() []byte // combined hash of the name and prehash of the node IsDir() bool // wether the node is a directory Subnodes() []Node // children nodes of a folder node }
Node represents a Node of the merkletree a directory is a branch node while a file is a leaf node
type SerializableNode ¶
type SerializableNode struct { Name string `json:"name"` PreHash string `json:"prehash"` Hash string `json:"hash"` IsDir bool `json:"isdir"` Subnodes []SerializableNode `json:"subnodes"` }
SerializableNode is used to serialize/deserialize a node
func FromNode ¶
func FromNode(node Node, hashToStringFn func(hash []byte) string) SerializableNode
FromNode recursively creates a SerializableNode from a Node hashToStringFn: funcion that converts a hash to a string
func (SerializableNode) JSON ¶
func (sn SerializableNode) JSON() []byte
JSON converts the serializeable node into a Json
Click to show internal directories.
Click to hide internal directories.