Documentation ¶
Index ¶
- Constants
- Variables
- func BytesToUint64(b []byte) uint64
- func BytesToUint64List(b []byte) ([]uint64, error)
- func GetIndexKey(tableName string, index uint64, columnValue []byte) []byte
- func GetRowKey(tableName string, rowID uint64) []byte
- func GetTableIDKey(tableName string) []byte
- func GetTableKey(tableName string) []byte
- func Uint64ListToBytes(indexes []uint64) ([]byte, error)
- func Uint64ToBytes(value uint64) []byte
- type Batch
- type DBTable
- type DataEntryPrefix
- type Database
- type DirectPeers
- 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) Close() error
- func (s *DposStore) Create(table *DBTable) error
- func (s *DposStore) GetCheckPoint(height uint32) (*state.CheckPoint, error)
- func (s *DposStore) GetHeightsDesc() ([]uint32, error)
- func (s *DposStore) Insert(table *DBTable, fields []*Field) (uint64, error)
- func (s *DposStore) SaveArbitersState(point *state.CheckPoint) (err error)
- func (s *DposStore) Select(table *DBTable, inputFields []*Field) ([][]*Field, error)
- func (s *DposStore) SelectID(table *DBTable, inputFields []*Field) ([]uint64, error)
- func (s *DposStore) StartEventRecord()
- func (s *DposStore) Update(table *DBTable, inputFields []*Field, updateFields []*Field) ([]uint64, error)
- func (s *DposStore) UpdateConsensusEvent(event interface{}) error
- func (s *DposStore) UpdateProposalEvent(event interface{}) error
- type EventRecord
- func (e *EventRecord) Initialize(store 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 EventStoreAnalyzer
- func (e *EventStoreAnalyzer) AppendConsensusVote(vote *payload.DPOSProposalVote)
- func (e *EventStoreAnalyzer) Clear()
- func (e *EventStoreAnalyzer) GetLastConsensusViewCount() uint32
- func (e *EventStoreAnalyzer) GetLastConsensusVoteSignerHistory() []string
- func (e *EventStoreAnalyzer) IncreaseLastConsensusViewCount()
- func (e *EventStoreAnalyzer) ParseInactiveArbitrators() (result []string)
- type EventStoreAnalyzerConfig
- type Field
- type IDBOperator
- type IDposStore
- type IEventRecord
- type LevelDB
Constants ¶
View Source
const ( FieldUint8 = 0x01 FieldUint16 = 0x02 FieldUint32 = 0x03 FieldUint64 = 0x04 FieldUint168 = 0x05 FieldUint256 = 0x06 FieldInt = 0x07 FieldInt32 = 0x08 FieldIn64 = 0x09 FieldBytes = 0x0a FieldString = 0x0b FieldBool = 0x0c DefaultMaxDataSize = 1024 * 1024 )
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 = &DBTable{ Name: "ConsensusEvent", PrimaryKey: 4, Indexes: []uint64{3}, Fields: []string{ "StartTime", "EndTime", "Height", "RawData", }, }
View Source
var ProposalEventTable = &DBTable{ Name: "ProposalEvent", PrimaryKey: 7, Indexes: []uint64{1, 2, 6}, Fields: []string{ "Sponsor", "BlockHash", "ReceivedTime", "EndTime", "Result", "ProposalHash", "RawData", }, }
View Source
var ViewEventTable = &DBTable{ Name: "ViewEvent", PrimaryKey: 0, Indexes: nil, Fields: []string{ "ConsensusID", "OnDutyArbitrator", "StartTime", "Offset", }, }
View Source
var VoteEventTable = &DBTable{ Name: "VoteEvent", PrimaryKey: 0, Indexes: nil, Fields: []string{ "ProposalID", "Signer", "ReceivedTime", "Result", "RawData", }, }
Functions ¶
func BytesToUint64 ¶ added in v0.3.0
func BytesToUint64List ¶ added in v0.3.0
func GetIndexKey ¶ added in v0.3.0
func GetTableIDKey ¶ added in v0.3.0
func GetTableKey ¶ added in v0.3.0
func Uint64ListToBytes ¶ added in v0.3.0
func Uint64ToBytes ¶ added in v0.3.0
Types ¶
type DBTable ¶ added in v0.3.0
type DBTable struct { // name of table Name string // primary key range from 1 to len(table.Fields) // if give other value, will use default rowID as primary key only PrimaryKey uint64 // database index range from 1 to len(table.Fields) // if give values not in scope, the database index will not be effective Indexes []uint64 // field name of table Fields []string }
todo change fields to map[string]FieldType, change indexes to ma[uint64]struct{}
func (*DBTable) Column ¶ added in v0.3.0
column range from 1 to len(table.Fields), if a field name not found in table will return 0
type DataEntryPrefix ¶
type DataEntryPrefix byte
DataEntryPrefix
const ( // DPOS DPOSCheckPointHeights DataEntryPrefix = 0x10 DPOSSingleCheckPoint DataEntryPrefix = 0x11 )
type DirectPeers ¶ added in v0.3.0
type DposStore ¶
type DposStore struct {
// contains filtered or unexported fields
}
func (*DposStore) AddConsensusEvent ¶
func (*DposStore) AddProposalEvent ¶
func (*DposStore) AddViewEvent ¶
func (*DposStore) AddVoteEvent ¶
func (*DposStore) GetCheckPoint ¶ added in v0.3.2
func (s *DposStore) GetCheckPoint(height uint32) (*state.CheckPoint, error)
func (*DposStore) GetHeightsDesc ¶ added in v0.3.2
func (*DposStore) SaveArbitersState ¶ added in v0.3.2
func (s *DposStore) SaveArbitersState(point *state.CheckPoint) (err error)
func (*DposStore) StartEventRecord ¶ added in v0.3.0
func (s *DposStore) StartEventRecord()
func (*DposStore) UpdateConsensusEvent ¶
func (*DposStore) UpdateProposalEvent ¶
type EventRecord ¶
type EventRecord struct {
// contains filtered or unexported fields
}
func (*EventRecord) Initialize ¶
func (e *EventRecord) Initialize(store 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 EventStoreAnalyzer ¶ added in v0.3.0
type EventStoreAnalyzer struct {
// contains filtered or unexported fields
}
func NewEventStoreAnalyzer ¶ added in v0.3.0
func NewEventStoreAnalyzer(cfg EventStoreAnalyzerConfig) *EventStoreAnalyzer
func (*EventStoreAnalyzer) AppendConsensusVote ¶ added in v0.3.2
func (e *EventStoreAnalyzer) AppendConsensusVote(vote *payload.DPOSProposalVote)
func (*EventStoreAnalyzer) Clear ¶ added in v0.3.2
func (e *EventStoreAnalyzer) Clear()
func (*EventStoreAnalyzer) GetLastConsensusViewCount ¶ added in v0.3.2
func (e *EventStoreAnalyzer) GetLastConsensusViewCount() uint32
func (*EventStoreAnalyzer) GetLastConsensusVoteSignerHistory ¶ added in v0.3.2
func (e *EventStoreAnalyzer) GetLastConsensusVoteSignerHistory() []string
func (*EventStoreAnalyzer) IncreaseLastConsensusViewCount ¶ added in v0.3.2
func (e *EventStoreAnalyzer) IncreaseLastConsensusViewCount()
func (*EventStoreAnalyzer) ParseInactiveArbitrators ¶ added in v0.3.0
func (e *EventStoreAnalyzer) ParseInactiveArbitrators() (result []string)
type EventStoreAnalyzerConfig ¶ added in v0.3.0
type EventStoreAnalyzerConfig struct { Store IDposStore Arbitrators state.Arbitrators }
type IDBOperator ¶ added in v0.3.0
type IDBOperator interface { Create(table *DBTable) error Insert(table *DBTable, fields []*Field) (uint64, error) Select(table *DBTable, inputFields []*Field) ([][]*Field, error) Update(table *DBTable, inputFields []*Field, updateFields []*Field) ([]uint64, error) SelectID(table *DBTable, inputFields []*Field) ([]uint64, error) Close() error }
type IDposStore ¶ added in v0.3.0
type IDposStore interface { IDBOperator IEventRecord state.IArbitratorsRecord }
IDposStore provides func for dpos
type IEventRecord ¶ added in v0.3.0
type IEventRecord interface { StartEventRecord() AddProposalEvent(event interface{}) error UpdateProposalEvent(event interface{}) error AddVoteEvent(event interface{}) error AddViewEvent(event interface{}) error AddConsensusEvent(event interface{}) error UpdateConsensusEvent(event interface{}) error }
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.