source

package
v1.7.5 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Converter added in v1.7.0

type Converter interface {
	// Accept the items from upstream filter as input and then covert them to the required format and returned.
	Convert(itemsOfUpstream []models.FilterItem) (itemsOfDownstream []models.FilterItem)
}

Converter is designed to covert the format of output from upstream filter to the input format required by the downstream filter if needed. Each converter covers only one specified conversion process between the two filters. E.g: If project filter connects to repository filter, then one converter should be defined for this connection; If project filter connects to tag filter, then another one should be defined. The above one can not be reused.

type DefaultFilterChain

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

DefaultFilterChain provides a default implement for interface FilterChain

func NewDefaultFilterChain

func NewDefaultFilterChain(filters []Filter) *DefaultFilterChain

NewDefaultFilterChain returns an instance of DefaultFilterChain

func (*DefaultFilterChain) Build

func (d *DefaultFilterChain) Build(filters []Filter) error

Build nil implement now

func (*DefaultFilterChain) DoFilter

func (d *DefaultFilterChain) DoFilter(filterItems []models.FilterItem) []models.FilterItem

DoFilter does the filter works for filterItems

func (*DefaultFilterChain) Filters

func (d *DefaultFilterChain) Filters() []Filter

Filters returns the filter list

type Filter

type Filter interface {
	// Initialize the filter
	Init() error

	// Return the converter if existing or nil if never set
	GetConverter() Converter

	// Filter the items
	DoFilter(filterItems []models.FilterItem) []models.FilterItem
}

Filter define the operations of selecting the matched resources from the candidates according to the specified pattern.

type FilterChain

type FilterChain interface {
	// Build the filter chain with the filters provided;
	// if failed, an error will be returned.
	Build(filter []Filter) error

	// Return all the filters in the chain.
	Filters() []Filter

	// Filter the items and returned the filtered items via the appended filters in the chain.
	DoFilter(filterItems []models.FilterItem) []models.FilterItem
}

FilterChain is the interface to define the operations of coordinating multiple filters to work together as a whole pipeline. E.g: (original resources)---->[project filter]---->[repository filter]---->[tag filter]---->[......]---->(filter resources)

type LabelFilter added in v1.6.0

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

LabelFilter filter resources according to label

func NewLabelFilter added in v1.6.0

func NewLabelFilter(labelID int64) *LabelFilter

NewLabelFilter returns an instance of LabelFilter

func (*LabelFilter) DoFilter added in v1.6.0

func (l *LabelFilter) DoFilter(items []models.FilterItem) []models.FilterItem

DoFilter filter the resources according to the label

func (*LabelFilter) GetConverter added in v1.7.0

func (l *LabelFilter) GetConverter() Converter

GetConverter ...

func (*LabelFilter) Init added in v1.6.0

func (l *LabelFilter) Init() error

Init ...

type PatternFilter

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

PatternFilter implements Filter interface for pattern filter

func NewPatternFilter

func NewPatternFilter(kind, pattern string, converter ...Converter) *PatternFilter

NewPatternFilter returns an instance of PatternFilter

func (*PatternFilter) DoFilter

func (p *PatternFilter) DoFilter(filterItems []models.FilterItem) []models.FilterItem

DoFilter filters resources

func (*PatternFilter) GetConverter added in v1.7.0

func (p *PatternFilter) GetConverter() Converter

GetConverter returns the converter

func (*PatternFilter) Init

func (p *PatternFilter) Init() error

Init the filter. nil implement for now

type RepositoryConverter added in v1.7.0

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

RepositoryConverter implement Converter interface, convert projects to repositories

func NewRepositoryConverter added in v1.7.0

func NewRepositoryConverter(registry registry.Adaptor) *RepositoryConverter

NewRepositoryConverter returns an instance of RepositoryConverter

func (*RepositoryConverter) Convert added in v1.7.0

func (r *RepositoryConverter) Convert(items []models.FilterItem) []models.FilterItem

Convert projects to repositories

type RepositoryFilter

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

RepositoryFilter implement Filter interface to filter repository

func NewRepositoryFilter

func NewRepositoryFilter(pattern string, registry registry.Adaptor) *RepositoryFilter

NewRepositoryFilter returns an instance of RepositoryFilter

func (*RepositoryFilter) DoFilter

func (r *RepositoryFilter) DoFilter(items []models.FilterItem) []models.FilterItem

DoFilter filters repository and image(according to the repository part) and drops any other resource types

func (*RepositoryFilter) GetConverter added in v1.7.0

func (r *RepositoryFilter) GetConverter() Converter

GetConverter ...

func (*RepositoryFilter) Init

func (r *RepositoryFilter) Init() error

Init ...

type Sourcer

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

Sourcer is used to manage and/or handle all the artifacts and information related with source registry. All the things with replication source should be covered in this object.

func NewSourcer

func NewSourcer() *Sourcer

NewSourcer is the constructor of Sourcer

func (*Sourcer) GetAdaptor

func (sc *Sourcer) GetAdaptor(kind string) registry.Adaptor

GetAdaptor returns the required adaptor with the specified kind. If no adaptor with the specified kind existing, nil will be returned.

func (*Sourcer) Init

func (sc *Sourcer) Init()

Init will do some initialization work like registrying all the adaptors we support

type TagCombinationFilter

type TagCombinationFilter struct{}

TagCombinationFilter implements Filter interface for merging tag filter items whose repository are same into one repository filter item

func NewTagCombinationFilter

func NewTagCombinationFilter() *TagCombinationFilter

NewTagCombinationFilter returns an instance of TagCombinationFilter

func (*TagCombinationFilter) DoFilter

func (t *TagCombinationFilter) DoFilter(filterItems []models.FilterItem) []models.FilterItem

DoFilter filters resources

func (*TagCombinationFilter) GetConverter added in v1.7.0

func (t *TagCombinationFilter) GetConverter() Converter

GetConverter returns the converter

func (*TagCombinationFilter) Init

func (t *TagCombinationFilter) Init() error

Init the filter. nil implement for now

type TagConverter added in v1.7.0

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

TagConverter implement Converter interface, convert repositories to tags

func NewTagConverter added in v1.7.0

func NewTagConverter(registry registry.Adaptor) *TagConverter

NewTagConverter returns an instance of TagConverter

func (*TagConverter) Convert added in v1.7.0

func (t *TagConverter) Convert(items []models.FilterItem) []models.FilterItem

Convert repositories to tags

type TagFilter

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

TagFilter implements Filter interface to filter tag

func NewTagFilter

func NewTagFilter(pattern string, registry registry.Adaptor) *TagFilter

NewTagFilter returns an instance of TagFilter

func (*TagFilter) DoFilter

func (t *TagFilter) DoFilter(items []models.FilterItem) []models.FilterItem

DoFilter filters tag of the image

func (*TagFilter) GetConverter added in v1.7.0

func (t *TagFilter) GetConverter() Converter

GetConverter ...

func (*TagFilter) Init

func (t *TagFilter) Init() error

Init ...

Jump to

Keyboard shortcuts

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