agendas

package
v4.0.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2019 License: ISC Imports: 7 Imported by: 0

Documentation

Overview

Package agendas manages the various deployment agendas that are directly voted upon with the vote bits in vote transactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info.

Types

type AgendaDB

type AgendaDB struct {
	NumAgendas int
	// contains filtered or unexported fields
}

AgendaDB represents the data for the stored DB.

func NewAgendasDB

func NewAgendasDB(client DeploymentSource, dbPath string) (*AgendaDB, error)

NewAgendasDB opens an existing database or create a new one using with the specified file name. An initialized agendas db connection is returned.

func (*AgendaDB) AgendaInfo

func (db *AgendaDB) AgendaInfo(agendaID string) (*AgendaTagged, error)

AgendaInfo fetches an agenda's details given it's agendaID.

func (*AgendaDB) AllAgendas

func (db *AgendaDB) AllAgendas() (agendas []*AgendaTagged, err error)

AllAgendas returns all agendas and their info in the db.

func (*AgendaDB) CheckAgendasUpdates

func (db *AgendaDB) CheckAgendasUpdates(activeVersions map[uint32][]chaincfg.ConsensusDeployment) error

CheckAgendasUpdates checks for update at the start of the process and will proceed to update when necessary.

func (*AgendaDB) Close

func (db *AgendaDB) Close() error

Close should be called when you are done with the AgendaDB to close the underlying database.

type AgendaTagged

type AgendaTagged struct {
	ID             string                   `json:"id" storm:"id"`
	Description    string                   `json:"description"`
	Mask           uint16                   `json:"mask"`
	StartTime      uint64                   `json:"starttime" storm:"index"`
	ExpireTime     uint64                   `json:"expiretime" storm:"index"`
	Status         dbtypes.AgendaStatusType `json:"status" storm:"index"`
	QuorumProgress float64                  `json:"quorumprogress" storm:"index"`
	Choices        []dcrjson.Choice         `json:"choices"`
	VoteVersion    uint32                   `json:"voteversion"`
}

AgendaTagged has the same fields as dcrjson.Agenda plus the VoteVersion field, but with the ID field marked as the primary key via the `storm:"id"` tag. Fields tagged for indexing by the DB are: StartTime, ExpireTime, Status, and QuorumProgress.

type DeploymentSource

type DeploymentSource interface {
	GetVoteInfo(version uint32) (*dcrjson.GetVoteInfoResult, error)
}

DeploymentSource provides a cleaner way to track the rpcclient methods used in this package. It also allows usage of alternative implementations to satisfy the interface.

Jump to

Keyboard shortcuts

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