tracker

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRepositories

func GetRepositories(
	cfg *viper.Viper,
	rm hub.RepositoryManager,
	kind hub.RepositoryKind,
) ([]*hub.Repository, error)

GetRepositories gets the repositories a tracker will process. If a list of repositories names is found in the configuration provided, those will be the repositories returned provided they are found. If no repositories names are found in the configuration, all the repositories of the kind provided will be returned.

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.

Jump to

Keyboard shortcuts

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