re

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Overview

Package re provides a simple function to access compile regex objects for the FQDN subsystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileRegex

func CompileRegex(p string) (*regexp.Regexp, error)

CompileRegex compiles a pattern p into a regex and returns the regex object. The regex object will be cached by an LRU. If p has already been compiled and cached, this function will return the cached regex object. If not already cached, it will compile p into a regex object and cache it in the LRU. This function will return an error if the LRU has not already been initialized.

func InitRegexCompileLRU

func InitRegexCompileLRU(size int) error

InitRegexCompileLRU creates a new instance of the regex compilation LRU.

Types

type RegexCompileLRU

type RegexCompileLRU struct {
	// The lru package doesn't provide any concurrency guarantees so we must
	// provide our own locking.
	*lock.Mutex
	*lru.Cache
}

RegexCompileLRU is an LRU cache for storing compiled regex objects of FQDN names or patterns, used in CiliumNetworkPolicy or ClusterwideCiliumNetworkPolicy.

Jump to

Keyboard shortcuts

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