Documentation ¶
Index ¶
- func BuyEC(from primitives.PrivateKey, to *primitives.PublicKey, ecamount uint64, ...) (*factoid.Transaction, error)
- func NewGeneratorState(conf *DBGeneratorConfig, starttime interfaces.Timestamp) *state.State
- type BlockGen
- type DBGenerator
- type DBGeneratorConfig
- type DefaultAuthSigner
- type EntryGenCore
- func (r *EntryGenCore) AllEntries(height uint32, time interfaces.Timestamp) ([]*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, ...)
- func (r *EntryGenCore) GetECKey() primitives.PrivateKey
- func (r *EntryGenCore) InitThreadPool()
- func (r *EntryGenCore) NewChainHead() *entryBlock.Entry
- func (r *EntryGenCore) NewCommit(e *entryBlock.Entry, time interfaces.Timestamp) *entryCreditBlock.CommitEntry
- func (r *EntryGenCore) NewEblock(height uint32, time interfaces.Timestamp) (*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
- func (r *EntryGenCore) NewEntry(chain interfaces.IHash) *entryBlock.Entry
- func (r *EntryGenCore) SignCommit(entry *entryCreditBlock.CommitEntry) *entryCreditBlock.CommitEntry
- type EntryGeneratorConfig
- type FullEntryGenerator
- type IAuthSigner
- type IEntryGenerator
- type IFullEntryGenerator
- type IncrementEntryGenerator
- func (r *IncrementEntryGenerator) AllEntries(height uint32, time interfaces.Timestamp) ([]*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, ...)
- func (r *IncrementEntryGenerator) Name() string
- func (r *IncrementEntryGenerator) NewChainHead() *entryBlock.Entry
- func (r *IncrementEntryGenerator) NewEblock(height uint32, time interfaces.Timestamp) (*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
- func (r *IncrementEntryGenerator) NewEntry(chain interfaces.IHash) *entryBlock.Entry
- type Job
- type RandomEntryGenerator
- func (r *RandomEntryGenerator) AllEntries(height uint32, time interfaces.Timestamp) ([]*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, ...)
- func (r *RandomEntryGenerator) Name() string
- func (r *RandomEntryGenerator) NewChainHead() *entryBlock.Entry
- func (r *RandomEntryGenerator) NewEblock(height uint32, time interfaces.Timestamp) (*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
- func (r *RandomEntryGenerator) NewEntry(chain interfaces.IHash) *entryBlock.Entry
- type Range
- type RecordEntryGenerator
- func (r *RecordEntryGenerator) AllEntries(height uint32, time interfaces.Timestamp) ([]*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, ...)
- func (r *RecordEntryGenerator) Name() string
- func (r *RecordEntryGenerator) NewChainHead() *entryBlock.Entry
- func (r *RecordEntryGenerator) NewEblock(height uint32, time interfaces.Timestamp) (*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
- func (r *RecordEntryGenerator) NewEntry(chain interfaces.IHash) *entryBlock.Entry
- type Resp
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 { // We need to process blocks to get state values // and ensure the data is correct FactomdState *state.State // 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 FactomdConfigPath string CustomNetID string StartTime string EntryGenerator string LoopsPerPrint int EntryGenConfig EntryGeneratorConfig }
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 ¶
func (DefaultAuthSigner) SignBlock(prev *state.DBState) interfaces.IAdminBlock
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 (r *EntryGenCore) AllEntries(height uint32, time interfaces.Timestamp) ([]*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
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 (r *EntryGenCore) NewCommit(e *entryBlock.Entry, time interfaces.Timestamp) *entryCreditBlock.CommitEntry
func (*EntryGenCore) NewEblock ¶
func (r *EntryGenCore) NewEblock(height uint32, time interfaces.Timestamp) (*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
func (*EntryGenCore) NewEntry ¶
func (r *EntryGenCore) NewEntry(chain interfaces.IHash) *entryBlock.Entry
func (*EntryGenCore) SignCommit ¶
func (r *EntryGenCore) SignCommit(entry *entryCreditBlock.CommitEntry) *entryCreditBlock.CommitEntry
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 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 NewIncrementEntryGenerator ¶
func NewIncrementEntryGenerator(ecKey primitives.PrivateKey, config EntryGeneratorConfig) *IncrementEntryGenerator
func (*IncrementEntryGenerator) AllEntries ¶
func (r *IncrementEntryGenerator) AllEntries(height uint32, time interfaces.Timestamp) ([]*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
Default implementation
func (*IncrementEntryGenerator) Name ¶
func (r *IncrementEntryGenerator) Name() string
func (*IncrementEntryGenerator) NewChainHead ¶
func (r *IncrementEntryGenerator) NewChainHead() *entryBlock.Entry
func (*IncrementEntryGenerator) NewEblock ¶
func (r *IncrementEntryGenerator) NewEblock(height uint32, time interfaces.Timestamp) (*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
func (*IncrementEntryGenerator) NewEntry ¶
func (r *IncrementEntryGenerator) NewEntry(chain interfaces.IHash) *entryBlock.Entry
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 ¶
func (r *RandomEntryGenerator) AllEntries(height uint32, time interfaces.Timestamp) ([]*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
Default implementation
func (*RandomEntryGenerator) Name ¶
func (r *RandomEntryGenerator) Name() string
func (*RandomEntryGenerator) NewChainHead ¶
func (r *RandomEntryGenerator) NewChainHead() *entryBlock.Entry
func (*RandomEntryGenerator) NewEblock ¶
func (r *RandomEntryGenerator) NewEblock(height uint32, time interfaces.Timestamp) (*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
func (*RandomEntryGenerator) NewEntry ¶
func (r *RandomEntryGenerator) NewEntry(chain interfaces.IHash) *entryBlock.Entry
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 ¶
func (r *RecordEntryGenerator) AllEntries(height uint32, time interfaces.Timestamp) ([]*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
Default implementation
func (*RecordEntryGenerator) Name ¶
func (r *RecordEntryGenerator) Name() string
func (*RecordEntryGenerator) NewChainHead ¶
func (r *RecordEntryGenerator) NewChainHead() *entryBlock.Entry
func (*RecordEntryGenerator) NewEblock ¶
func (r *RecordEntryGenerator) NewEblock(height uint32, time interfaces.Timestamp) (*entryBlock.EBlock, []*entryBlock.Entry, []*entryCreditBlock.CommitEntry, int)
func (*RecordEntryGenerator) NewEntry ¶
func (r *RecordEntryGenerator) NewEntry(chain interfaces.IHash) *entryBlock.Entry
type Resp ¶
type Resp struct { Neb *entryBlock.EBlock Nec []*entryCreditBlock.CommitEntry Nes []*entryBlock.Entry T int }