Documentation ¶
Index ¶
- func LoadStateDB(exBal external.BalanceStorage)
- type Supervisor
- func (s *Supervisor) AddValidator(publicKey []byte, address string) error
- func (s *Supervisor) Backup() bool
- func (s *Supervisor) CreateBaseBlock(lastBlock *protobuf.BaseBlock) (*protobuf.BaseBlock, error)
- func (s *Supervisor) CreateChildBlock(net *network.Network, txs *transaction.TxList, height int64, ...) *protobuf.ChildBlock
- func (s *Supervisor) Env() string
- func (s *Supervisor) GetChildBlockMerkleHash() ([]byte, error)
- func (s *Supervisor) GetMutex() *sync.Mutex
- func (s *Supervisor) GetNextValidatorGroupHash() ([]byte, error)
- func (s *Supervisor) GetValidatorGroupHash() ([]byte, error)
- func (s *Supervisor) NoOfPeersInGroup() int
- func (s *Supervisor) ProcessTxs(lastBlock *protobuf.BaseBlock, net *network.Network) (*protobuf.BaseBlock, error)
- func (s *Supervisor) RemoveValidator(address string)
- func (s *Supervisor) SetBackup(backup bool)
- func (s *Supervisor) SetEnv(env string)
- func (s *Supervisor) SetNoOfPeersInGroup(n int)
- func (s *Supervisor) SetStateRoot(stateRoot []byte)
- func (s *Supervisor) SetWaitTime(waitTime int)
- func (s *Supervisor) SetWriteMutex()
- func (s *Supervisor) ShardToValidators(lastBlock *protobuf.BaseBlock, txs txbyte.Txs, net *network.Network, ...) (*protobuf.BaseBlock, error)
- func (s *Supervisor) StateRoot() []byte
- func (s *Supervisor) WaitTime() int
- type SupervisorI
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 ¶
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) GetChildBlockMerkleHash ¶
func (s *Supervisor) GetChildBlockMerkleHash() ([]byte, error)
GetChildBlockMerkleHash creates merkle hash of all the child blocks
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) 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
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