todata

package
v7.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 1 more Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CRConfig

type CRConfig struct {
	ContentServers map[tc.CacheName]struct {
		DeliveryServices map[tc.DeliveryServiceName][]string `json:"deliveryServices"`
		CacheGroup       string                              `json:"cacheGroup"`
		Type             string                              `json:"type"`
	} `json:"contentServers"`
	DeliveryServices map[tc.DeliveryServiceName]struct {
		Topology  tc.TopologyName `json:"topology"`
		Matchsets []struct {
			Protocol  string `json:"protocol"`
			MatchList []struct {
				Regex string `json:"regex"`
				Type  string `json:"match-type"`
			} `json:"matchlist"`
		} `json:"matchsets"`
	} `json:"deliveryServices"`
	Topologies map[tc.TopologyName]struct {
		Nodes []string `json:"nodes"`
	}
}

CRConfig is the CrConfig data needed by TOData. Note this is not all data in the CRConfig. TODO change strings to type?

type Regexes

type Regexes struct {
	DirectMatches                      map[string]tc.DeliveryServiceName
	DotStartSlashDotFooSlashDotDotStar map[string]tc.DeliveryServiceName
	RegexMatch                         map[*regexp.Regexp]tc.DeliveryServiceName
}

Regexes maps Delivery Service Regular Expressions to delivery services. For performance, we categorize Regular Expressions into 3 categories: 1. Direct string matches, with no regular expression matching characters 2. .*\.foo\..* expressions, where foo is a direct string match with no regular expression matching characters 3. Everything else This allows us to do a cheap match on 1 and 2, and only regex match the uncommon case.

func NewRegexes

func NewRegexes() Regexes

NewRegexes constructs a new Regexes object, initializing internal pointer members.

func (Regexes) DeliveryService

func (d Regexes) DeliveryService(domain, subdomain, subsubdomain string) (tc.DeliveryServiceName, bool)

DeliveryService returns the delivery service which matches the given fqdn, or false.

type TOData

type TOData struct {
	DeliveryServiceRegexes Regexes
	DeliveryServiceServers map[tc.DeliveryServiceName][]tc.CacheName
	DeliveryServiceTypes   map[tc.DeliveryServiceName]tc.DSTypeCategory
	ServerCachegroups      map[tc.CacheName]tc.CacheGroupName
	ServerDeliveryServices map[tc.CacheName][]tc.DeliveryServiceName
	ServerTypes            map[tc.CacheName]tc.CacheType
}

TOData holds CDN data fetched from Traffic Ops.

func New

func New() *TOData

New returns a new empty TOData object, initializing pointer members.

type TODataThreadsafe

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

TODataThreadsafe provides safe access for multiple goroutine writers and one goroutine reader, to the encapsulated TOData object. This could be made lock-free, if the performance was necessary

func NewThreadsafe

func NewThreadsafe() TODataThreadsafe

NewThreadsafe returns a new TOData object, wrapped to be safe for multiple goroutine readers and a single writer.

func (TODataThreadsafe) Get

func (d TODataThreadsafe) Get() TOData

Get returns the current TOData. Callers MUST NOT modify returned data. Mutation IS NOT threadsafe If callers need to modify, a new GetMutable() should be added which copies.

func (TODataThreadsafe) Update

func (d TODataThreadsafe) Update(to towrap.TrafficOpsSessionThreadsafe, cdn string, mc tc.TrafficMonitorConfigMap) error

Update updates the TOData data with the last fetched CDN

Jump to

Keyboard shortcuts

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