politeia

package module
v0.0.0-...-1112063 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2019 License: ISC Imports: 15 Imported by: 0

Documentation

Overview

Package politeia manages Politeia proposals and the voting that is coordinated by the Politeia server and anchored on the blockchain.

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 ProposalDB

type ProposalDB struct {
	APIURLpath string
	// contains filtered or unexported fields
}

ProposalDB defines the common data needed to query the proposals db.

func NewProposalsDB

func NewProposalsDB(politeiaURL, dbPath string) (*ProposalDB, error)

NewProposalsDB opens an exiting database or creates a new DB instance with the provided file name. Returns an initialized instance of proposals DB, http client and the formatted politeia API URL path to be used. It also checks the db version, Reindexes the db if need be and sets the required db version.

func (*ProposalDB) AllProposals

func (db *ProposalDB) AllProposals(offset, rowsCount int,
	filterByVoteStatus ...int) (proposals []*pitypes.ProposalInfo,
	totalCount int, err error)

AllProposals fetches all the proposals data saved to the db.

func (*ProposalDB) CheckProposalsUpdates

func (db *ProposalDB) CheckProposalsUpdates() error

CheckProposalsUpdates updates the proposal changes if they exist and updates them to the proposal db.

func (*ProposalDB) Close

func (db *ProposalDB) Close() error

Close closes the proposal DB instance created passed if it not nil.

func (*ProposalDB) LastProposalsSync

func (db *ProposalDB) LastProposalsSync() int64

LastProposalsSync returns the last time a sync to update the proposals was run but not necessarily the last time updates were synced in proposals.db.

func (*ProposalDB) ProposalByRefID

func (db *ProposalDB) ProposalByRefID(RefID string) (*pitypes.ProposalInfo, error)

ProposalByRefID returns the single proposal identified by the provided refID. RefID is generated from the proposal name and used as the descriptive part of the URL to proposal details page on the

func (*ProposalDB) ProposalByToken

func (db *ProposalDB) ProposalByToken(proposalToken string) (*pitypes.ProposalInfo, error)

ProposalByToken returns the single proposal identified by the provided token.

Directories

Path Synopsis
Package piclient handles the http requests made to Politeia APIs.
Package piclient handles the http requests made to Politeia APIs.

Jump to

Keyboard shortcuts

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