refcache

package
v1.24.9 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cacher

type Cacher struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewCacher

func NewCacher(repo repo, logger logrus.FieldLogger, tenant string) *Cacher

func NewCacherWithGroup added in v1.19.0

func NewCacherWithGroup(repo repo, logger logrus.FieldLogger, tenant string) *Cacher

func (*Cacher) Build

func (c *Cacher) Build(ctx context.Context, objects []search.Result,
	properties search.SelectProperties, additional additional.Properties,
) error

Build builds the lookup cache recursively and tries to be smart about it. This means that it aims to use only a single (multiget) transaction per layer. The recursion exit condition is jobs marked as done. At some point the cacher will realise that for every nested prop there is already a complete job, so it it stop the recursion.

build is called on a "level" i.e. the search result. After working on the job list for the first time if the resolved items still contain references and the user set the SelectProperty to indicate they want to resolve them, build is called again on all the results (plural!) from the previous run. We thus end up with one request to the backend per level regardless of the amount of lookups per level.

This keeps request times to a minimum even on deeply nested requests.

func (*Cacher) Get

func (c *Cacher) Get(si multi.Identifier) (search.Result, bool)

func (*Cacher) ReplaceInitialPropertiesWithSpecific

func (c *Cacher) ReplaceInitialPropertiesWithSpecific(obj search.Result,
	properties search.SelectProperties,
) (search.SelectProperties, error)

type Resolver

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

func NewResolver

func NewResolver(cacher cacher) *Resolver

func NewResolverWithGroup added in v1.19.0

func NewResolverWithGroup(cacher cacher) *Resolver

func (*Resolver) Do

func (r *Resolver) Do(ctx context.Context, objects []search.Result,
	properties search.SelectProperties, additional additional.Properties,
) ([]search.Result, error)

Jump to

Keyboard shortcuts

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