Documentation ¶
Index ¶
- Constants
- Variables
- func InitArbitrators(arConfig ArbitratorsConfig)
- func NewDposStore(filePath string) (interfaces.IDposStore, error)
- type Arbitrators
- func (a *Arbitrators) ForceChange() error
- func (a *Arbitrators) GetArbitrators() [][]byte
- func (a *Arbitrators) GetArbitratorsProgramHashes() []*common.Uint168
- func (a *Arbitrators) GetCandidates() [][]byte
- func (a *Arbitrators) GetCandidatesProgramHashes() []*common.Uint168
- func (a *Arbitrators) GetNextArbitrators() [][]byte
- func (a *Arbitrators) GetNextCandidates() [][]byte
- func (a *Arbitrators) GetNextOnDutyArbitrator(offset uint32) []byte
- func (a *Arbitrators) GetOnDutyArbitrator() []byte
- func (a *Arbitrators) HasArbitersMajorityCount(num uint32) bool
- func (a *Arbitrators) HasArbitersMinorityCount(num uint32) bool
- func (a *Arbitrators) OnBlockReceived(b *types.Block, confirmed bool)
- func (a *Arbitrators) OnConfirmReceived(p *types.DPosProposalVoteSlot)
- func (a *Arbitrators) RegisterListener(listener interfaces.ArbitratorsListener)
- func (a *Arbitrators) StartUp() error
- func (a *Arbitrators) UnregisterListener(listener interfaces.ArbitratorsListener)
- type ArbitratorsConfig
- type Batch
- type DataEntryPrefix
- type Database
- type DposStore
- func (s *DposStore) AddConsensusEvent(event interface{}) error
- func (s *DposStore) AddProposalEvent(event interface{}) error
- func (s *DposStore) AddViewEvent(event interface{}) error
- func (s *DposStore) AddVoteEvent(event interface{}) error
- func (s *DposStore) Create(table *interfaces.DBTable) error
- func (s *DposStore) Disconnect() error
- func (s *DposStore) GetArbitrators(a interfaces.Arbitrators) error
- func (s *DposStore) GetDirectPeers() ([]*interfaces.DirectPeers, error)
- func (s *DposStore) InitConnection(connParams ...interface{}) error
- func (s *DposStore) Insert(table *interfaces.DBTable, fields []*interfaces.Field) (uint64, error)
- func (s *DposStore) SaveCurrentArbitrators(a interfaces.Arbitrators)
- func (s *DposStore) SaveDirectPeers(p []*interfaces.DirectPeers)
- func (s *DposStore) SaveDposDutyChangedCount(c uint32)
- func (s *DposStore) SaveNextArbitrators(a interfaces.Arbitrators)
- func (s *DposStore) Select(table *interfaces.DBTable, inputFields []*interfaces.Field) ([][]*interfaces.Field, error)
- func (s *DposStore) SelectID(table *interfaces.DBTable, inputFields []*interfaces.Field) ([]uint64, error)
- func (s *DposStore) StartRecordArbitrators()
- func (s *DposStore) StartRecordEvent() error
- func (s *DposStore) Update(table *interfaces.DBTable, inputFields []*interfaces.Field, ...) ([]uint64, error)
- func (s *DposStore) UpdateConsensusEvent(event interface{}) error
- func (s *DposStore) UpdateProposalEvent(event interface{}) error
- type EventRecord
- func (e *EventRecord) Initialize(store interfaces.IEventRecord)
- func (e *EventRecord) OnConsensusFinished(cons *log.ConsensusEvent)
- func (e *EventRecord) OnConsensusStarted(cons *log.ConsensusEvent)
- func (e *EventRecord) OnProposalArrived(prop *log.ProposalEvent)
- func (e *EventRecord) OnProposalFinished(prop *log.ProposalEvent)
- func (e *EventRecord) OnViewStarted(view *log.ViewEvent)
- func (e *EventRecord) OnVoteArrived(vote *log.VoteEvent)
- type LevelDB
Constants ¶
View Source
const BITSPERKEY = 10
used to compute the size of bloom filter bits array . too small will lead to high false positive rate.
View Source
const (
MaxEvnetTaskNumber = 10000
)
Variables ¶
View Source
var ConsensusEventTable = &interfaces.DBTable{ Name: "ConsensusEvent", PrimaryKey: 4, Indexes: []uint64{3}, Fields: []string{ "StartTime", "EndTime", "Height", "RawData", }, }
View Source
var ProposalEventTable = &interfaces.DBTable{ Name: "ProposalEvent", PrimaryKey: 7, Indexes: []uint64{1, 2, 6}, Fields: []string{ "Proposal", "BlockHash", "ReceivedTime", "EndTime", "Result", "ProposalHash", "RawData", }, }
View Source
var ViewEventTable = &interfaces.DBTable{ Name: "ViewEvent", PrimaryKey: 0, Indexes: nil, Fields: []string{ "ConsensusID", "OnDutyArbitrator", "StartTime", "Offset", }, }
View Source
var VoteEventTable = &interfaces.DBTable{ Name: "VoteEvent", PrimaryKey: 0, Indexes: nil, Fields: []string{ "ProposalID", "Signer", "ReceivedTime", "Result", "RawData", }, }
Functions ¶
func InitArbitrators ¶
func InitArbitrators(arConfig ArbitratorsConfig)
func NewDposStore ¶
func NewDposStore(filePath string) (interfaces.IDposStore, error)
Types ¶
type Arbitrators ¶
type Arbitrators struct { DutyChangedCount uint32 // contains filtered or unexported fields }
func (*Arbitrators) ForceChange ¶
func (a *Arbitrators) ForceChange() error
func (*Arbitrators) GetArbitrators ¶
func (a *Arbitrators) GetArbitrators() [][]byte
func (*Arbitrators) GetArbitratorsProgramHashes ¶
func (a *Arbitrators) GetArbitratorsProgramHashes() []*common.Uint168
func (*Arbitrators) GetCandidates ¶
func (a *Arbitrators) GetCandidates() [][]byte
func (*Arbitrators) GetCandidatesProgramHashes ¶
func (a *Arbitrators) GetCandidatesProgramHashes() []*common.Uint168
func (*Arbitrators) GetNextArbitrators ¶
func (a *Arbitrators) GetNextArbitrators() [][]byte
func (*Arbitrators) GetNextCandidates ¶
func (a *Arbitrators) GetNextCandidates() [][]byte
func (*Arbitrators) GetNextOnDutyArbitrator ¶
func (a *Arbitrators) GetNextOnDutyArbitrator(offset uint32) []byte
func (*Arbitrators) GetOnDutyArbitrator ¶
func (a *Arbitrators) GetOnDutyArbitrator() []byte
func (*Arbitrators) HasArbitersMajorityCount ¶
func (a *Arbitrators) HasArbitersMajorityCount(num uint32) bool
func (*Arbitrators) HasArbitersMinorityCount ¶
func (a *Arbitrators) HasArbitersMinorityCount(num uint32) bool
func (*Arbitrators) OnBlockReceived ¶
func (a *Arbitrators) OnBlockReceived(b *types.Block, confirmed bool)
func (*Arbitrators) OnConfirmReceived ¶
func (a *Arbitrators) OnConfirmReceived(p *types.DPosProposalVoteSlot)
func (*Arbitrators) RegisterListener ¶
func (a *Arbitrators) RegisterListener(listener interfaces.ArbitratorsListener)
func (*Arbitrators) StartUp ¶
func (a *Arbitrators) StartUp() error
func (*Arbitrators) UnregisterListener ¶
func (a *Arbitrators) UnregisterListener(listener interfaces.ArbitratorsListener)
type ArbitratorsConfig ¶
type ArbitratorsConfig struct { ArbitratorsCount uint32 CandidatesCount uint32 MajorityCount uint32 Store interfaces.IDposStore }
type DataEntryPrefix ¶
type DataEntryPrefix byte
DataEntryPrefix
const ( // DPOS DPOSDutyChangedCount DataEntryPrefix = 0x11 DPOSCurrentArbitrators DataEntryPrefix = 0x12 DPOSCurrentCandidates DataEntryPrefix = 0x13 DPOSNextArbitrators DataEntryPrefix = 0x14 DPOSNextCandidates DataEntryPrefix = 0x15 DPOSDirectPeers DataEntryPrefix = 0x16 )
type DposStore ¶
type DposStore struct { Database // contains filtered or unexported fields }
func (*DposStore) AddConsensusEvent ¶
func (*DposStore) AddProposalEvent ¶
func (*DposStore) AddViewEvent ¶
func (*DposStore) AddVoteEvent ¶
func (*DposStore) Disconnect ¶
func (*DposStore) GetArbitrators ¶
func (s *DposStore) GetArbitrators(a interfaces.Arbitrators) error
func (*DposStore) GetDirectPeers ¶
func (s *DposStore) GetDirectPeers() ([]*interfaces.DirectPeers, error)
func (*DposStore) InitConnection ¶
func (*DposStore) Insert ¶
func (s *DposStore) Insert(table *interfaces.DBTable, fields []*interfaces.Field) (uint64, error)
func (*DposStore) SaveCurrentArbitrators ¶
func (s *DposStore) SaveCurrentArbitrators(a interfaces.Arbitrators)
func (*DposStore) SaveDirectPeers ¶
func (s *DposStore) SaveDirectPeers(p []*interfaces.DirectPeers)
func (*DposStore) SaveDposDutyChangedCount ¶
func (*DposStore) SaveNextArbitrators ¶
func (s *DposStore) SaveNextArbitrators(a interfaces.Arbitrators)
func (*DposStore) Select ¶
func (s *DposStore) Select(table *interfaces.DBTable, inputFields []*interfaces.Field) ([][]*interfaces.Field, error)
func (*DposStore) SelectID ¶
func (s *DposStore) SelectID(table *interfaces.DBTable, inputFields []*interfaces.Field) ([]uint64, error)
func (*DposStore) StartRecordArbitrators ¶
func (s *DposStore) StartRecordArbitrators()
func (*DposStore) StartRecordEvent ¶
func (*DposStore) Update ¶
func (s *DposStore) Update(table *interfaces.DBTable, inputFields []*interfaces.Field, updateFields []*interfaces.Field) ([]uint64, error)
func (*DposStore) UpdateConsensusEvent ¶
func (*DposStore) UpdateProposalEvent ¶
type EventRecord ¶
type EventRecord struct {
// contains filtered or unexported fields
}
func (*EventRecord) Initialize ¶
func (e *EventRecord) Initialize(store interfaces.IEventRecord)
func (*EventRecord) OnConsensusFinished ¶
func (e *EventRecord) OnConsensusFinished(cons *log.ConsensusEvent)
func (*EventRecord) OnConsensusStarted ¶
func (e *EventRecord) OnConsensusStarted(cons *log.ConsensusEvent)
func (*EventRecord) OnProposalArrived ¶
func (e *EventRecord) OnProposalArrived(prop *log.ProposalEvent)
func (*EventRecord) OnProposalFinished ¶
func (e *EventRecord) OnProposalFinished(prop *log.ProposalEvent)
func (*EventRecord) OnViewStarted ¶
func (e *EventRecord) OnViewStarted(view *log.ViewEvent)
func (*EventRecord) OnVoteArrived ¶
func (e *EventRecord) OnVoteArrived(vote *log.VoteEvent)
type LevelDB ¶
type LevelDB struct {
// contains filtered or unexported fields
}
func NewLevelDB ¶
func (*LevelDB) NewIterator ¶
func (l *LevelDB) NewIterator(prefix []byte) blockchain.IIterator
Click to show internal directories.
Click to hide internal directories.