source

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Convertor

type Convertor 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)
}

Convertor is designed to covert the format of output from upstream filter to the input format required by the downstream filter if needed. Each convertor covers only one specified conversion process between the two filters. E.g: If project filter connects to repository filter, then one convertor 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 convertor if existing or nil if never set
	GetConvertor() Convertor

	//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 PatternFilter

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

PatternFilter implements Filter interface for pattern filter

func NewPatternFilter

func NewPatternFilter(kind, pattern string, convertor ...Convertor) *PatternFilter

NewPatternFilter returns an instance of PatternFilter

func (*PatternFilter) DoFilter

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

DoFilter filters resources

func (*PatternFilter) GetConvertor

func (p *PatternFilter) GetConvertor() Convertor

GetConvertor returns the convertor

func (*PatternFilter) Init

func (p *PatternFilter) Init() error

Init the filter. nil implement for now

type RepositoryConvertor

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

RepositoryConvertor implement Convertor interface, convert projects to repositories

func NewRepositoryConvertor

func NewRepositoryConvertor(registry registry.Adaptor) *RepositoryConvertor

NewRepositoryConvertor returns an instance of RepositoryConvertor

func (*RepositoryConvertor) Convert

func (r *RepositoryConvertor) 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) GetConvertor

func (r *RepositoryFilter) GetConvertor() Convertor

GetConvertor ...

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) GetConvertor

func (t *TagCombinationFilter) GetConvertor() Convertor

GetConvertor returns the convertor

func (*TagCombinationFilter) Init

func (t *TagCombinationFilter) Init() error

Init the filter. nil implement for now

type TagConvertor

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

TagConvertor implement Convertor interface, convert repositories to tags

func NewTagConvertor

func NewTagConvertor(registry registry.Adaptor) *TagConvertor

NewTagConvertor returns an instance of TagConvertor

func (*TagConvertor) Convert

func (t *TagConvertor) 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) GetConvertor

func (t *TagFilter) GetConvertor() Convertor

GetConvertor ...

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