Documentation ¶
Index ¶
- Variables
- func Select(allTasks []Task, selectionRequest pkgcataloging.SelectionRequest) ([]Task, Selection, error)
- type CatalogingFactoryConfig
- type ErrInvalidExpression
- type Executor
- type Expression
- type Expressions
- type Operation
- type PackageTaskFactories
- type Selection
- type Selector
- type Task
- func NewEnvironmentTask() Task
- func NewExecutableCatalogerTask(selection file.Selection, cfg executable.Config) Task
- func NewFileContentCatalogerTask(cfg filecontent.Config) Task
- func NewFileDigestCatalogerTask(selection file.Selection, hashers ...crypto.Hash) Task
- func NewFileMetadataCatalogerTask(selection file.Selection) Task
- func NewPackageTask(cfg CatalogingFactoryConfig, c pkg.Cataloger, tags ...string) Task
- func NewRelationshipsTask(cfg cataloging.RelationshipsConfig, src source.Description) Task
- func NewTask(name string, tsk func(context.Context, file.Resolver, sbomsync.Builder) error, ...) Task
- type TokenSelection
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyToken = fmt.Errorf("no value given") ErrInvalidToken = fmt.Errorf("invalid token given: only alphanumeric characters and hyphens are allowed") ErrInvalidOperator = fmt.Errorf("invalid operator given") ErrUnknownNameOrTag = fmt.Errorf("unknown name or tag given") ErrTagsNotAllowed = fmt.Errorf("tags are not allowed with this operation (must use exact names)") ErrNamesNotAllowed = fmt.Errorf("names are not allowed with this operation (must use tags)") ErrAllNotAllowed = fmt.Errorf("cannot use the 'all' operand in this context") )
Functions ¶
func Select ¶
func Select(allTasks []Task, selectionRequest pkgcataloging.SelectionRequest) ([]Task, Selection, error)
Select parses the given expressions as two sets: expressions that represent a "set" operation, and expressions that represent all other operations. The parsed expressions are then evaluated against the given tasks to return a subset (or the same) set of tasks.
Types ¶
type CatalogingFactoryConfig ¶
type CatalogingFactoryConfig struct { SearchConfig cataloging.SearchConfig RelationshipsConfig cataloging.RelationshipsConfig DataGenerationConfig cataloging.DataGenerationConfig PackagesConfig pkgcataloging.Config }
func DefaultCatalogingFactoryConfig ¶
func DefaultCatalogingFactoryConfig() CatalogingFactoryConfig
type ErrInvalidExpression ¶
ErrInvalidExpression represents an expression that cannot be parsed or can be parsed but is logically invalid.
func (ErrInvalidExpression) Error ¶
func (e ErrInvalidExpression) Error() string
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func NewTaskExecutor ¶
type Expression ¶
Expression represents a single operation-operand pair with (all validation errors). E.g. "+foo", "-bar", or "something" are all expressions. Some validations are relevant to not only the syntax (operation and operator) but other are sensitive to the context of the operand (e.g. if a given operand is a tag or a name, validated against the operation).
func (Expression) String ¶
func (e Expression) String() string
type Expressions ¶
type Expressions []Expression
Expressions represents a list of expressions.
func (Expressions) Clone ¶
func (e Expressions) Clone() Expressions
func (Expressions) Errors ¶
func (e Expressions) Errors() (errs []error)
func (Expressions) Len ¶
func (e Expressions) Len() int
func (Expressions) Less ¶
func (e Expressions) Less(i, j int) bool
func (Expressions) Swap ¶
func (e Expressions) Swap(i, j int)
func (Expressions) Validate ¶
func (e Expressions) Validate() error
type Operation ¶
type Operation string
Operation represents the type of operation to perform on the operand (set, add, remove, sub-select).
type PackageTaskFactories ¶
type PackageTaskFactories []packageTaskFactory
func DefaultPackageTaskFactories ¶
func DefaultPackageTaskFactories() PackageTaskFactories
func (PackageTaskFactories) Tasks ¶
func (f PackageTaskFactories) Tasks(cfg CatalogingFactoryConfig) ([]Task, error)
type Selection ¶
type Selection struct { Request pkgcataloging.SelectionRequest Result *strset.Set TokensByTask map[string]TokenSelection }
Selection represents the users request for a subset of tasks to run and the resulting set of task names that were selected. Additionally, all tokens that were matched on to reach the returned conclusion are also provided.
type Task ¶
type Task interface { Name() string Execute(context.Context, file.Resolver, sbomsync.Builder) error }
Task is a function that can wrap a cataloger to populate the SBOM with data (coordinated through the mutex).
func NewEnvironmentTask ¶
func NewEnvironmentTask() Task
func NewExecutableCatalogerTask ¶ added in v0.104.0
func NewExecutableCatalogerTask(selection file.Selection, cfg executable.Config) Task
func NewFileContentCatalogerTask ¶
func NewFileContentCatalogerTask(cfg filecontent.Config) Task
func NewPackageTask ¶
func NewPackageTask(cfg CatalogingFactoryConfig, c pkg.Cataloger, tags ...string) Task
NewPackageTask creates a Task function for a generic pkg.Cataloger, honoring the common configuration options.
func NewRelationshipsTask ¶
func NewRelationshipsTask(cfg cataloging.RelationshipsConfig, src source.Description) Task