Documentation ¶
Index ¶
- Constants
- 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 Arbitrators
- type ArbitratorsListener
- type DBTable
- type DirectPeers
- type Field
- type HeightVersions
- type IArbitratorsRecord
- type IDBBasic
- type IDBOperator
- type IDposStore
- type IEventRecord
- type NewBlocksListener
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 )
Variables ¶
This section is empty.
Functions ¶
func BytesToUint64 ¶
func BytesToUint64List ¶
func GetTableIDKey ¶
func GetTableKey ¶
func Uint64ListToBytes ¶
func Uint64ToBytes ¶
Types ¶
type Arbitrators ¶
type Arbitrators interface { NewBlocksListener StartUp() error ForceChange() error GetArbitrators() [][]byte GetCandidates() [][]byte GetNextArbitrators() [][]byte GetNextCandidates() [][]byte GetArbitratorsProgramHashes() []*common.Uint168 GetCandidatesProgramHashes() []*common.Uint168 GetOnDutyArbitrator() []byte GetNextOnDutyArbitrator(offset uint32) []byte HasArbitersMajorityCount(num uint32) bool HasArbitersMinorityCount(num uint32) bool RegisterListener(listener ArbitratorsListener) UnregisterListener(listener ArbitratorsListener) }
type ArbitratorsListener ¶
type ArbitratorsListener interface {
OnNewElection(arbiters [][]byte)
}
type DBTable ¶
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{}
type DirectPeers ¶
type HeightVersions ¶
type HeightVersions interface { GetDefaultTxVersion(blockHeight uint32) byte GetDefaultBlockVersion(blockHeight uint32) uint32 CheckOutputPayload(blockHeight uint32, tx *types.Transaction, output *types.Output) error CheckOutputProgramHash(blockHeight uint32, tx *types.Transaction, programHash common.Uint168) error CheckCoinbaseMinerReward(blockHeight uint32, tx *types.Transaction, totalReward common.Fixed64) error CheckCoinbaseArbitratorsReward(blockHeight uint32, coinbase *types.Transaction, rewardInCoinbase common.Fixed64) error CheckVoteProducerOutputs(blockHeight uint32, tx *types.Transaction, outputs []*types.Output, references map[*types.Input]*types.Output, producers [][]byte) error CheckTxHasNoPrograms(blockHeight uint32, tx *types.Transaction) error GetProducersDesc(block *types.Block) ([][]byte, error) AddBlock(block *types.Block) (bool, bool, error) AddDposBlock(block *types.DposBlock) (bool, bool, error) AssignCoinbaseTxRewards(block *types.Block, totalReward common.Fixed64) error CheckConfirmedBlockOnFork(block *types.Block) error GetNextOnDutyArbitrator(blockHeight, dutyChangedCount, offset uint32) []byte }
type IArbitratorsRecord ¶
type IArbitratorsRecord interface { GetArbitrators(a Arbitrators) error SaveDposDutyChangedCount(count uint32) SaveCurrentArbitrators(a Arbitrators) SaveNextArbitrators(a Arbitrators) GetDirectPeers() ([]*DirectPeers, error) SaveDirectPeers(peers []*DirectPeers) }
type IDBOperator ¶
type IDBOperator interface { IDBBasic 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) }
type IDposStore ¶
type IDposStore interface { IDBOperator IEventRecord IArbitratorsRecord }
IDposStore provides func for dpos
type IEventRecord ¶
type NewBlocksListener ¶
type NewBlocksListener interface { OnBlockReceived(b *types.Block, confirmed bool) OnConfirmReceived(p *types.DPosProposalVoteSlot) }
Click to show internal directories.
Click to hide internal directories.