chains

package
v0.0.0-...-e95280a Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPointer

func NewPointer() *chain

NewPointer creates a new chain pointer

Types

type Builder

type Builder interface {
	Create() Builder
	WithID(id *uuid.UUID) Builder
	WithPeers(peers peers.Peers) Builder
	WithOriginal(original Chain) Builder
	WithGenesis(gen genesis.Genesis) Builder
	WithRoot(root block_mined.Block) Builder
	WithHead(head link_mined.Link) Builder
	CreatedOn(createdOn time.Time) Builder
	Now() (Chain, error)
}

Builder represents a chain builder

func NewBuilder

func NewBuilder(peerSyncInterval time.Duration) Builder

NewBuilder creates a new builder instance

type Chain

type Chain interface {
	ID() *uuid.UUID
	Peers() peers.Peers
	Genesis() genesis.Genesis
	Root() block_mined.Block
	TotalHashes() uint
	Height() uint
	CreatedOn() time.Time
	HasHead() bool
	Head() link_mined.Link
}

Chain represents a chain

func CreateChainForTests

func CreateChainForTests() Chain

CreateChainForTests creates a new chain instance for tests

type Repository

type Repository interface {
	List() ([]*uuid.UUID, error)
	Retrieve(id *uuid.UUID) (Chain, error)
}

Repository represents a chain repository

type Service

type Service interface {
	Insert(chain Chain) error
	Update(original Chain, updated Chain) error
	Delete(chain Chain) error
}

Service represents a chain service

type Validator

type Validator interface {
	Execute(chain Chain) error
}

Validator represents a chain validator

func NewValidator

func NewValidator(
	minedBlockValidator mined_block.Validator,
	minedLinkValidator mined_link.Validator,
	chainRepository Repository,
) Validator

NewValidator creates a new validator instance

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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