embedder

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 9 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 a concrete implementation of embedder.Finder that caches instantiated embedders and supports hot-swap via Add/Remove/Version.

func New

func New(options ...Option) *Finder

New creates a Finder instance.

func (*Finder) AddConfig

func (f *Finder) AddConfig(name string, cfg *provider.Config)

AddConfig injects or overwrites an embedder configuration and bumps version.

func (*Finder) DropEmbedder

func (f *Finder) DropEmbedder(name string)

DropEmbedder removes a cached instance but keeps the config for lazy re-creation.

func (*Finder) Find

func (f *Finder) Find(ctx context.Context, id string) (base.Embedder, error)

Find returns a cached embedder or creates one from configuration.

func (*Finder) Ids

func (f *Finder) Ids() []string

Ids returns all registered configuration keys.

func (*Finder) Remove

func (f *Finder) Remove(name string)

Remove deletes both configuration and cached instance, bumping version.

func (*Finder) Version

func (f *Finder) Version() int64

Version returns a monotonically increasing counter changed on Add/Remove.

type Option

type Option func(*Finder)

Option defines a functional option for Finder.

func WithConfigLoader

func WithConfigLoader(loader provider.ConfigLoader) Option

WithConfigLoader sets a custom configuration loader.

func WithInitial

func WithInitial(configs ...*provider.Config) Option

WithInitial adds embedder configurations at construction time.

Jump to

Keyboard shortcuts

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