Documentation ¶
Index ¶
- Constants
- Variables
- func IsDup(err error) bool
- func MakeVoteKey(otprn common.Hash, blockNum *big.Int) common.Hash
- func RecvOtprn(s *mongo.SingleResult) (*types.Otprn, error)
- func TransBlock(block *types.Block) fntype.Block
- func TransOtprn(otprn types.Otprn) (fntype.Otprn, error)
- func TransTransaction(block *types.Block, chainID *big.Int, txC *mongo.Collection)
- type FairnodeDB
- type MemDatabase
- func (m *MemDatabase) CurrentBlock() *types.Block
- func (m *MemDatabase) CurrentInfo() *types.CurrentInfo
- func (m *MemDatabase) CurrentOtprn() *types.Otprn
- func (m *MemDatabase) DeletedBlockChangeState(blockHash common.Hash)
- func (m *MemDatabase) GetActiveNode() []types.HeartBeat
- func (m *MemDatabase) GetBlock(blockHash common.Hash) *types.Block
- func (m *MemDatabase) GetChainConfig() *types.ChainConfig
- func (m *MemDatabase) GetLeagueList(otprnHash common.Hash) []types.HeartBeat
- func (m *MemDatabase) GetOtprn(otprnHash common.Hash) *types.Otprn
- func (m *MemDatabase) GetVoters(votekey common.Hash) []*types.Voter
- func (m *MemDatabase) InitActiveNode()
- func (m *MemDatabase) RemoveActiveNode(enode string)
- func (m *MemDatabase) RemoveBlock(blockHash common.Hash)
- func (m *MemDatabase) SaveActiveNode(node types.HeartBeat)
- func (m *MemDatabase) SaveChainConfig(config *types.ChainConfig) error
- func (m *MemDatabase) SaveFinalBlock(block *types.Block, byteBlock []byte) error
- func (m *MemDatabase) SaveLeague(otprnHash common.Hash, enode string)
- func (m *MemDatabase) SaveOtprn(otprn types.Otprn)
- func (m *MemDatabase) SaveVote(otprn common.Hash, blockNum *big.Int, vote *types.Voter)
- func (m *MemDatabase) Start() error
- func (m *MemDatabase) Stop()
- type MongoDatabase
- func (m *MongoDatabase) CurrentBlock() *types.Block
- func (m *MongoDatabase) CurrentInfo() *types.CurrentInfo
- func (m *MongoDatabase) CurrentOtprn() *types.Otprn
- func (m *MongoDatabase) DeletedBlockChangeState(blockHash common.Hash)
- func (m *MongoDatabase) GetActiveFairnodes() map[common.Hash]map[string]string
- func (m *MongoDatabase) GetActiveNode() []types.HeartBeat
- func (m *MongoDatabase) GetBlock(blockHash common.Hash) *types.Block
- func (m *MongoDatabase) GetChainConfig() *types.ChainConfig
- func (m *MongoDatabase) GetLeagueList(otprnHash common.Hash) []types.HeartBeat
- func (m *MongoDatabase) GetOtprn(otprnHash common.Hash) *types.Otprn
- func (m *MongoDatabase) GetVoters(votekey common.Hash) []*types.Voter
- func (m *MongoDatabase) InitActiveNode()
- func (m *MongoDatabase) InsertActiveFairnode(nodeKey common.Hash, address string)
- func (m *MongoDatabase) RemoveActiveFairnode(nodeKey common.Hash)
- func (m *MongoDatabase) RemoveActiveNode(enode string)
- func (m *MongoDatabase) RemoveBlock(blockHash common.Hash)
- func (m *MongoDatabase) SaveActiveNode(node types.HeartBeat)
- func (m *MongoDatabase) SaveChainConfig(config *types.ChainConfig) error
- func (m *MongoDatabase) SaveFinalBlock(block *types.Block, byteBlock []byte) error
- func (m *MongoDatabase) SaveLeague(otprnHash common.Hash, enode string)
- func (m *MongoDatabase) SaveOtprn(otprn types.Otprn)
- func (m *MongoDatabase) SaveVote(otprn common.Hash, blockNum *big.Int, vote *types.Voter)
- func (m *MongoDatabase) Start() error
- func (m *MongoDatabase) Stop()
- func (m *MongoDatabase) UpdateActiveFairnode(nodeKey common.Hash, status uint64)
Constants ¶
View Source
const ( PENDING stType = iota LEADER FOLLOWER )
View Source
const DbName = "Anduschain"
Variables ¶
View Source
var ( MongDBConnectError = errors.New("fail to connecting mongo database") MongDBPingFail = errors.New("ping failed") )
View Source
var (
ErrAlreadyExistBlock = errors.New("already exist block")
)
Functions ¶
func TransTransaction ¶
Types ¶
type FairnodeDB ¶
type FairnodeDB interface { Start() error Stop() GetChainConfig() *types.ChainConfig SaveChainConfig(config *types.ChainConfig) error CurrentInfo() *types.CurrentInfo CurrentBlock() *types.Block CurrentOtprn() *types.Otprn InitActiveNode() SaveActiveNode(node types.HeartBeat) GetActiveNode() []types.HeartBeat RemoveActiveNode(enode string) SaveOtprn(otprn types.Otprn) GetOtprn(otprnHash common.Hash) *types.Otprn SaveLeague(otprnHash common.Hash, enode string) GetLeagueList(otprnHash common.Hash) []types.HeartBeat SaveVote(otprn common.Hash, blockNum *big.Int, vote *types.Voter) GetVoters(votekey common.Hash) []*types.Voter SaveFinalBlock(block *types.Block, byteBlock []byte) error GetBlock(blockHash common.Hash) *types.Block RemoveBlock(blockHash common.Hash) DeletedBlockChangeState(blockHash common.Hash) }
type MemDatabase ¶
type MemDatabase struct { CurBlock *types.Block CurOtprn *types.Otprn ConfigList map[common.Hash]types.ChainConfig NodeList map[string]types.HeartBeat OtprnList []types.Otprn LeagueList map[common.Hash]map[string]types.HeartBeat VoteList map[common.Hash][]*types.Voter BlockChain []*types.Block // contains filtered or unexported fields }
func NewMemDatabase ¶
func NewMemDatabase() *MemDatabase
func (*MemDatabase) CurrentBlock ¶
func (m *MemDatabase) CurrentBlock() *types.Block
func (*MemDatabase) CurrentInfo ¶
func (m *MemDatabase) CurrentInfo() *types.CurrentInfo
func (*MemDatabase) CurrentOtprn ¶
func (m *MemDatabase) CurrentOtprn() *types.Otprn
func (*MemDatabase) DeletedBlockChangeState ¶ added in v0.7.6
func (m *MemDatabase) DeletedBlockChangeState(blockHash common.Hash)
func (*MemDatabase) GetActiveNode ¶
func (m *MemDatabase) GetActiveNode() []types.HeartBeat
func (*MemDatabase) GetChainConfig ¶
func (m *MemDatabase) GetChainConfig() *types.ChainConfig
func (*MemDatabase) GetLeagueList ¶
func (m *MemDatabase) GetLeagueList(otprnHash common.Hash) []types.HeartBeat
func (*MemDatabase) InitActiveNode ¶
func (m *MemDatabase) InitActiveNode()
func (*MemDatabase) RemoveActiveNode ¶
func (m *MemDatabase) RemoveActiveNode(enode string)
func (*MemDatabase) RemoveBlock ¶
func (m *MemDatabase) RemoveBlock(blockHash common.Hash)
func (*MemDatabase) SaveActiveNode ¶
func (m *MemDatabase) SaveActiveNode(node types.HeartBeat)
func (*MemDatabase) SaveChainConfig ¶
func (m *MemDatabase) SaveChainConfig(config *types.ChainConfig) error
func (*MemDatabase) SaveFinalBlock ¶
func (m *MemDatabase) SaveFinalBlock(block *types.Block, byteBlock []byte) error
func (*MemDatabase) SaveLeague ¶
func (m *MemDatabase) SaveLeague(otprnHash common.Hash, enode string)
func (*MemDatabase) SaveOtprn ¶
func (m *MemDatabase) SaveOtprn(otprn types.Otprn)
func (*MemDatabase) Start ¶
func (m *MemDatabase) Start() error
func (*MemDatabase) Stop ¶
func (m *MemDatabase) Stop()
type MongoDatabase ¶
type MongoDatabase struct {
// contains filtered or unexported fields
}
func NewMongoDatabase ¶
func NewMongoDatabase(conf config) (*MongoDatabase, error)
func (*MongoDatabase) CurrentBlock ¶
func (m *MongoDatabase) CurrentBlock() *types.Block
func (*MongoDatabase) CurrentInfo ¶
func (m *MongoDatabase) CurrentInfo() *types.CurrentInfo
func (*MongoDatabase) CurrentOtprn ¶
func (m *MongoDatabase) CurrentOtprn() *types.Otprn
func (*MongoDatabase) DeletedBlockChangeState ¶ added in v0.7.6
func (m *MongoDatabase) DeletedBlockChangeState(blockHash common.Hash)
voter가 0일때 블록 번호를 -로 바꿔서 업데이트
func (*MongoDatabase) GetActiveFairnodes ¶
func (m *MongoDatabase) GetActiveFairnodes() map[common.Hash]map[string]string
func (*MongoDatabase) GetActiveNode ¶
func (m *MongoDatabase) GetActiveNode() []types.HeartBeat
func (*MongoDatabase) GetBlock ¶
func (m *MongoDatabase) GetBlock(blockHash common.Hash) *types.Block
func (*MongoDatabase) GetChainConfig ¶
func (m *MongoDatabase) GetChainConfig() *types.ChainConfig
func (*MongoDatabase) GetLeagueList ¶
func (m *MongoDatabase) GetLeagueList(otprnHash common.Hash) []types.HeartBeat
func (*MongoDatabase) GetOtprn ¶
func (m *MongoDatabase) GetOtprn(otprnHash common.Hash) *types.Otprn
func (*MongoDatabase) GetVoters ¶
func (m *MongoDatabase) GetVoters(votekey common.Hash) []*types.Voter
func (*MongoDatabase) InitActiveNode ¶
func (m *MongoDatabase) InitActiveNode()
Fairnode가 기동될 때, 기존 노드 정보를 지운다. (새로 갱신함)
func (*MongoDatabase) InsertActiveFairnode ¶
func (m *MongoDatabase) InsertActiveFairnode(nodeKey common.Hash, address string)
func (*MongoDatabase) RemoveActiveFairnode ¶
func (m *MongoDatabase) RemoveActiveFairnode(nodeKey common.Hash)
func (*MongoDatabase) RemoveActiveNode ¶
func (m *MongoDatabase) RemoveActiveNode(enode string)
func (*MongoDatabase) RemoveBlock ¶
func (m *MongoDatabase) RemoveBlock(blockHash common.Hash)
func (*MongoDatabase) SaveActiveNode ¶
func (m *MongoDatabase) SaveActiveNode(node types.HeartBeat)
func (*MongoDatabase) SaveChainConfig ¶
func (m *MongoDatabase) SaveChainConfig(config *types.ChainConfig) error
func (*MongoDatabase) SaveFinalBlock ¶
func (m *MongoDatabase) SaveFinalBlock(block *types.Block, byteBlock []byte) error
func (*MongoDatabase) SaveLeague ¶
func (m *MongoDatabase) SaveLeague(otprnHash common.Hash, enode string)
func (*MongoDatabase) SaveOtprn ¶
func (m *MongoDatabase) SaveOtprn(otprn types.Otprn)
func (*MongoDatabase) Start ¶
func (m *MongoDatabase) Start() error
func (*MongoDatabase) Stop ¶
func (m *MongoDatabase) Stop()
func (*MongoDatabase) UpdateActiveFairnode ¶
func (m *MongoDatabase) UpdateActiveFairnode(nodeKey common.Hash, status uint64)
Click to show internal directories.
Click to hide internal directories.