directory

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package directory is the in-memory index the marketplace virtual workspace answers from: Providers mirrored from the catalog tier, published APIExports mirrored from every producer workspace. It is read-heavy, written only by the mirroring controllers, and guarded by one mutex — the catalog is small and a browse must never block a sync.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Directory

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

Directory is safe for concurrent use.

func New

func New() *Directory

New returns an empty directory.

func (*Directory) Catalog

func (d *Directory) Catalog() []Entry

Catalog lists every offering whose workspace a Producer record names, sorted by name for stable output. An offering published from a workspace no record names is invisible — publishing into the void is not publishing, and it is also the case an unregistered workspace would use to put itself on the catalog by annotating its own export.

func (*Directory) Counts

func (d *Directory) Counts() (producers, offerings int)

Counts reports how many objects the directory holds, for debugging.

func (*Directory) ForgetCluster

func (d *Directory) ForgetCluster(cluster string)

ForgetCluster drops everything mirrored from one logical cluster — a workspace that unbound its export leaves nothing behind.

func (*Directory) Lookup

func (d *Directory) Lookup(name string) (Entry, bool)

Lookup returns one catalog entry by its listing name.

func (*Directory) Ready

func (d *Directory) Ready() bool

func (*Directory) RemoveInstructions

func (d *Directory) RemoveInstructions(key Key)

func (*Directory) RemoveOffering

func (d *Directory) RemoveOffering(key Key)

func (*Directory) RemoveProducer

func (d *Directory) RemoveProducer(key Key)

func (*Directory) RemoveSchema

func (d *Directory) RemoveSchema(key Key)

func (*Directory) SetReady

func (d *Directory) SetReady()

SetReady marks the initial sync complete; Ready reports it.

func (*Directory) UpsertInstructions

func (d *Directory) UpsertInstructions(key Key, sections map[string]string)

UpsertInstructions records the content of one instructions ConfigMap. Which offerings use it is decided at read time by name, so the two mirrors never have to know about each other.

func (*Directory) UpsertOffering

func (d *Directory) UpsertOffering(key Key, o Offering)

func (*Directory) UpsertProducer

func (d *Directory) UpsertProducer(key Key, p Producer)

func (*Directory) UpsertSchema

func (d *Directory) UpsertSchema(key Key, s Schema)

UpsertSchema records one APIResourceSchema. As with instructions, which offerings use it is decided at read time by name.

type Entry

type Entry struct {
	Producer string
	Offering string
	// WorkspacePath is the canonical path of the producer's workspace —
	// what the APIBinding a consumer authors references as
	// spec.reference.export.path.
	WorkspacePath string
	Detail        Offering
	// Instructions is the referenced ConfigMap's content, or nil if the
	// offering names none or it has not been seen.
	Instructions map[string]string
	// Resources are the offering's resources joined with their schemas;
	// one whose schema has not been seen carries no versions.
	Resources []marketplacev1alpha1.OfferingResource
}

Entry is one catalog listing: a published export joined with the Producer record that owns its workspace.

func (Entry) Name

func (e Entry) Name() string

Name is the entry's stable listing name, "<producer>.<export>".

type Key

type Key struct {
	Cluster string
	Name    string
}

Key identifies a mirrored object by the logical cluster it lives in and its name there.

type Offering

type Offering struct {
	DisplayName  string
	Description  string
	Export       string
	Revision     string
	Claims       []marketplacev1alpha1.OfferingClaim
	Ready        bool
	IdentityHash string
	DocsURL      string
	// InstructionsRef names a ConfigMap in the offering's own cluster; the
	// content is mirrored separately and joined at read time, so an edit
	// to the instructions never has to re-reconcile the export.
	InstructionsRef string
	// Resources are the export's spec.resources. Like instructions, the
	// schemas they name are mirrored separately and joined at read time.
	Resources []ResourceRef
}

Offering is the directory's view of a published APIExport.

There is no Producer field: which producer an offering belongs to is not something the offering records, it is which workspace the export lives in. Catalog resolves it by matching the export's logical cluster against the Producer records, so a producer cannot be misattributed by anything written in the producer's own workspace.

type Producer

type Producer struct {
	DisplayName      string
	Description      string
	WorkspacePath    string
	WorkspaceCluster string
	Ready            bool
}

Producer is the directory's view of a catalog record.

type ResourceRef

type ResourceRef struct {
	Group    string
	Resource string
	Schema   string
}

ResourceRef is one resource an export serves and the APIResourceSchema, in the export's own cluster, that defines it.

type Schema

type Schema struct {
	Kind     string
	Scope    string
	Versions []marketplacev1alpha1.OfferingResourceVersion
}

Schema is the directory's view of an APIResourceSchema: what the catalog shows of it.

Jump to

Keyboard shortcuts

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