repo2cpe

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalUpdaterJob

type LocalUpdaterJob struct {
	URL    string
	Client *http.Client
	// contains filtered or unexported fields
}

LocalUpdaterJob provides local repo -> cpe mapping via a continually updated local mapping file

func NewLocalUpdaterJob

func NewLocalUpdaterJob(url string, client *http.Client) *LocalUpdaterJob

NewLocalUpdaterJob returns a unstarted UpdaterJob.

func (*LocalUpdaterJob) Get

func (updater *LocalUpdaterJob) Get(ctx context.Context, repositories []string) ([]string, error)

Get translates repositories into CPEs using a mapping file.

Get is safe for concurrent usage.

func (*LocalUpdaterJob) Start

func (updater *LocalUpdaterJob) Start(ctx context.Context) error

Start begins a local updater job keeping the atomic mapping variable up to date.

Start will block until the first atomic update of the mapping file completes.

All subsequent updates are performed asynchronously in a goroutine.

Canceling the ctx will cancel the updating.

type MappingFile

type MappingFile struct {
	Data map[string]Repo `json:"data"`
}

MappingFile is a data struct for mapping file between repositories and CPEs

type Repo

type Repo struct {
	CPEs []string `json:"cpes"`
}

Repo structure holds information about CPEs for given repo

type RepoCPEMapping

type RepoCPEMapping struct {
	RepoCPEUpdater
}

RepoCPEMapping struct handles translation of repositories to CPEs

func (*RepoCPEMapping) RepositoryToCPE

func (mapping *RepoCPEMapping) RepositoryToCPE(ctx context.Context, repositories []string) ([]string, error)

RepositoryToCPE translates repositories into CPEs

type RepoCPEUpdater

type RepoCPEUpdater interface {
	Get(context.Context, []string) ([]string, error)
}

RepoCPEUpdater provides interface for providing a mapping between repositories and CPEs

Jump to

Keyboard shortcuts

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