politeia

package
v4.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: ISC Imports: 22 Imported by: 2

Documentation

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 ProposalsDB

type ProposalsDB struct {
	APIPath string
	// contains filtered or unexported fields
}

ProposalsDB defines the object that interacts with the local proposals db, and with decred's politeia server.

func NewProposalsDB

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

NewProposalsDB opens an existing database or creates a new a storm DB instance with the provided path. It also sets up a new politeia http client and returns them on a proposals DB instance.

func (*ProposalsDB) Close

func (db *ProposalsDB) Close() error

Close closes the proposal DB instance.

func (*ProposalsDB) ProposalByToken

func (db *ProposalsDB) ProposalByToken(token string) (*pitypes.ProposalRecord, error)

ProposalByToken retrieves the proposal for the given token argument.

Satisfies the PoliteiaBackend interface.

func (*ProposalsDB) ProposalsAll

func (db *ProposalsDB) ProposalsAll(offset, rowsCount int,
	filterByVoteStatus ...int) ([]*pitypes.ProposalRecord, int, error)

ProposalsAll fetches the proposals data from the local db. The argument filterByVoteStatus is optional.

Satisfies the PoliteiaBackend interface.

func (*ProposalsDB) ProposalsLastSync

func (db *ProposalsDB) ProposalsLastSync() int64

ProposalsLastSync reads the last sync timestamp from the atomic db.

Satisfies the PoliteiaBackend interface.

func (*ProposalsDB) ProposalsSync

func (db *ProposalsDB) ProposalsSync() error

ProposalsSync is responsible for keeping an up-to-date database synced with politeia's latest updates.

Satisfies the PoliteiaBackend interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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