iotex-election: github.com/iotexproject/iotex-election/committee Index | Files

package committee

import "github.com/iotexproject/iotex-election/committee"

Index

Package Files

committee.go heightmanager.go resultcache.go

type CalcGravityChainHeight Uses

type CalcGravityChainHeight func(uint64) (uint64, error)

CalcGravityChainHeight calculates the corresponding gravity chain height for an epoch

type Committee Uses

type Committee interface {
    // Start starts the committee service
    Start(context.Context) error
    // Stop stops the committee service
    Stop(context.Context) error
    // ResultByHeight returns the result on a specific ethereum height
    ResultByHeight(height uint64) (*types.ElectionResult, error)
    // FetchResultByHeight returns the buckets
    FetchResultByHeight(height uint64) (*types.ElectionResult, error)
    // HeightByTime returns the nearest result before time
    HeightByTime(timestamp time.Time) (uint64, error)
    // LatestHeight returns the height with latest result
    LatestHeight() uint64
    // Status returns the committee status
    Status() STATUS
}

Committee defines an interface of an election committee It could be considered as a light state db of gravity chain, that

func NewCommittee Uses

func NewCommittee(newDB *sql.DB, cfg Config, oldDB db.KVStoreWithNamespace) (Committee, error)

NewCommittee creates a committee

type Config Uses

type Config struct {
    NumOfRetries               uint8    `yaml:"numOfRetries"`
    GravityChainAPIs           []string `yaml:"gravityChainAPIs"`
    GravityChainHeightInterval uint64   `yaml:"gravityChainHeightInterval"`
    GravityChainStartHeight    uint64   `yaml:"gravityChainStartHeight"`
    RegisterContractAddress    string   `yaml:"registerContractAddress"`
    StakingContractAddress     string   `yaml:"stakingContractAddress"`
    PaginationSize             uint8    `yaml:"paginationSize"`
    VoteThreshold              string   `yaml:"voteThreshold"`
    ScoreThreshold             string   `yaml:"scoreThreshold"`
    SelfStakingThreshold       string   `yaml:"selfStakingThreshold"`
    CacheSize                  uint32   `yaml:"cacheSize"`
    NumOfFetchInParallel       uint8    `yaml:"numOfFetchInParallel"`
    SkipManifiedCandidate      bool     `yaml:"skipManifiedCandidate"`
    GravityChainBatchSize      uint64   `yaml:"gravityChainBatchSize"`
}

Config defines the config of the committee

type STATUS Uses

type STATUS uint8

STATUS represents the status of committee

const (
    // STARTING stands for a starting status
    STARTING STATUS = iota
    // ACTIVE stands for an active status
    ACTIVE
    // INACTIVE stands for an inactive status
    INACTIVE
)

Package committee imports 18 packages (graph) and is imported by 6 packages. Updated 2019-09-18. Refresh now. Tools for package owners.