filter

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: AGPL-3.0, BSD-2-Clause, ISC Imports: 4 Imported by: 0

Documentation

Overview

package filter represents intervals that are allowed, and denied so an interval can be checked for (a) falling completely within an allowed interval AND (b) also not even partially overlapping a denied interval Note that our avl trees best supports finding clashing intervals so turn our allow list into something we can search for clashes against i.e. invert it to make denied periods between allowed periods and take note of the left most and right most periods allowed to complete the check without using tree functions (to avoid setting arbitrary zero and infinite time) additional check but not finding intervals that fall completely within other intervals

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	*sync.RWMutex `json:"-"`
	// contains filtered or unexported fields
}

Filter represents an allowed interval, with a list of denied sub-intervals

func New

func New() *Filter

New creates a new filter with an empty deny list and no allowed interval

func (*Filter) Allowed

func (f *Filter) Allowed(when interval.Interval) bool

Allowed returns true if the interval is allowed It must not conflict with notAllowed It must not conflict with denied This does not write to the filter so only needs a read lock

func (*Filter) SetAllowed

func (f *Filter) SetAllowed(allowed []interval.Interval) error

SetAllowed adds the allowed intervals to the `allowed list`

func (*Filter) SetDenied

func (f *Filter) SetDenied(denied []interval.Interval) error

SetDenied adds an interval to the `denied list`

Jump to

Keyboard shortcuts

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