proposals

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

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

Go to latest
Published: Dec 19, 2019 License: ISC Imports: 12 Imported by: 10

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

View Source
const (

	// DirPrefix defines the temporary folder prefix.
	DirPrefix = "go-piparser"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

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

func NewParser(repoOwner, repo, rootCloneDir string) (*Parser, error)

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

func (p *Parser) ProposalHistory(proposalToken string) ([]*types.History, error)

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

func (p *Parser) ProposalsHistory() ([]*types.History, error)

ProposalsHistory returns all the commits history data for the current proposal tokens available. This method is thread-safe.

func (*Parser) ProposalsHistorySince

func (p *Parser) ProposalsHistorySince(since time.Time) ([]*types.History, error)

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

func (p *Parser) TriggerUpdates() error

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.

Jump to

Keyboard shortcuts

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