votings

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtocolID is the ID of protocol
	ProtocolID = "voting"
	// VotingHistoryTableName is the table name of voting history
	VotingHistoryTableName = "voting_history"
	// VotingResultTableName is the table name of voting result
	VotingResultTableName = "voting_result"
	//VotingMetaTableName is the voting meta table
	VotingMetaTableName = "voting_meta"
	// AggregateVotingTable is the table name of voters' aggregate voting
	AggregateVotingTable = "aggregate_voting"
	// EpochIndexName is the index name of epoch number on voting meta table
	EpochIndexName = "epoch_index"
	// EpochVoterIndexName is the index name of epoch number and voter address on voting history table
	EpochVoterIndexName = "epoch_voter_index"
	// CandidateVoterIndexName is the index name of candidate name and voter address on voting history table
	CandidateVoterIndexName = "candidate_voter_index"
	// EpochCandidateIndexName is the index name of epoch number and candidate name on voting history/result table
	EpochCandidateIndexName = "epoch_candidate_index"
	// EpochCandidateVoterIndexName is the index name of epoch number, candidate name, and voter address on aggregate voting table
	EpochCandidateVoterIndexName = "epoch_candidate_voter_index"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Protocol

type Protocol struct {
	Store        s.Store
	NumDelegates uint64
	NumSubEpochs uint64
}

Protocol defines the protocol of indexing blocks

func NewProtocol

func NewProtocol(store s.Store, numDelegates uint64, numSubEpochs uint64) *Protocol

NewProtocol creates a new protocol

func (*Protocol) CreateTables

func (p *Protocol) CreateTables(ctx context.Context) error

CreateTables creates tables

func (*Protocol) HandleBlock

func (p *Protocol) HandleBlock(ctx context.Context, tx *sql.Tx, blk *block.Block) error

HandleBlock handles blocks

func (*Protocol) Initialize

func (p *Protocol) Initialize(context.Context, *sql.Tx, *indexprotocol.Genesis) error

Initialize initializes votings protocol

type VotingHistory

type VotingHistory struct {
	EpochNumber       uint64
	CandidateName     string
	VoterAddress      string
	Votes             string
	WeightedVotes     string
	RemainingDuration string
}

VotingHistory defines the schema of "voting history" table

type VotingResult

type VotingResult struct {
	EpochNumber        uint64
	DelegateName       string
	OperatorAddress    string
	RewardAddress      string
	TotalWeightedVotes string
	SelfStaking        string
}

VotingResult defines the schema of "voting result" table

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL