discovery

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEndpointsNotFound is the returned error when couldn't find
	// endpoints for a certain repository.
	ErrEndpointsNotFound = errors.NewKind("endpoinds not found for %s")

	// ErrNewRepositoriesNotFound is returned when there aren't new
	// repositories in the organization.
	ErrNewRepositoriesNotFound = errors.NewKind(
		"couldn't find new repositories")

	// ErrRateLimitExceeded is returned when the api rate limit is reached.
	ErrRateLimitExceeded = errors.NewKind("rate limit requests exceeded")

	// ErrDiscoveryStopped is returned when a discovery has been stopped.
	ErrDiscoveryStopped = errors.NewKind("discovery stopped")

	// ErrDiscoveryStop is returned when a discovery fails on Stop.
	ErrDiscoveryStop = errors.NewKind("discovery failed on stop")

	// ErrAdvertiseTimeout is returned when an advertise functions exceeds
	// the timeout.
	ErrAdvertiseTimeout = errors.NewKind("advertise repositories timeout")
)

Functions

func GetGHEndpoint added in v0.0.3

func GetGHEndpoint(r *github.Repository) (string, error)

GetGHEndpoint gets the enpoint for a github repository.

Types

type AdvertiseGHRepositoriesFn added in v0.0.3

type AdvertiseGHRepositoriesFn func(context.Context, []*github.Repository) error

AdvertiseGHRepositoriesFn is used by a GitHub to notify that a new repository has been discovered.

type GHOrgReposIter

type GHOrgReposIter struct {
	// contains filtered or unexported fields
}

GHOrgReposIter is a GHRepositoriesIter by organization name.

func NewGHOrgReposIter

func NewGHOrgReposIter(org string, excludedRepos []string, opts *GHReposIterOpts) *GHOrgReposIter

NewGHOrgReposIter builds a new GHOrgReposIter.

func (*GHOrgReposIter) Next

Next implements the GHRepositoriesIter interface.

type GHReposIterOpts

type GHReposIterOpts struct {
	HTTPTimeout    time.Duration
	ResultsPerPage int
	TimeNewRepos   time.Duration
	AuthToken      string
}

GHReposIterOpts represents configuration options for a GHReposIter.

type GHRepositoriesIter

type GHRepositoriesIter interface {
	Next(context.Context) (*github.Repository, time.Duration, error)
}

GHRepositoriesIter represents an iterator of *github.Repositories

type GitHub added in v0.0.3

type GitHub struct {
	// contains filtered or unexported fields
}

GitHub will retrieve the information for all the repositories for the given GHRepositoriesIterator.

func NewGitHub added in v0.0.3

func NewGitHub(
	advertiseRepos AdvertiseGHRepositoriesFn,
	iter GHRepositoriesIter,
	opts *GitHubOpts,
) *GitHub

NewGitHub builds a new GitHub.

func (*GitHub) Start added in v0.0.3

func (p *GitHub) Start() error

Start starts the GitHub.

func (*GitHub) Stop added in v0.0.3

func (p *GitHub) Stop() error

Stop stops the GitHub.

type GitHubOpts added in v0.0.3

type GitHubOpts struct {
	AdvertiseTimeout time.Duration
	SkipForks        bool
	WaitNewRepos     bool
	WaitOnRateLimit  bool
	StopTimeout      time.Duration
	MaxJobBuffer     int
	BatchSize        int
}

GitHubOpts represents configuration options for a GitHub discovery.

Jump to

Keyboard shortcuts

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