blockmania

package
v0.0.0-...-8220f0d Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package blockmania implements the Blockmania consensus algorithm.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockGraph

type BlockGraph struct {
	Block BlockID
	Deps  []Dep
	Prev  BlockID
}

BlockGraph represents a block generated by a node and its dependencies.

type BlockID

type BlockID struct {
	Hash  string
	Node  uint64
	Round uint64
}

BlockID represents a specific block from a node in a way that can be used as a map key.

func (BlockID) String

func (b BlockID) String() string

func (BlockID) Valid

func (b BlockID) Valid() bool

Valid returns whether the BlockID is not the zero value.

type Config

type Config struct {
	LastInterpreted uint64
	Nodes           []uint64
	SelfID          uint64
	TotalNodes      uint64
}

Config represents the configuration of a blockmania Graph.

type Dep

type Dep struct {
	Block BlockID
	Deps  []BlockID
	Prev  BlockID
}

Dep represents a direct dependency of a block generated by a node.

type Graph

type Graph struct {
	// contains filtered or unexported fields
}

Graph represents the graph that is generated from the nodes in a shard broadcasting to each other.

func New

func New(ctx context.Context, cfg *Config, cb func(*Interpreted)) *Graph

New instantiates a Graph for use by the broadcast/consensus mechanism.

func (*Graph) Add

func (graph *Graph) Add(data *BlockGraph)

Add updates the graph and notifies the appropriate controllers.

type Interpreted

type Interpreted struct {
	Blocks   []BlockID
	Consumed uint64
	Round    uint64
}

Interpreted represents the results of interpreting a Graph for a particular round.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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