Documentation ¶
Index ¶
- Constants
- func CreateElectionResultKey(hash types.Hash) []byte
- func CreatePointKey(prefix byte, height uint64) []byte
- type ConsensusPointProto
- func (*ConsensusPointProto) Descriptor() ([]byte, []int)
- func (m *ConsensusPointProto) GetContent() []*ProducerDetailProto
- func (m *ConsensusPointProto) GetEndHash() []byte
- func (m *ConsensusPointProto) GetPrevHash() []byte
- func (m *ConsensusPointProto) GetTotalWeight() []byte
- func (*ConsensusPointProto) ProtoMessage()
- func (m *ConsensusPointProto) Reset()
- func (m *ConsensusPointProto) String() string
- func (m *ConsensusPointProto) XXX_DiscardUnknown()
- func (m *ConsensusPointProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ConsensusPointProto) XXX_Merge(src proto.Message)
- func (m *ConsensusPointProto) XXX_Size() int
- func (m *ConsensusPointProto) XXX_Unmarshal(b []byte) error
- type DB
- func (db *DB) DeletePointByHeight(prefix byte, height uint64) error
- func (db *DB) GetElectionResultByHash(hash types.Hash) (*ElectionData, error)
- func (db *DB) GetPointByHeight(prefix byte, height uint64) (*Point, error)
- func (db *DB) StoreElectionResultByHash(hash types.Hash, data *ElectionData) error
- func (db *DB) StorePointByHeight(prefix byte, height uint64, p *Point) error
- type ElectionData
- type ElectionDataProto
- func (*ElectionDataProto) Descriptor() ([]byte, []int)
- func (m *ElectionDataProto) GetDelegations() []*PillarDelegationProto
- func (m *ElectionDataProto) GetProducers() [][]byte
- func (*ElectionDataProto) ProtoMessage()
- func (m *ElectionDataProto) Reset()
- func (m *ElectionDataProto) String() string
- func (m *ElectionDataProto) XXX_DiscardUnknown()
- func (m *ElectionDataProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ElectionDataProto) XXX_Merge(src proto.Message)
- func (m *ElectionDataProto) XXX_Size() int
- func (m *ElectionDataProto) XXX_Unmarshal(b []byte) error
- type PillarDelegationProto
- func (*PillarDelegationProto) Descriptor() ([]byte, []int)
- func (m *PillarDelegationProto) GetName() string
- func (m *PillarDelegationProto) GetProducingAddress() []byte
- func (m *PillarDelegationProto) GetWeight() []byte
- func (*PillarDelegationProto) ProtoMessage()
- func (m *PillarDelegationProto) Reset()
- func (m *PillarDelegationProto) String() string
- func (m *PillarDelegationProto) XXX_DiscardUnknown()
- func (m *PillarDelegationProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *PillarDelegationProto) XXX_Merge(src proto.Message)
- func (m *PillarDelegationProto) XXX_Size() int
- func (m *PillarDelegationProto) XXX_Unmarshal(b []byte) error
- type Point
- type ProducerDetail
- type ProducerDetailProto
- func (*ProducerDetailProto) Descriptor() ([]byte, []int)
- func (m *ProducerDetailProto) GetExpectedNum() uint32
- func (m *ProducerDetailProto) GetFactualNum() uint32
- func (m *ProducerDetailProto) GetName() string
- func (m *ProducerDetailProto) GetWeight() []byte
- func (*ProducerDetailProto) ProtoMessage()
- func (m *ProducerDetailProto) Reset()
- func (m *ProducerDetailProto) String() string
- func (m *ProducerDetailProto) XXX_DiscardUnknown()
- func (m *ProducerDetailProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *ProducerDetailProto) XXX_Merge(src proto.Message)
- func (m *ProducerDetailProto) XXX_Size() int
- func (m *ProducerDetailProto) XXX_Unmarshal(b []byte) error
Constants ¶
View Source
const ( PrefixPeriodPoint = byte(0) PrefixEpochPoint = byte(1) // Total number of possible points NumPointTypes = 2 PrefixElectionResult = byte(10) )
Variables ¶
This section is empty.
Functions ¶
func CreateElectionResultKey ¶
func CreatePointKey ¶
Types ¶
type ConsensusPointProto ¶
type ConsensusPointProto struct { PrevHash []byte `protobuf:"bytes,1,opt,name=prevHash,proto3" json:"prevHash,omitempty"` EndHash []byte `protobuf:"bytes,2,opt,name=endHash,proto3" json:"endHash,omitempty"` TotalWeight []byte `protobuf:"bytes,3,opt,name=totalWeight,proto3" json:"totalWeight,omitempty"` Content []*ProducerDetailProto `protobuf:"bytes,4,rep,name=content,proto3" json:"content,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ConsensusPointProto) Descriptor ¶
func (*ConsensusPointProto) Descriptor() ([]byte, []int)
func (*ConsensusPointProto) GetContent ¶
func (m *ConsensusPointProto) GetContent() []*ProducerDetailProto
func (*ConsensusPointProto) GetEndHash ¶
func (m *ConsensusPointProto) GetEndHash() []byte
func (*ConsensusPointProto) GetPrevHash ¶
func (m *ConsensusPointProto) GetPrevHash() []byte
func (*ConsensusPointProto) GetTotalWeight ¶
func (m *ConsensusPointProto) GetTotalWeight() []byte
func (*ConsensusPointProto) ProtoMessage ¶
func (*ConsensusPointProto) ProtoMessage()
func (*ConsensusPointProto) Reset ¶
func (m *ConsensusPointProto) Reset()
func (*ConsensusPointProto) String ¶
func (m *ConsensusPointProto) String() string
func (*ConsensusPointProto) XXX_DiscardUnknown ¶
func (m *ConsensusPointProto) XXX_DiscardUnknown()
func (*ConsensusPointProto) XXX_Marshal ¶
func (m *ConsensusPointProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ConsensusPointProto) XXX_Merge ¶
func (m *ConsensusPointProto) XXX_Merge(src proto.Message)
func (*ConsensusPointProto) XXX_Size ¶
func (m *ConsensusPointProto) XXX_Size() int
func (*ConsensusPointProto) XXX_Unmarshal ¶
func (m *ConsensusPointProto) XXX_Unmarshal(b []byte) error
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) DeletePointByHeight ¶
func (*DB) GetElectionResultByHash ¶
func (db *DB) GetElectionResultByHash(hash types.Hash) (*ElectionData, error)
ElectionData
func (*DB) GetPointByHeight ¶
Point
func (*DB) StoreElectionResultByHash ¶
func (db *DB) StoreElectionResultByHash(hash types.Hash, data *ElectionData) error
type ElectionData ¶
type ElectionData struct { Producers []types.Address Delegations []*types.PillarDelegation }
func GenElectionData ¶
func GenElectionData(producers []types.Address, delegations []*types.PillarDelegation) *ElectionData
func (*ElectionData) Marshal ¶
func (d *ElectionData) Marshal() ([]byte, error)
func (*ElectionData) Unmarshal ¶
func (d *ElectionData) Unmarshal(buf []byte) error
type ElectionDataProto ¶
type ElectionDataProto struct { Producers [][]byte `protobuf:"bytes,1,rep,name=producers,proto3" json:"producers,omitempty"` Delegations []*PillarDelegationProto `protobuf:"bytes,2,rep,name=delegations,proto3" json:"delegations,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ElectionDataProto) Descriptor ¶
func (*ElectionDataProto) Descriptor() ([]byte, []int)
func (*ElectionDataProto) GetDelegations ¶
func (m *ElectionDataProto) GetDelegations() []*PillarDelegationProto
func (*ElectionDataProto) GetProducers ¶
func (m *ElectionDataProto) GetProducers() [][]byte
func (*ElectionDataProto) ProtoMessage ¶
func (*ElectionDataProto) ProtoMessage()
func (*ElectionDataProto) Reset ¶
func (m *ElectionDataProto) Reset()
func (*ElectionDataProto) String ¶
func (m *ElectionDataProto) String() string
func (*ElectionDataProto) XXX_DiscardUnknown ¶
func (m *ElectionDataProto) XXX_DiscardUnknown()
func (*ElectionDataProto) XXX_Marshal ¶
func (m *ElectionDataProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ElectionDataProto) XXX_Merge ¶
func (m *ElectionDataProto) XXX_Merge(src proto.Message)
func (*ElectionDataProto) XXX_Size ¶
func (m *ElectionDataProto) XXX_Size() int
func (*ElectionDataProto) XXX_Unmarshal ¶
func (m *ElectionDataProto) XXX_Unmarshal(b []byte) error
type PillarDelegationProto ¶
type PillarDelegationProto struct { ProducingAddress []byte `protobuf:"bytes,1,opt,name=producingAddress,proto3" json:"producingAddress,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` Weight []byte `protobuf:"bytes,3,opt,name=weight,proto3" json:"weight,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*PillarDelegationProto) Descriptor ¶
func (*PillarDelegationProto) Descriptor() ([]byte, []int)
func (*PillarDelegationProto) GetName ¶
func (m *PillarDelegationProto) GetName() string
func (*PillarDelegationProto) GetProducingAddress ¶
func (m *PillarDelegationProto) GetProducingAddress() []byte
func (*PillarDelegationProto) GetWeight ¶
func (m *PillarDelegationProto) GetWeight() []byte
func (*PillarDelegationProto) ProtoMessage ¶
func (*PillarDelegationProto) ProtoMessage()
func (*PillarDelegationProto) Reset ¶
func (m *PillarDelegationProto) Reset()
func (*PillarDelegationProto) String ¶
func (m *PillarDelegationProto) String() string
func (*PillarDelegationProto) XXX_DiscardUnknown ¶
func (m *PillarDelegationProto) XXX_DiscardUnknown()
func (*PillarDelegationProto) XXX_Marshal ¶
func (m *PillarDelegationProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*PillarDelegationProto) XXX_Merge ¶
func (m *PillarDelegationProto) XXX_Merge(src proto.Message)
func (*PillarDelegationProto) XXX_Size ¶
func (m *PillarDelegationProto) XXX_Size() int
func (*PillarDelegationProto) XXX_Unmarshal ¶
func (m *PillarDelegationProto) XXX_Unmarshal(b []byte) error
type Point ¶
type Point struct { // Last hash that is not in this point PrevHash types.Hash // Last hash that is in this point EndHash types.Hash Pillars map[string]*ProducerDetail TotalWeight *big.Int }
func NewEmptyPoint ¶
func (*Point) LeftAppend ¶
type ProducerDetail ¶
func (*ProducerDetail) AddNum ¶
func (detail *ProducerDetail) AddNum(ExpectedNum uint32, FactualNum uint32)
func (ProducerDetail) Copy ¶
func (detail ProducerDetail) Copy() *ProducerDetail
func (*ProducerDetail) Merge ¶
func (detail *ProducerDetail) Merge(c *ProducerDetail)
type ProducerDetailProto ¶
type ProducerDetailProto struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` FactualNum uint32 `protobuf:"fixed32,2,opt,name=factualNum,proto3" json:"factualNum,omitempty"` ExpectedNum uint32 `protobuf:"fixed32,3,opt,name=expectedNum,proto3" json:"expectedNum,omitempty"` Weight []byte `protobuf:"bytes,4,opt,name=weight,proto3" json:"weight,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ProducerDetailProto) Descriptor ¶
func (*ProducerDetailProto) Descriptor() ([]byte, []int)
func (*ProducerDetailProto) GetExpectedNum ¶
func (m *ProducerDetailProto) GetExpectedNum() uint32
func (*ProducerDetailProto) GetFactualNum ¶
func (m *ProducerDetailProto) GetFactualNum() uint32
func (*ProducerDetailProto) GetName ¶
func (m *ProducerDetailProto) GetName() string
func (*ProducerDetailProto) GetWeight ¶
func (m *ProducerDetailProto) GetWeight() []byte
func (*ProducerDetailProto) ProtoMessage ¶
func (*ProducerDetailProto) ProtoMessage()
func (*ProducerDetailProto) Reset ¶
func (m *ProducerDetailProto) Reset()
func (*ProducerDetailProto) String ¶
func (m *ProducerDetailProto) String() string
func (*ProducerDetailProto) XXX_DiscardUnknown ¶
func (m *ProducerDetailProto) XXX_DiscardUnknown()
func (*ProducerDetailProto) XXX_Marshal ¶
func (m *ProducerDetailProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ProducerDetailProto) XXX_Merge ¶
func (m *ProducerDetailProto) XXX_Merge(src proto.Message)
func (*ProducerDetailProto) XXX_Size ¶
func (m *ProducerDetailProto) XXX_Size() int
func (*ProducerDetailProto) XXX_Unmarshal ¶
func (m *ProducerDetailProto) XXX_Unmarshal(b []byte) error
Click to show internal directories.
Click to hide internal directories.