service

package
v0.0.0-...-f04227e Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package service contains logics around working with service config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Update

func Update(ctx context.Context) error

Update updates the `Service` entities for all registered services.

Also deletes the entities for un-registered services.

Types

type Finder

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

Finder provides fast look up for services interested in the provided config.

It loads `Service` entity for all registered services and pre-compute the ConfigPattern to in-memory data structures that promotes faster matching performance.

See ConfigPattern syntax at https://pkg.go.dev/go.chromium.org/luci/common/proto/config#ConfigPattern

It can be used as an one-off look up. However, to unlock its full ability, the caller should use a singleton and call `RefreshPeriodically` in the background to keep the singleton's pre-computed patterns up-to-date with.

func NewFinder

func NewFinder(ctx context.Context) (*Finder, error)

NewFinder instantiate a new Finder that are ready for look up.

func (*Finder) FindInterestedServices

func (m *Finder) FindInterestedServices(ctx context.Context, cs config.Set, filePath string) []*model.Service

FindInterestedServices look up for services interested in the given config.

Look-up is performed in memory.

func (*Finder) RefreshPeriodically

func (m *Finder) RefreshPeriodically(ctx context.Context)

RefreshPeriodically refreshes the finder with the latest registered services information every 1 minute until context is cancelled.

Log the error if refresh has failed.

Jump to

Keyboard shortcuts

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