ignore

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(store IgnoreStore) error

StartMonitoring starts a new monitoring routine for the given ignore store that counts expired ignore rules and pushes that info into a metric.

func ToQuery

func ToQuery(ignores []*IgnoreRule) ([]url.Values, error)

ToQuery makes a slice of url.Values from the given slice of IngoreRules.

Types

type IgnoreRule

type IgnoreRule struct {
	ID             int64     `json:"id"`
	Name           string    `json:"name"`
	UpdatedBy      string    `json:"updatedBy"`
	Expires        time.Time `json:"expires"`
	Query          string    `json:"query"`
	Note           string    `json:"note"`
	Count          int       `json:"count"          datastore:"-"`
	ExclusiveCount int       `json:"exclusiveCount" datastore:"-"`
}

IgnoreRule is the GUI struct for dealing with Ignore rules.

func NewIgnoreRule

func NewIgnoreRule(name string, expires time.Time, queryStr string, note string) *IgnoreRule

type IgnoreStore

type IgnoreStore interface {
	// Create adds a new rule to the ignore store.
	Create(*IgnoreRule) error

	// List returns all ignore rules in the ignore store.
	// 'addCounts' indicates whether to include counts how often an ignore
	// rule appears in the current tile.
	List(addCounts bool) ([]*IgnoreRule, error)

	// Updates an IgnoreRule.
	Update(id int64, rule *IgnoreRule) error

	// Removes an IgnoreRule from the store. The return value is the number of
	// records that were deleted (either 0 or 1).
	Delete(id int64) (int, error)

	// Revision returns a monotonically increasing int64 that goes up each time
	// the ignores have been changed. It will not persist nor will it be the same
	// between different instances of IgnoreStore. I.e. it will probably start at
	// zero each time an IngoreStore is instantiated.
	Revision() int64

	// BuildRuleMatcher returns a RuleMatcher based on the current content
	// of the ignore store.
	BuildRuleMatcher() (RuleMatcher, error)
}

IgnoreStore stores and matches ignore rules.

func NewCloudIgnoreStore

func NewCloudIgnoreStore(client *datastore.Client, expStore expstorage.ExpectationsStore, tileStream <-chan *types.TilePair) (IgnoreStore, error)

NewCloudIgnoreStore returns an IgnoreStore instance that is backed by Cloud Datastore.

func NewMemIgnoreStore

func NewMemIgnoreStore() IgnoreStore

func NewSQLIgnoreStore

func NewSQLIgnoreStore(vdb *database.VersionedDB, expStore expstorage.ExpectationsStore, tileStream <-chan *types.TilePair) IgnoreStore

NewSQLIgnoreStore creates a new SQL based IgnoreStore.

vdb - database to connect to.
expStore - expectations store needed to count the untriaged digests per rule.
tileStream - continuously provides an updated copy of the current tile.

type MemIgnoreStore

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

MemIgnoreStore is an in-memory implementation of IgnoreStore.

func (*MemIgnoreStore) BuildRuleMatcher

func (m *MemIgnoreStore) BuildRuleMatcher() (RuleMatcher, error)

BuildRuleMatcher, see IgnoreStore interface.

func (*MemIgnoreStore) Create

func (m *MemIgnoreStore) Create(rule *IgnoreRule) error

Create, see IgnoreStore interface.

func (*MemIgnoreStore) Delete

func (m *MemIgnoreStore) Delete(id int64) (int, error)

Delete, see IgnoreStore interface.

func (*MemIgnoreStore) List

func (m *MemIgnoreStore) List(addCounts bool) ([]*IgnoreRule, error)

List, see IgnoreStore interface.

func (*MemIgnoreStore) Revision

func (m *MemIgnoreStore) Revision() int64

func (*MemIgnoreStore) Update

func (m *MemIgnoreStore) Update(id int64, updated *IgnoreRule) error

Update, see IgnoreStore interface.

type QueryRule

type QueryRule map[string]map[string]bool

QueryRule wraps around a web query and allows matching of parameter sets against it.

func NewQueryRule

func NewQueryRule(v url.Values) QueryRule

func (QueryRule) IsMatch

func (q QueryRule) IsMatch(params map[string]string) bool

IsMatch returns true if the set of parameters in params matches this query.

type RuleMatcher

type RuleMatcher func(map[string]string) ([]*IgnoreRule, bool)

RuleMatcher returns a list of rules in the IgnoreStore that match the given set of parameters.

type SQLIgnoreStore

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

func (*SQLIgnoreStore) BuildRuleMatcher

func (m *SQLIgnoreStore) BuildRuleMatcher() (RuleMatcher, error)

BuildRuleMatcher, see IgnoreStore interface.

func (*SQLIgnoreStore) Create

func (m *SQLIgnoreStore) Create(rule *IgnoreRule) error

Create, see IgnoreStore interface.

func (*SQLIgnoreStore) Delete

func (m *SQLIgnoreStore) Delete(id int64) (int, error)

Delete, see IgnoreStore interface.

func (*SQLIgnoreStore) List

func (m *SQLIgnoreStore) List(addCounts bool) ([]*IgnoreRule, error)

List, see IgnoreStore interface.

func (*SQLIgnoreStore) Revision

func (m *SQLIgnoreStore) Revision() int64

Revision, see IngoreStore interface.

func (*SQLIgnoreStore) Update

func (m *SQLIgnoreStore) Update(id int64, rule *IgnoreRule) error

Update, see IgnoreStore interface.

Jump to

Keyboard shortcuts

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