protocol

package
v0.0.0-...-967d326 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDFromBatch

func IDFromBatch(batch [][]byte) identity.ID

IDFromBatch gets an ID from the hash of a protocol

Types

type Counter

type Counter func() int

Counter is a function that return an incremented value at each call by one

func MakeCounter

func MakeCounter() Counter

MakeCounter return a simple basic counter

type DefaultMembersProvider

type DefaultMembersProvider struct {
	WLP network.WhiteListProvider
}

DefaultMembersProvider is an implementation of MembersProvider

func (*DefaultMembersProvider) GetMembers

func (d *DefaultMembersProvider) GetMembers() []identity.ID

GetMembers return the list of all the members

type IDList

type IDList []identity.ID

IDList is a wrapper for a list of identity.ID

func (IDList) FirstHigherThan

func (i IDList) FirstHigherThan(id identity.ID) (int, identity.ID)

FirstHigherThan returns the first record in IDList higher than a given reference identity.ID.

func (IDList) Max

func (i IDList) Max() (int, identity.ID)

Max returns the position of the identity.ID with the biggest bigint representation

func (IDList) Min

func (i IDList) Min() (int, identity.ID)

Min returns the position of the identity.ID with the smallest bigint representation

func (IDList) SmallestHigherThan

func (i IDList) SmallestHigherThan(id identity.ID) (int, identity.ID)

SmallestHigherThan return the smallest identity.ID that is higher than a given identity.ID. Returns the minimum if no records are higher than the given identity.ID

type MemberProvider

type MemberProvider interface {
	GetMembers() []identity.ID
}

MemberProvider is a helper for getting co-peers in permissioned network

type Node

type Node interface{}

Node is an interface

type Tree

type Tree struct {
	Parent   *Tree
	Children []*Tree
	Node     Node
}

Tree is a recursive helper that helps scheduling the aggregation

func NewTree

func NewTree(height, arity int) *Tree

NewTree instantiate a tree with given depth and arity

func (*Tree) GetLeaves

func (t *Tree) GetLeaves() (leaves []*Tree)

GetLeaves returns the list of all leaves of the subtree

func (*Tree) IsLeaf

func (t *Tree) IsLeaf() bool

IsLeaf returns true is this tree is a leaf

func (*Tree) Walk

func (t *Tree) Walk(f TreeFunc)

Walk apply a function at each nodes of the subtree, starting with the root It's depth-first

type TreeFunc

type TreeFunc func(t *Tree)

TreeFunc is an alias for a closure taking a tree as argument and returning nothing

func MakeLeavesAccumulator

func MakeLeavesAccumulator() (TreeFunc, func() []*Tree)

MakeLeavesAccumulator returns a TreeFunc and a closure to get the list of leaves

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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