luci: go.chromium.org/luci/server/auth/authdb/internal/globset Index | Files

package globset

import "go.chromium.org/luci/server/auth/authdb/internal/globset"

Package globset preprocesses []identity.Glob for faster querying.

Index

Package Files

globset.go

type Builder Uses

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

Builder builds GlobSet from individual globs.

Keeps the cache of compiled regexps internally.

func NewBuilder Uses

func NewBuilder() *Builder

NewBuilder constructs new Builder instance.

func (*Builder) Add Uses

func (b *Builder) Add(g identity.Glob) error

Add adds a glob to the set being constructed.

Returns an error if the glob is malformed.

func (*Builder) Build Uses

func (b *Builder) Build() (GlobSet, error)

Build returns the fully constructed set or nil if it is empty.

Returns an error if some glob can't be compiled into a regexp.

func (*Builder) Reset Uses

func (b *Builder) Reset()

Reset prepares the builder for building a new GlobSet.

Keeps the cache of compiled regexps.

type GlobSet Uses

type GlobSet map[identity.Kind]*regexp.Regexp

GlobSet encodes same set of identities as some []identity.Glob.

For each possible identity type it has a single regexp against an identity value which tests whether it is in the set or not.

Construct it via Builder.

func (GlobSet) Has Uses

func (gs GlobSet) Has(id identity.Identity) bool

Has checks whether 'id' is in the set.

Malformed identities are considered to be not in the set. 'nil' GlobSet is considered empty.

Package globset imports 5 packages (graph) and is imported by 1 packages. Updated 2019-10-22. Refresh now. Tools for package owners.