Help us shape the future of Go! Take the 2026 Go Developer Survey

finder

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finder

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

Finder is an in-memory cache with optional lazy-loading through Loader.

func New

func New(options ...Option) *Finder

New creates Finder instance.

func (*Finder) Add

func (d *Finder) Add(name string, a *agent.Agent)

Add stores an Agent under the provided name key.

func (*Finder) All

func (d *Finder) All() []*agent.Agent

All returns a snapshot of all cached agents. It does not invoke the loader.

func (*Finder) Find

func (d *Finder) Find(ctx context.Context, name string) (*agent.Agent, error)

Agent returns an Agent by name, loading it if not found in the cache.

func (*Finder) Remove

func (d *Finder) Remove(name string)

Remove deletes cached agent by name and bumps Version.

func (*Finder) Version

func (d *Finder) Version() int64

Version returns internal version counter.

type Option

type Option func(*Finder)

Option mutates Finder during construction.

func WithInitial

func WithInitial(agents ...*agent.Agent) Option

func WithLoader

func WithLoader(l agent.Loader) Option

Jump to

Keyboard shortcuts

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