accumulator

package
v0.0.0-...-4966005 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DagSize = 20

Max Depth of Accumulator

Functions

This section is empty.

Types

type Dag

type Dag interface {
	GetDepth() uint64
	Store(ctx context.Context, n *ProtoNode) error
	Append(ctx context.Context, n *ProtoNode) (depth uint64, ok bool)
	TruncateRoot(ctx context.Context) (n *ProtoNode, ok bool)
	Traverse(n *ProtoNode, traverseFunc TraverseFunc) error
}

type Service

type Service struct {
	Dag
	*ProtoNode
	sync.Mutex
	Epoch uint64
}

finite FiniteService

func New

func New(bs blockservice.BlockService, dagSize ...uint64) *Service

func (*Service) Anchor

func (e *Service) Anchor(ctx context.Context) (a *Ref, ok bool)

Truncating Dag terminate with Ref node

func (*Service) AppendBytes

func (e *Service) AppendBytes(ctx context.Context, b []byte) (n *ProtoNode, depth uint64, ok bool)

convenience wrapper to write bytes to the Dag FiniteService

func (*Service) AppendTxt

func (e *Service) AppendTxt(ctx context.Context, str string) (n *ProtoNode, depth uint64, ok bool)

append human-readable messages < 128 chars to the DAG

func (*Service) StoreBytes

func (e *Service) StoreBytes(ctx context.Context, b []byte) (n *ProtoNode, ok bool)

Store bytes bypassing Dag Service

func (*Service) StoreString

func (e *Service) StoreString(ctx context.Context, str string) (n *ProtoNode, ok bool)

Store string data bypassing Dag Service

type TraverseFunc

type TraverseFunc = traverse.Func

function used to read a dag using BFS

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL