Documentation ¶
Overview ¶
Package proposals holds the various methods and functions that facilitate access to Politeia votes data cloned from github and accessed using the git commandline interface. Pre-Installation of the git cmd tool is a requirement for effective functionality use.
Index ¶
- Constants
- type Parser
- func (p *Parser) ProposalHistory(proposalToken string) ([]*types.History, error)
- func (p *Parser) ProposalHistorySince(proposalToken string, since time.Time) ([]*types.History, error)
- func (p *Parser) ProposalsHistory() ([]*types.History, error)
- func (p *Parser) ProposalsHistorySince(since time.Time) ([]*types.History, error)
- func (p *Parser) TriggerUpdates() error
- func (p *Parser) UpdateSignal() <-chan struct{}
Constants ¶
const (
// DirPrefix defines the temporary folder prefix.
DirPrefix = "go-piparser"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
Parser holds the clone directory, repo owner and repo name. This data is used to query politeia data via git command line tool.
func NewParser ¶
NewParser returns a Parser instance with repoName, cloneDir and repoOwner set. If the repoName and repoOwner provided are empty, the defaults are set. If the cloneDir is not provided or an invalid path is provided, a dir in the tmp folder is created and set. It also sets ups the environment by cloning the repo if it doesn't exist or fetches the latest updates if it does. It initiates an asynchronous fetch of hourly politeia updates and there after triggers the client to fetch the new updates via a signal channel if the trigger flag was set and the channel isn't blocked.
func (*Parser) ProposalHistory ¶
ProposalHistory returns the all the commits history data associated with the provided proposal token. This method is thread-safe.
func (*Parser) ProposalHistorySince ¶
func (p *Parser) ProposalHistorySince(proposalToken string, since time.Time) ([]*types.History, error)
ProposalHistorySince returns the commits history data associated with the provided proposal token and was made after the since argument time provided. This method is thread-safe.
func (*Parser) ProposalsHistory ¶
ProposalsHistory returns all the commits history data for the current proposal tokens available. This method is thread-safe.
func (*Parser) ProposalsHistorySince ¶
ProposalsHistorySince returns all the commits history updates for the current proposal tokens available since the provided date. This method is thread-safe.
func (*Parser) TriggerUpdates ¶
TriggerUpdates allows the user to have a way to trigger updates retrieval from github should they choose not to wait for the hourly updates or are confident that new updates exists but the default update may take a while. This is as a fail safe method to trigger updates but its usage should be limited to very necessary instances to avoid blocking the default hourly updates retrieval system.
func (*Parser) UpdateSignal ¶
func (p *Parser) UpdateSignal() <-chan struct{}
UpdateSignal sends a read only signal channel used to inform the client that some updates exists.
Directories ¶
Path | Synopsis |
---|---|
Package types defines the data structures and regular expressions that helps to unmarshal commits history string into data to be shared with the outside world.
|
Package types defines the data structures and regular expressions that helps to unmarshal commits history string into data to be shared with the outside world. |