service

package
v0.0.0-...-868bdbc Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadStateDB

func LoadStateDB(exBal external.BalanceStorage)

LoadStateDB loads the state trie db

Types

type Supervisor

type Supervisor struct {
	TxBatches *[]txbyte.Txs // TxGroups will consist of list of the transaction batches

	ChildBlock          []*protobuf.ChildBlock
	Validator           map[string]*protobuf.Validator
	ValidatorChildblock map[string]*protobuf.BlockID //Validator address pointing to child block hash
	VoteInfoData        map[string][]*protobuf.VoteInfo
	// contains filtered or unexported fields
}

Supervisor is concrete implementation of SupervisorI

func (*Supervisor) AddValidator

func (s *Supervisor) AddValidator(publicKey []byte, address string) error

AddValidator adds a validator to group

func (*Supervisor) Backup

func (s *Supervisor) Backup() bool

Backup sets Supervisor backup to S3 process

func (*Supervisor) CreateBaseBlock

func (s *Supervisor) CreateBaseBlock(lastBlock *protobuf.BaseBlock) (*protobuf.BaseBlock, error)

CreateBaseBlock creates the base block with all the child blocks

func (*Supervisor) CreateChildBlock

func (s *Supervisor) CreateChildBlock(net *network.Network, txs *transaction.TxList, height int64, previousBlockHash []byte) *protobuf.ChildBlock

CreateChildBlock creates an initial child block

func (*Supervisor) Env

func (s *Supervisor) Env() string

Env returns environment name

func (*Supervisor) GetChildBlockMerkleHash

func (s *Supervisor) GetChildBlockMerkleHash() ([]byte, error)

GetChildBlockMerkleHash creates merkle hash of all the child blocks

func (*Supervisor) GetMutex

func (s *Supervisor) GetMutex() *sync.Mutex

GetMutex ...

func (*Supervisor) GetNextValidatorGroupHash

func (s *Supervisor) GetNextValidatorGroupHash() ([]byte, error)

GetNextValidatorGroupHash ([]byte, error) creates merkle hash of all the next validators TODO: refine logic, currently, it's the same as s.GetValidatorGroupHash.

func (*Supervisor) GetValidatorGroupHash

func (s *Supervisor) GetValidatorGroupHash() ([]byte, error)

GetValidatorGroupHash creates merkle hash of all the validators

func (*Supervisor) NoOfPeersInGroup

func (s *Supervisor) NoOfPeersInGroup() int

NoOfPeersInGroup ...

func (*Supervisor) ProcessTxs

func (s *Supervisor) ProcessTxs(lastBlock *protobuf.BaseBlock, net *network.Network) (*protobuf.BaseBlock, error)

ProcessTxs will process transactions. It will check whether to send the transactions to Validators or to be included in Singular base block

func (*Supervisor) RemoveValidator

func (s *Supervisor) RemoveValidator(address string)

RemoveValidator removes a validator from validators list

func (*Supervisor) SetBackup

func (s *Supervisor) SetBackup(backup bool)

SetBackup sets Supervisor backup to S3 process

func (*Supervisor) SetEnv

func (s *Supervisor) SetEnv(env string)

SetEnv sets Supervisor environment

func (*Supervisor) SetNoOfPeersInGroup

func (s *Supervisor) SetNoOfPeersInGroup(n int)

SetNoOfPeersInGroup ...

func (*Supervisor) SetStateRoot

func (s *Supervisor) SetStateRoot(stateRoot []byte)

SetStateRoot sets Supervisor state root

func (*Supervisor) SetWaitTime

func (s *Supervisor) SetWaitTime(waitTime int)

SetWaitTime sets Supervisor wait time

func (*Supervisor) SetWriteMutex

func (s *Supervisor) SetWriteMutex()

SetWriteMutex ...

func (*Supervisor) ShardToValidators

func (s *Supervisor) ShardToValidators(lastBlock *protobuf.BaseBlock, txs txbyte.Txs, net *network.Network, stateRoot []byte) (*protobuf.BaseBlock, error)

ShardToValidators distributes a series of childblocks to a series of validators

func (*Supervisor) StateRoot

func (s *Supervisor) StateRoot() []byte

StateRoot returns Supervisor current state root

func (*Supervisor) WaitTime

func (s *Supervisor) WaitTime() int

WaitTime returns wait time value

type SupervisorI

type SupervisorI interface {
	AddValidator(publicKey []byte, address string) error
	RemoveValidator(address string)
	CreateChildBlock(net *network.Network, txs *transaction.TxList, height int64, previousBlockHash []byte) *protobuf.ChildBlock
	SetWriteMutex()
	SetBackup(bool)
	GetChildBlockMerkleHash() ([]byte, error)
	GetValidatorGroupHash() ([]byte, error)
	GetNextValidatorGroupHash() ([]byte, error)
	CreateBaseBlock(lastBlock *protobuf.BaseBlock) (*protobuf.BaseBlock, error)
	GetMutex() *sync.Mutex
	ProcessTxs(lastBlock *protobuf.BaseBlock, net *network.Network) (*protobuf.BaseBlock, error)
	ShardToValidators(*protobuf.BaseBlock, txbyte.Txs, *network.Network, []byte) (*protobuf.BaseBlock, error)
}

SupervisorI is an interface

Jump to

Keyboard shortcuts

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