catalog

package
v0.0.0-...-202a999 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ActionDiscard represents the discard rule action keyword.
	ActionDiscard = "discard"
	// ActionRewrite represents the rewrite rule action keyword.
	ActionRewrite = "rewrite"
	// ActionSieve represents the sieve rule action keyword.
	ActionSieve = "sieve"

	// TargetAny represents the global target matching keyword.
	TargetAny = "any"
	// TargetOrigin represents the origin target matching keyword.
	TargetOrigin = "origin"
	// TargetSource represents the source target matching keyword.
	TargetSource = "source"
	// TargetMetric represents the metric target matching keyword.
	TargetMetric = "metric"
)

Variables

View Source
var (
	// ErrEmptyOrigin represents an empty catalog origin error.
	ErrEmptyOrigin = errors.New("empty origin")
	// ErrEmptySource represents an empty catalog source error.
	ErrEmptySource = errors.New("empty source")
	// ErrEmptyMetric represents an empty catalog metric error.
	ErrEmptyMetric = errors.New("empty metric")
	// ErrUnknownOrigin represents an unknown catalog origin error.
	ErrUnknownOrigin = errors.New("unknown origin")
	// ErrUnknownSource represents an unknown catalog source error.
	ErrUnknownSource = errors.New("unknown source")
	// ErrUnknownMetric represents an unknown catalog metric error.
	ErrUnknownMetric = errors.New("unknown metric")
)

Functions

This section is empty.

Types

type Catalog

type Catalog struct {
	Name      string
	Priority  int
	Origins   map[string]*Origin
	Connector interface{}
}

Catalog represents a catalog instance.

func New

func New(name string, connector interface{}) *Catalog

New creates a new catalog instance.

func (*Catalog) Dump

func (c *Catalog) Dump(path string) error

Dump dumps the catalog records to a file.

func (*Catalog) Insert

func (c *Catalog) Insert(r *Record) error

Insert inserts a new record into the catalog.

func (*Catalog) Metric

func (c *Catalog) Metric(originName, sourceName, metricName string) (*Metric, error)

Metric returns an existing metric from the catalog or an error if the metric doesn't exist.

func (*Catalog) Origin

func (c *Catalog) Origin(originName string) (*Origin, error)

Origin returns an existing origin from the catalog or an error if the origin doesn't exist.

func (*Catalog) Restore

func (c *Catalog) Restore(path string) error

Restore restores the catalog records from a file.

func (*Catalog) Source

func (c *Catalog) Source(originName, sourceName string) (*Source, error)

Source returns an existing source from the catalog or an error if the source doesn't exist.

type FilterChain

type FilterChain struct {
	Input    chan *Record
	Output   chan *Record
	Messages chan string
	// contains filtered or unexported fields
}

FilterChain represents a catalog filtering chain instance.

func NewFilterChain

func NewFilterChain(rules *storage.ProviderFilters) *FilterChain

NewFilterChain creates a new catalog filtering chain instance.

type Metric

type Metric struct {
	Name       string
	Attributes *maputil.Map
	// contains filtered or unexported fields
}

Metric represents a catalog metric instance.

func (*Metric) Catalog

func (m *Metric) Catalog() *Catalog

Catalog returns the parent catalog of the origin.

func (*Metric) Origin

func (m *Metric) Origin() *Origin

Origin returns the parent origin of the source.

func (*Metric) Source

func (m *Metric) Source() *Source

Source returns the parent origin of the source.

type Origin

type Origin struct {
	Name    string
	Sources map[string]*Source
	// contains filtered or unexported fields
}

Origin represents a catalog origin instance.

func (*Origin) Catalog

func (o *Origin) Catalog() *Catalog

Catalog returns the parent catalog of the origin.

type Record

type Record struct {
	Origin     string
	Source     string
	Metric     string
	Attributes *maputil.Map
}

Record represents a catalog record instance.

func (Record) String

func (r Record) String() string

type Searcher

type Searcher struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Searcher represents a catalog searcher instance.

func NewSearcher

func NewSearcher() *Searcher

NewSearcher creates a new catalog search instance.

func (*Searcher) Metrics

func (s *Searcher) Metrics(originName, sourceName, metricName string) []*Metric

Metrics returns a slice of metrics from the catalog searcher.

func (*Searcher) Origins

func (s *Searcher) Origins(originName string) []*Origin

Origins returns a slice of origins from the catalog searcher.

func (*Searcher) Register

func (s *Searcher) Register(c *Catalog)

Register registers a new catalog in the catalog searcher.

func (*Searcher) Sources

func (s *Searcher) Sources(originName, sourceName string) []*Source

Sources returns a slice of sources from the catalog searcher.

func (*Searcher) Unregister

func (s *Searcher) Unregister(c *Catalog)

Unregister unregisters a catalog from the catalog searcher.

type Source

type Source struct {
	Name    string
	Metrics map[string]*Metric
	// contains filtered or unexported fields
}

Source represents a catalog source instance.

func (*Source) Catalog

func (s *Source) Catalog() *Catalog

Catalog returns the parent catalog of the origin.

func (*Source) Origin

func (s *Source) Origin() *Origin

Origin returns the parent origin of the source.

Jump to

Keyboard shortcuts

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