spec

package
v0.2.20 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RolePrimary         basespec.AttachmentRole = "primary"
	RoleLibrary         basespec.AttachmentRole = "library"
	RoleAttachedPackage basespec.AttachmentRole = "attached-package"
	RoleOverlay         basespec.AttachmentRole = "overlay"
)
View Source
const (
	DiagnosticCodeArtifactInvalid           = "workspace.artifact.invalid"
	DiagnosticCodeContextInvalidContent     = "workspace.context.invalid-content"
	DiagnosticCodeContextInvalidUTF8        = "workspace.context.invalid-utf8"
	DiagnosticCodeArtifactSchemaUnsupported = "workspace.artifact.schema-unsupported"
	DiagnosticCodeArtifactKindMismatch      = "workspace.artifact.kind-mismatch"
	DiagnosticCodeProjectionInvalid         = "workspace.projection.invalid"
	DiagnosticCodeArtifactUnavailable       = "workspace.artifact.unavailable"
	DiagnosticCodeArtifactUnresolved        = "workspace.artifact.unresolved"
	DiagnosticCodeRuntimeDenied             = "workspace.runtime.denied"
	DiagnosticCodeRuntimeUnavailable        = "workspace.runtime.unavailable"
	DiagnosticCodeCatalogStale              = "workspace.catalog.stale"
	DiagnosticCodeCatalogDecoderStale       = "workspace.catalog.decoder-stale"
	DiagnosticCodeCatalogPlanStale          = "workspace.catalog.plan-stale"
)

Variables

View Source
var (
	ErrInvalidWorkspace           = errors.New("workspace: invalid")
	ErrNotWorkspace               = errors.New("workspace: collection is not a Workspace")
	ErrPrimarySourceImmutable     = errors.New("workspace: primary source is immutable")
	ErrReferenceUnresolved        = errors.New("workspace: reference unresolved")
	ErrWorkspaceDefinitionInvalid = errors.New("workspace: descriptor invalid")
)

Functions

func ValidateDiscoveryPreferences

func ValidateDiscoveryPreferences(
	value DiscoveryPreferences,
) error

Types

type ArtifactData

type ArtifactData struct {
	RuntimeDisabled bool `json:"runtimeDisabled,omitempty"`
}

type ArtifactSupport

type ArtifactSupport struct {
	Kind      basespec.ArtifactKind
	SchemaID  basespec.SchemaID
	DecoderID basespec.DecoderID
	Validator DefinitionValidator
}

func (ArtifactSupport) Validate

func (s ArtifactSupport) Validate() error

type AttachRequest

type AttachRequest struct {
	Workspace                  WorkspaceRef            `json:"workspace"`
	ExpectedCollectionRevision uint64                  `json:"expectedCollectionRevision"`
	SourceID                   basespec.SourceID       `json:"sourceID"`
	Role                       basespec.AttachmentRole `json:"role"`
	Enabled                    bool                    `json:"enabled"`
	Data                       AttachmentData          `json:"data"`
}

type AttachmentData

type AttachmentData struct {
	Recursive     *bool `json:"recursive,omitempty"`
	Authoritative *bool `json:"authoritative,omitempty"`
}

type CatalogView

type CatalogView struct {
	Workspace            Workspace                `json:"-"`
	Catalog              catalog.Snapshot         `json:"-"`
	Resources            []Resource               `json:"-"`
	Unrecorded           []catalog.Occurrence     `json:"-"`
	UnresolvedArtifacts  []artifact.Artifact      `json:"-"`
	Groups               []ResourceGroup          `json:"-"`
	CatalogCurrent       bool                     `json:"-"`
	FreshnessDiagnostics []providerapi.Diagnostic `json:"-"`
}

type CollectionData

type CollectionData struct {
	Discovery DiscoveryPreferences `json:"discovery"`
}

CollectionData contains persisted Workspace preferences only. Workspace mode and primary Source are derived from current collection attachments. Provider behavior revision is Artifact Store capability input and is intentionally not persisted in Collection local data.

type DefinitionValidator

type DefinitionValidator func(providerapi.Definition) error

type DirectoryRoot

type DirectoryRoot = providerapi.DirectoryRoot

DirectoryRoot is the generic source-discovery scope type.

type DiscoveryPreferences

type DiscoveryPreferences struct {
	AdditionalLocators []basespec.Locator `json:"additionalLocators,omitempty"`
	AdditionalRoots    []DiscoveryRoot    `json:"additionalRoots,omitempty"`
	IncludeReadme      bool               `json:"includeReadme,omitempty"`
}

type DiscoveryProfile

type DiscoveryProfile struct {
	ExplicitLocators []basespec.Locator
	ReadmeLocator    basespec.Locator
	DirectoryRoots   []DirectoryRoot
}

DiscoveryProfile defines discovery rules for one attachment class.

Artifact adapters contribute their own conventions through this type.

type DiscoveryProfiles

type DiscoveryProfiles struct {
	Primary  DiscoveryProfile
	Attached DiscoveryProfile
}

type DiscoveryRoot

type DiscoveryRoot = providerapi.DirectoryRoot

DiscoveryRoot is retained as the Workspace preference name.

type EmptyWorkspaceRequest

type EmptyWorkspaceRequest struct {
	CollectionID basespec.CollectionID `json:"collectionID"`
	RootID       basespec.RootID       `json:"rootID"`
	DisplayName  string                `json:"displayName"`
	Description  string                `json:"description,omitempty"`
	Discovery    DiscoveryPreferences  `json:"discovery"`
}

type FilesystemWorkspaceRequest

type FilesystemWorkspaceRequest struct {
	CollectionID    basespec.CollectionID `json:"collectionID"`
	RootID          basespec.RootID       `json:"rootID"`
	DisplayName     string                `json:"displayName"`
	Description     string                `json:"description,omitempty"`
	PrimarySourceID basespec.SourceID     `json:"primarySourceID"`
	Discovery       DiscoveryPreferences  `json:"discovery"`
}

type LoadPlan

type LoadPlan struct {
	Workspace       WorkspaceRef             `json:"-"`
	CatalogRevision uint64                   `json:"-"`
	Items           []LoadPlanItem           `json:"-"`
	Diagnostics     []providerapi.Diagnostic `json:"-"`
}

type LoadPlanItem

type LoadPlanItem struct {
	Artifact                   artifact.Artifact      `json:"-"`
	Definition                 providerapi.Definition `json:"-"`
	Source                     source.Summary         `json:"-"`
	CatalogCurrent             bool                   `json:"-"`
	OccurrenceDefinitionDigest cryptoutil.Digest      `json:"-"`
	SourceContentDigest        cryptoutil.Digest      `json:"-"`
	SourceGeneration           string                 `json:"-"`
}

LoadPlanItem contains privileged materialized source state. It must be projected into an explicit adapter response before crossing an API boundary.

type Mode

type Mode string
const (
	ModeEmpty      Mode = "empty"
	ModeFilesystem Mode = "filesystem"
)

type Resource

type Resource struct {
	Artifact        artifact.Artifact        `json:"-"`
	Definition      providerapi.Definition   `json:"-"`
	Occurrence      *catalog.Occurrence      `json:"-"`
	Source          source.Summary           `json:"-"`
	CatalogCurrent  bool                     `json:"-"`
	ProjectionValid bool                     `json:"-"`
	Diagnostics     []providerapi.Diagnostic `json:"-"`
}

type ResourceGroup

type ResourceGroup struct {
	Kind       basespec.ArtifactKind `json:"-"`
	Resources  []Resource            `json:"-"`
	Unrecorded []catalog.Occurrence  `json:"-"`
}

type SetPrimaryRequest

type SetPrimaryRequest struct {
	Workspace                  WorkspaceRef
	ExpectedCollectionRevision uint64
	PreviousSourceID           basespec.SourceID
	PreviousAttachmentRevision uint64
	SourceID                   basespec.SourceID
	Clear                      bool
}

type UpdateAttachmentRequest

type UpdateAttachmentRequest struct {
	Workspace                  WorkspaceRef
	SourceID                   basespec.SourceID
	ExpectedCollectionRevision uint64
	ExpectedAttachmentRevision uint64
	Role                       basespec.AttachmentRole
	Enabled                    bool
	Data                       AttachmentData
}

type UpdateRequest

type UpdateRequest struct {
	Workspace        WorkspaceRef         `json:"workspace"`
	ExpectedRevision uint64               `json:"expectedRevision"`
	DisplayName      string               `json:"displayName"`
	Description      string               `json:"description,omitempty"`
	Enabled          bool                 `json:"enabled"`
	Discovery        DiscoveryPreferences `json:"discovery"`
}

type Workspace

type Workspace struct {
	Collection      collection.Collection   `json:"-"`
	Data            CollectionData          `json:"-"`
	Mode            Mode                    `json:"-"`
	PrimarySourceID basespec.SourceID       `json:"-"`
	Attachments     []collection.Attachment `json:"-"`
	Sources         []source.Summary        `json:"-"`
}

Workspace is an internal privileged aggregate. API packages project it into explicit view models and must not serialize collection local data, attachment local data, or Source configuration.

type WorkspaceRef

type WorkspaceRef = collection.CollectionRef

Jump to

Keyboard shortcuts

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