Documentation ¶
Index ¶
- type ProbationList
- type UnproductiveDelegate
- func (upd *UnproductiveDelegate) AddRecentUPD(new []string) error
- func (upd *UnproductiveDelegate) DelegateList() [][]string
- func (upd *UnproductiveDelegate) Deserialize(buf []byte) error
- func (upd *UnproductiveDelegate) Equal(upd2 *UnproductiveDelegate) bool
- func (upd *UnproductiveDelegate) LoadProto(updPb *updpb.UnproductiveDelegate) error
- func (upd *UnproductiveDelegate) Proto() *updpb.UnproductiveDelegate
- func (upd *UnproductiveDelegate) ReadOldestUPD() []string
- func (upd *UnproductiveDelegate) Serialize() ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProbationList ¶ added in v1.0.0
ProbationList defines a map where key is candidate's name and value is the counter which counts the unproductivity during probation epoch.
func NewProbationList ¶ added in v1.0.0
func NewProbationList(intensity uint32) *ProbationList
NewProbationList returns a new probation list
func (*ProbationList) Deserialize ¶ added in v1.0.0
func (pl *ProbationList) Deserialize(buf []byte) error
Deserialize deserializes bytes to delegate ProbationList
func (*ProbationList) LoadProto ¶ added in v1.0.0
func (pl *ProbationList) LoadProto(probationListpb *iotextypes.ProbationCandidateList) error
LoadProto loads ProbationList from proto
func (*ProbationList) Proto ¶ added in v1.0.0
func (pl *ProbationList) Proto() *iotextypes.ProbationCandidateList
Proto converts the ProbationList to a protobuf message
func (*ProbationList) Serialize ¶ added in v1.0.0
func (pl *ProbationList) Serialize() ([]byte, error)
Serialize serializes map of ProbationList to bytes
type UnproductiveDelegate ¶ added in v0.11.0
type UnproductiveDelegate struct {
// contains filtered or unexported fields
}
UnproductiveDelegate defines unproductive delegates information within probation period
func NewUnproductiveDelegate ¶ added in v0.11.0
func NewUnproductiveDelegate(probationPeriod uint64, cacheSize uint64) (*UnproductiveDelegate, error)
NewUnproductiveDelegate creates new UnproductiveDelegate with probationperiod and cacheSize
func (*UnproductiveDelegate) AddRecentUPD ¶ added in v0.11.0
func (upd *UnproductiveDelegate) AddRecentUPD(new []string) error
AddRecentUPD adds new epoch upd-list at the leftmost and shift existing lists to the right
func (*UnproductiveDelegate) DelegateList ¶ added in v0.11.0
func (upd *UnproductiveDelegate) DelegateList() [][]string
DelegateList returns delegate list 2D array
func (*UnproductiveDelegate) Deserialize ¶ added in v0.11.0
func (upd *UnproductiveDelegate) Deserialize(buf []byte) error
Deserialize deserializes bytes to UnproductiveDelegate struct
func (*UnproductiveDelegate) Equal ¶ added in v0.11.0
func (upd *UnproductiveDelegate) Equal(upd2 *UnproductiveDelegate) bool
Equal compares with other upd struct and returns true if it's equal
func (*UnproductiveDelegate) LoadProto ¶ added in v0.11.0
func (upd *UnproductiveDelegate) LoadProto(updPb *updpb.UnproductiveDelegate) error
LoadProto converts protobuf message to unproductvieDelegate struct
func (*UnproductiveDelegate) Proto ¶ added in v0.11.0
func (upd *UnproductiveDelegate) Proto() *updpb.UnproductiveDelegate
Proto converts the unproductvieDelegate struct to a protobuf message
func (*UnproductiveDelegate) ReadOldestUPD ¶ added in v0.11.0
func (upd *UnproductiveDelegate) ReadOldestUPD() []string
ReadOldestUPD returns the last upd-list
func (*UnproductiveDelegate) Serialize ¶ added in v0.11.0
func (upd *UnproductiveDelegate) Serialize() ([]byte, error)
Serialize serializes unproductvieDelegate struct to bytes