filter

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	Config      *sark.SarkConfig
	BinHostTree map[string][]string
	RulesTree   *FilterMatrix
	// contains filtered or unexported fields
}

func NewFilter

func NewFilter(settings *viper.Viper, l *logger.Logger, config *sark.SarkConfig) (*Filter, error)

func (*Filter) CreateFilterMatrix

func (f *Filter) CreateFilterMatrix() error

func (*Filter) Run

func (f *Filter) Run(binhostDir string) error

type FilterMatrix

type FilterMatrix struct {
	FilterType string
	Father     *Filter
	Branches   map[string]*FilterMatrixBranch
	Resources  []*FilterResource
}

func NewFilterMatrix

func NewFilterMatrix(ftype string) (*FilterMatrix, error)

func (*FilterMatrix) AddResource

func (m *FilterMatrix) AddResource(r *FilterResource) error

func (*FilterMatrix) CheckMatches

func (m *FilterMatrix) CheckMatches(binhost map[string][]string) error

func (*FilterMatrix) CreateBranches

func (m *FilterMatrix) CreateBranches() error

func (*FilterMatrix) GetMatches

func (m *FilterMatrix) GetMatches() []*FilterMatrixLeaf

func (*FilterMatrix) GetMatchesFiles

func (m *FilterMatrix) GetMatchesFiles() []string

func (*FilterMatrix) GetNotMatches

func (m *FilterMatrix) GetNotMatches() []*FilterMatrixLeaf

func (*FilterMatrix) GetNotMatchesFiles

func (m *FilterMatrix) GetNotMatchesFiles() []string

func (*FilterMatrix) GetResourceFilterBySource

func (m *FilterMatrix) GetResourceFilterBySource(source string) (*FilterResource, error)

func (*FilterMatrix) LoadInjectRule

func (m *FilterMatrix) LoadInjectRule(r *FilterResource, rule *sark.SarkFilterRuleConf, level int) error

func (*FilterMatrix) LoadInjectRules

func (m *FilterMatrix) LoadInjectRules(source, rtype string, rules []sark.SarkFilterRuleConf) error

func (*FilterMatrix) Log

func (m *FilterMatrix) Log(level logger.Level, msg string, args ...interface{})

type FilterMatrixBranch

type FilterMatrixBranch struct {
	Category         string
	CategoryFiltered bool
	Matrix           *FilterMatrix
	Resources        []*FilterResource
	Packages         []*gentoo.GentooPackage
	// The key of the map contains file path
	Matches map[string]*FilterMatrixLeaf
	// The key of the map contains file path
	NotMatches map[string]*FilterMatrixLeaf
}

func NewFilterMatrixBranch

func NewFilterMatrixBranch(category string) (*FilterMatrixBranch, error)

func (*FilterMatrixBranch) AddPackage

func (b *FilterMatrixBranch) AddPackage(file string, match bool) (*FilterMatrixLeaf, error)

func (*FilterMatrixBranch) AddResource

func (b *FilterMatrixBranch) AddResource(resource *FilterResource) error

func (*FilterMatrixBranch) CheckPackages

func (b *FilterMatrixBranch) CheckPackages(files []string) error

func (*FilterMatrixBranch) ContainsResource

func (b *FilterMatrixBranch) ContainsResource(resource *FilterResource) (bool, error)

type FilterMatrixLeaf

type FilterMatrixLeaf struct {
	Name     string
	Path     string
	Package  *gentoo.GentooPackage
	Father   *FilterMatrixBranch
	Resource *FilterResource
}

type FilterReport

type FilterReport struct {
	FilterDate string   `json:"filter_date,omitempty"`
	FilterType string   `json:"filter_type,omitempty"`
	Matches    []string `json:"matches,omitempty"`
	NotMatches []string `json:"not_matches,omitempty"`
}

func NewFilterReport

func NewFilterReport(filterType string) (*FilterReport, error)

func (*FilterReport) GetReport

func (f *FilterReport) GetReport() (string, error)

func (*FilterReport) WriteReport

func (f *FilterReport) WriteReport(reportPrefix string) error

type FilterResource

type FilterResource struct {
	Source     string
	Type       string
	Packages   []string
	Categories []string
}

func NewFilterResource

func NewFilterResource(source string, rtype string, pkgs []string, categories []string) (*FilterResource, error)

func (*FilterResource) AddCategory

func (r *FilterResource) AddCategory(category string)

func (*FilterResource) AddPackage

func (r *FilterResource) AddPackage(pkg string)

Jump to

Keyboard shortcuts

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