How to use the hippiehug.Nodes.Leaf function in hippiehug

To help you get started, we’ve selected a few hippiehug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github claimchain / claimchain-core / claimchain / utils / wrappers.py View on Github external
3
    >>> leaf = hippiehug.Nodes.Leaf(b'item', b'key')
    >>> len(serialize_object(leaf))
    2
    >>> blob = Blob(b'content')
    >>> serialize_object(blob) == blob
    True

    .. warning::

    There is no guarantee this is in sync with hippiehug, i.e., this
    is the serialization hippiehug employs internally. This will eventually
    move inside the hippiehug library.

    """
    if isinstance(obj, hippiehug.Nodes.Leaf):
        return (obj.key, obj.item)
    elif isinstance(obj, hippiehug.Nodes.Branch):
        return (obj.pivot, obj.left_branch, obj.right_branch)
    elif isinstance(obj, hippiehug.Block):
        return (obj.index, obj.fingers, obj.items, obj.aux)
    elif isinstance(obj, Blob):
        return obj

hippiehug

A Merkle Tree implementation with a flexible storage backend.

BSD-2-Clause
Latest version published 7 years ago

Package Health Score

36 / 100
Full package analysis