Documentation ¶
Index ¶
- func DisableLog()
- func UseLogger(logger slog.Logger)
- type ProposalsDB
- func (db *ProposalsDB) Close() error
- func (db *ProposalsDB) ProposalByToken(token string) (*pitypes.ProposalRecord, error)
- func (db *ProposalsDB) ProposalsAll(offset, rowsCount int, filterByVoteStatus ...int) ([]*pitypes.ProposalRecord, int, error)
- func (db *ProposalsDB) ProposalsLastSync() int64
- func (db *ProposalsDB) ProposalsSync() 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 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.