blockgen

package
v0.0.0-...-303b437 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuyEC

func BuyEC(from primitives.PrivateKey, to *primitives.PublicKey, ecamount uint64, ecrate uint64, time interfaces.Timestamp) (*factoid.Transaction, error)

BuyEC returns a factoid transaction to cover the ec amount

func NewGeneratorState

func NewGeneratorState(conf *DBGeneratorConfig, starttime interfaces.Timestamp) *state.State

Types

type BlockGen

type BlockGen struct {
	EntryGenerator  IFullEntryGenerator
	AuthoritySigner IAuthSigner
}

BlockGen can created full blocks. EntryGen generates entries, commits, and fct transactions. AuthoritySigner generates DBSigs. BlockGen packs all the responses into a DBState

func NewBlockGen

func NewBlockGen(config DBGeneratorConfig) (*BlockGen, error)

func (*BlockGen) NewBlock

func (bg *BlockGen) NewBlock(prev *state.DBState, netid uint32, firstTimeStamp interfaces.Timestamp) (*state.DBState, error)

NewBlock

Parameters
	prev			*DBState	Previous DBState for all linking fields
	netid			uint32		NetworkID for blockchain db
	firsttimestamp	timestamp	Used for block 1 timestamp if on height 1

type DBGenerator

type DBGenerator struct {

	// Defines the blocks created and data in the db
	BlockGenerator *BlockGen
	// contains filtered or unexported fields
}

DBGenerator is able to create a database given a defined config

func NewDBGenerator

func NewDBGenerator(c *DBGeneratorConfig) (*DBGenerator, error)

func (*DBGenerator) CreateBlocks

func (g *DBGenerator) CreateBlocks(amt int) error

CreateBlocks actually creates the blocks and saves them to disk

func (*DBGenerator) SaveDBState

func (g *DBGenerator) SaveDBState(dbstate *state.DBState)

SaveDBState will save a dbstate to disk

type DBGeneratorConfig

type DBGeneratorConfig struct {
	DBPath string
	DBType string

	CustomNetID    string
	StartTime      string
	EntryGenerator string
	LoopsPerPrint  int

	EntryGenConfig EntryGeneratorConfig
	// contains filtered or unexported fields
}

func NewDefaultDBGeneratorConfig

func NewDefaultDBGeneratorConfig() *DBGeneratorConfig

func (DBGeneratorConfig) FactomLaunch

func (c DBGeneratorConfig) FactomLaunch() string

func (DBGeneratorConfig) TimeFormat

func (DBGeneratorConfig) TimeFormat() string

type DefaultAuthSigner

type DefaultAuthSigner struct {
}

DefaultAuthSigner only signs for 38bab

func (DefaultAuthSigner) SignBlock

type EntryGenCore

type EntryGenCore struct {
	ECKey  primitives.PrivateKey
	Config EntryGeneratorConfig

	// YOU MUST SET THIS
	//	Setting this allows for overrides. If you do not set this, your new implementation will not work
	Parent IEntryGenerator
	// contains filtered or unexported fields
}

EntryGenCore has functions that all entry gens can use (or override)

func (*EntryGenCore) AllEntries

func (*EntryGenCore) GetECKey

func (r *EntryGenCore) GetECKey() primitives.PrivateKey

func (*EntryGenCore) InitThreadPool

func (r *EntryGenCore) InitThreadPool()

func (*EntryGenCore) NewChainHead

func (r *EntryGenCore) NewChainHead() *entryBlock.Entry

func (*EntryGenCore) NewCommit

func (*EntryGenCore) NewEblock

func (*EntryGenCore) NewEntry

func (r *EntryGenCore) NewEntry(chain interfaces.IHash) *entryBlock.Entry

func (*EntryGenCore) SignCommit

type EntryGeneratorConfig

type EntryGeneratorConfig struct {
	EntriesPerEBlock Range
	EntrySize        Range
	EblocksPerHeight Range

	// MultiThread Stuff
	Multithreaded   bool
	ThreadpoolCount int
}

func NewDefaultEntryGeneratorConfig

func NewDefaultEntryGeneratorConfig() *EntryGeneratorConfig

type FullEntryGenerator

type FullEntryGenerator struct {
	FKey primitives.PrivateKey
	IEntryGenerator
	Config EntryGeneratorConfig
}

Generates ECBlock, EBlocks, Entries, and Factoid transactions

func NewFullEntryGenerator

func NewFullEntryGenerator(ecKey, fKey primitives.PrivateKey, config DBGeneratorConfig) *FullEntryGenerator

func (*FullEntryGenerator) NewBlockSet

func (f *FullEntryGenerator) NewBlockSet(prev *state.DBState, newtime interfaces.Timestamp) (*state.DBState, error)

type IAuthSigner

type IAuthSigner interface {
	SignBlock(prev *state.DBState) interfaces.IAdminBlock
}

IAuthSigner is an interface that is able to return dbsigs given a previous block.

It keeps track of authority sets and keys

type IEntryGenerator

type IEntryGenerator interface {
	AllEntries(height uint32, time interfaces.Timestamp) ([]*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
	NewEblock(height uint32, time interfaces.Timestamp) (*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
	NewChainHead() *entryBlock.Entry
	NewEntry(chain interfaces.IHash) *entryBlock.Entry

	GetECKey() primitives.PrivateKey
	Name() string
}

type IFullEntryGenerator

type IFullEntryGenerator interface {
	NewBlockSet(dbs *state.DBState, newtime interfaces.Timestamp) (*state.DBState, error)
}

type IncrementEntryGenerator

type IncrementEntryGenerator struct {
	EntryGenCore // Has supporting functions and fields
	// contains filtered or unexported fields
}

IncrementEntryGenerator generates entries of incrementing count

The count is reset per chain.

func (*IncrementEntryGenerator) AllEntries

Default implementation

func (*IncrementEntryGenerator) Name

func (r *IncrementEntryGenerator) Name() string

func (*IncrementEntryGenerator) NewChainHead

func (r *IncrementEntryGenerator) NewChainHead() *entryBlock.Entry

func (*IncrementEntryGenerator) NewEblock

func (*IncrementEntryGenerator) NewEntry

type Job

type Job struct {
	Height uint32
	Time   interfaces.Timestamp
}

type RandomEntryGenerator

type RandomEntryGenerator struct {
	EntryGenCore // Has supporting functions and fields
}

RandomEntryGenerator generates random entries between 0-10kbish

It does not override any of the core functions

func NewRandomEntryGenerator

func NewRandomEntryGenerator(ecKey primitives.PrivateKey, config EntryGeneratorConfig) *RandomEntryGenerator

func (*RandomEntryGenerator) AllEntries

Default implementation

func (*RandomEntryGenerator) Name

func (r *RandomEntryGenerator) Name() string

func (*RandomEntryGenerator) NewChainHead

func (r *RandomEntryGenerator) NewChainHead() *entryBlock.Entry

func (*RandomEntryGenerator) NewEblock

func (*RandomEntryGenerator) NewEntry

type Range

type Range struct {
	Min int
	Max int
}

func (Range) Amount

func (r Range) Amount() int

type RecordEntryGenerator

type RecordEntryGenerator struct {
	EntryGenCore // Has supporting functions and fields
}

RecordEntryGenerator

func NewRecordEntryGenerator

func NewRecordEntryGenerator(ecKey primitives.PrivateKey, config EntryGeneratorConfig) *RecordEntryGenerator

func (*RecordEntryGenerator) AllEntries

Default implementation

func (*RecordEntryGenerator) Name

func (r *RecordEntryGenerator) Name() string

func (*RecordEntryGenerator) NewChainHead

func (r *RecordEntryGenerator) NewChainHead() *entryBlock.Entry

func (*RecordEntryGenerator) NewEblock

func (*RecordEntryGenerator) NewEntry

type Resp

type Resp struct {
	Neb *entryBlock.EBlock
	Nec []*entryCreditBlock.CommitEntry
	Nes []*entryBlock.Entry
	T   int
}

Jump to

Keyboard shortcuts

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