tracker

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetVerifiedPublisherFlag added in v0.5.0

func SetVerifiedPublisherFlag(svc *Services, r *hub.Repository, mdFile string) error

SetVerifiedPublisherFlag sets the repository verified publisher flag for the repository provided when needed.

Types

type DBErrorsCollector

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

DBErrorsCollector is in charge of collecting errors that happen while repositories are being processed. Once all the processing is done, the collected errors can be flushed, which will store them in the database.

func NewDBErrorsCollector

func NewDBErrorsCollector(
	ctx context.Context,
	repoManager hub.RepositoryManager,
	repos []*hub.Repository,
) *DBErrorsCollector

NewDBErrorsCollector creates a new DBErrorsCollector instance.

func (*DBErrorsCollector) Append

func (c *DBErrorsCollector) Append(repositoryID string, err error)

Append adds the error provided to the repository's list of errors.

func (*DBErrorsCollector) Flush

func (c *DBErrorsCollector) Flush()

Flush aggregates all errors collected per repository as a single text and stores it in the database.

type ErrorsCollector

type ErrorsCollector interface {
	Append(repositoryID string, err error)
	Flush()
}

ErrorsCollector interface defines the methods that an errors collector implementation should provide.

type ErrorsCollectorMock

type ErrorsCollectorMock struct {
	mock.Mock
}

ErrorsCollectorMock is mock ErrorsCollector implementation.

func (*ErrorsCollectorMock) Append

func (m *ErrorsCollectorMock) Append(repositoryID string, err error)

Append implements the ErrorsCollector interface.

func (*ErrorsCollectorMock) Flush

func (m *ErrorsCollectorMock) Flush()

Flush implements the ErrorsCollector interface.

type HTTPGetter added in v0.5.0

type HTTPGetter interface {
	Get(url string) (*http.Response, error)
}

HTTPGetter defines the methods an HTTPGetter implementation must provide.

type HTTPGetterMock added in v0.5.0

type HTTPGetterMock struct {
	mock.Mock
}

HTTPGetterMock is a mock HTTPGetter implementation.

func (*HTTPGetterMock) Get added in v0.5.0

func (m *HTTPGetterMock) Get(url string) (*http.Response, error)

Get implements the HTTPGetter interface.

type New added in v0.4.0

type New func(svc *Services, r *hub.Repository, opts ...func(t Tracker)) Tracker

New represents a function that creates new repository trackers. Each tracker is in charge of processing a given repository, and based on the concurrency configured, the tracker cmd may run multiple Tracker instances concurrently.

type Services added in v0.4.0

Services represents a set of services that must be provided to a Tracker instance so that it can perform its tasks.

type Tracker added in v0.4.0

type Tracker interface {
	Track(wg *sync.WaitGroup) error
}

Tracker is the interface that wraps the Track method, used to ask a tracker to start running and processing packages in a given repository. A call to wg.Done() is expected once the tracker has completed.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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