Documentation ¶
Overview ¶
Package politeia manages Politeia proposals and the voting that is coordinated by the Politeia server and anchored on the blockchain.
Index ¶
- func DisableLog()
- func UseLogger(logger slog.Logger)
- type ProposalDB
- func (db *ProposalDB) AllProposals(offset, rowsCount int, filterByVoteStatus ...int) (proposals []*pitypes.ProposalInfo, totalCount int, err error)
- func (db *ProposalDB) CheckProposalsUpdates() error
- func (db *ProposalDB) Close() error
- func (db *ProposalDB) LastProposalsSync() int64
- func (db *ProposalDB) ProposalByRefID(RefID string) (*pitypes.ProposalInfo, error)
- func (db *ProposalDB) ProposalByToken(proposalToken string) (*pitypes.ProposalInfo, error)
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.
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.