registry

package
v0.20260225.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package registry provides functionality for loading server.json files and building the aggregate upstream registry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder assembles an UpstreamRegistry from loaded ServerJSON entries.

func NewBuilder

func NewBuilder(loader *Loader) *Builder

NewBuilder creates a new Builder backed by the given Loader.

func (*Builder) Build

func (b *Builder) Build() *thvregistry.UpstreamRegistry

Build creates the UpstreamRegistry structure from loaded entries. Servers are ordered by directory name for deterministic output.

func (*Builder) ValidateAgainstSchema

func (b *Builder) ValidateAgainstSchema() error

ValidateAgainstSchema builds the registry and validates it without writing.

func (*Builder) WriteJSON

func (b *Builder) WriteJSON(path string) error

WriteJSON builds the registry, validates it, and writes JSON to the given path.

type LegacyBuilder

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

LegacyBuilder assembles a legacy toolhive Registry from loaded ServerJSON entries. It converts each ServerJSON back to ImageMetadata or RemoteServerMetadata using the converters package.

func NewLegacyBuilder

func NewLegacyBuilder(loader *Loader) *LegacyBuilder

NewLegacyBuilder creates a new LegacyBuilder backed by the given Loader.

func (*LegacyBuilder) Build

Build creates the legacy toolhive Registry structure from loaded ServerJSON entries. Entries are processed in sorted order for deterministic output.

func (*LegacyBuilder) ValidateAgainstSchema

func (b *LegacyBuilder) ValidateAgainstSchema() error

ValidateAgainstSchema builds the legacy registry and validates it without writing.

func (*LegacyBuilder) WriteJSON

func (b *LegacyBuilder) WriteJSON(path string) error

WriteJSON builds the legacy registry, validates it, and writes JSON to the given path.

type Loader

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

Loader walks a servers directory and loads server.json files into memory.

func NewLoader

func NewLoader(serversPath string) *Loader

NewLoader creates a new Loader that reads from the given servers directory.

func (*Loader) GetEntries

func (l *Loader) GetEntries() map[string]upstream.ServerJSON

GetEntries returns all loaded server.json entries keyed by directory name.

func (*Loader) GetSortedNames

func (l *Loader) GetSortedNames() []string

GetSortedNames returns directory names in sorted order for deterministic output.

func (*Loader) LoadAll

func (l *Loader) LoadAll() error

LoadAll walks top-level subdirectories under serversPath, reads server.json from each, and stores the results keyed by directory name. Hidden directories (starting with ".") are skipped. Returns an error if any server.json contains malformed JSON.

Jump to

Keyboard shortcuts

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