Documentation
¶
Overview ¶
Package workloadcatalog stores compiled custom workloads owned by Stroppy.
Index ¶
- Constants
- Variables
- func BuildRunner(ctx context.Context, compiler *toolchain.Compiler, request *RunnerRequest) error
- func CleanBuildCache(stroppyRoot string) error
- func ModuleConfig(pkg *Package) (requirements map[string]string, replacements moduleReplacements, err error)
- type ActiveRuntime
- type BuildManifest
- type BuildResult
- type Cache
- type Entry
- type ModuleIdentity
- type Package
- type Process
- type RunnerRequest
- type RuntimeProcess
- type Snapshot
- type SnapshotFile
- type SnapshotModule
- type Store
- func (store *Store) ActiveRuntime() (ActiveRuntime, error)
- func (store *Store) BuildSnapshot(ctx context.Context, compiler *toolchain.Compiler, source string, ...) (BuildResult, Snapshot, error)
- func (store *Store) CreateSnapshot(ctx context.Context, compiler *toolchain.Compiler, pkg *Package, offline bool) (Snapshot, Package, error)
- func (store *Store) Get(name string) (Entry, error)
- func (store *Store) List() ([]Entry, error)
- func (store *Store) Package(digest string) (Package, error)
- func (store *Store) Packages() ([]Package, error)
- func (store *Store) Publish(entry *Entry, sourceArtifact string, replace bool) (publishedEntry Entry, returnErr error)
- func (store *Store) RebuildRuntime(ctx context.Context, compiler *toolchain.Compiler, diagnostics io.Writer, ...) (ActiveRuntime, bool, error)
- func (store *Store) Remove(name string) (returnErr error)
- func (store *Store) RemoveRuntime() error
- func (store *Store) Restore(entry *Entry) (returnErr error)
- func (store *Store) Root() string
- func (store *Store) Run(ctx context.Context, name string, args []string, process *Process) error
- func (store *Store) RunRuntime(ctx context.Context, stroppyVersion string, args []string, ...) error
- func (store *Store) RuntimeStatus(stroppyVersion string) (ActiveRuntime, bool, error)
- func (store *Store) StroppyRoot() string
- type WorkloadProbe
Constants ¶
const ( BuildSchemaVersion = 1 SnapshotSchemaVersion = 1 )
const (
SchemaVersion = 2
)
Variables ¶
var ( ErrSourceProject = errors.New("workload source must be a Go project directory") )
var ( ErrNotFound = errors.New("workload catalog entry not found") ErrAlreadyExists = errors.New("workload catalog entry already exists") ErrInvalidEntry = errors.New("invalid workload catalog entry") )
var ( ErrMainPackage = errors.New("workload package must be importable, not package main") ErrMissingModulePath = errors.New("workload package has no module path") )
var ( ErrBuildNotFound = errors.New("build cache entry not found") ErrBuildAmbiguous = errors.New("build digest prefix is ambiguous") )
var ( ErrRuntimeNotFound = errors.New("local Stroppy runtime not found") ErrRuntimeStale = errors.New("local Stroppy runtime is stale; run 'stroppy build --refresh'") )
var ErrProbeContract = errors.New("workload probe contract failed")
var (
ErrReplaceConflict = errors.New("conflicting local module replacements")
)
Functions ¶
func BuildRunner ¶
BuildRunner links selected workload packages into one Stroppy executable.
func CleanBuildCache ¶
CleanBuildCache removes reusable content-addressed artifacts.
Types ¶
type ActiveRuntime ¶
type ActiveRuntime struct {
Schema int `json:"schema"`
BuildDigest string `json:"build_digest"`
StroppyVersion string `json:"stroppy_version"`
StroppySource string `json:"stroppy_source,omitempty"`
StroppyModuleVersion string `json:"stroppy_module_version,omitempty"`
CatalogDigest string `json:"catalog_digest"`
ArtifactPath string `json:"artifact_path"`
BuiltAt time.Time `json:"built_at"`
}
ActiveRuntime identifies one published local Stroppy executable.
func (*ActiveRuntime) SDKModuleVersion ¶
func (runtime *ActiveRuntime) SDKModuleVersion() string
SDKModuleVersion is the SDK module version this executable embeds: the merged requirement the generated go.mod carries, not the version the caller asked for.
type BuildManifest ¶
type BuildManifest struct {
Schema int `json:"schema"`
Digest string `json:"digest"`
CreatedAt time.Time `json:"created_at"`
ArtifactSHA256 string `json:"artifact_sha256"`
StroppyVersion string `json:"stroppy_version"`
StroppySource string `json:"stroppy_source,omitempty"`
StroppyModuleVersion string `json:"stroppy_module_version,omitempty"`
GoVersion string `json:"go_version"`
TargetOS string `json:"target_os"`
TargetArch string `json:"target_arch"`
TargetSettings map[string]string `json:"target_settings,omitempty"`
GOFLAGSSHA256 string `json:"goflags_sha256"`
IncludeBuiltIns bool `json:"include_built_ins"`
Workloads []string `json:"workloads"`
SnapshotDigests []string `json:"snapshot_digests,omitempty"`
SourceDigests []string `json:"source_digests,omitempty"`
Modules []ModuleIdentity `json:"modules"`
RunnerSHA256 string `json:"runner_sha256"`
DriverBundle string `json:"driver_bundle"`
}
BuildManifest records non-secret inputs and output integrity for one cached executable.
func BuildCached ¶
func BuildCached( ctx context.Context, compiler *toolchain.Compiler, request *RunnerRequest, ) (BuildManifest, bool, error)
BuildCached builds or reuses one runner and materializes it atomically at request.Output.
func InspectBuild ¶
func InspectBuild(stroppyRoot, prefix string) (BuildManifest, error)
InspectBuild resolves one build manifest in Stroppy's cache.
func (*BuildManifest) SDKModuleVersion ¶
func (manifest *BuildManifest) SDKModuleVersion() string
SDKModuleVersion is the SDK module version this artifact embeds: the merged requirement, not the version the caller requested.
type BuildResult ¶
type BuildResult struct {
Name string
Source string
Artifact string
Package Package
// contains filtered or unexported fields
}
BuildResult is one compiled and probed standalone workload.
func Build ¶
func Build( ctx context.Context, compiler *toolchain.Compiler, source string, diagnostics io.Writer, offline bool, stroppyRoot string, ) (BuildResult, error)
Build compiles one importable workload package through a generated runner.
func (*BuildResult) Cleanup ¶
func (result *BuildResult) Cleanup()
Cleanup removes temporary build output.
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache stores completed generated binaries by build identity.
type Entry ¶
type Entry struct {
Schema int `json:"schema"`
Name string `json:"name"`
Source string `json:"source"`
Package string `json:"package,omitempty"`
ModulePath string `json:"module_path,omitempty"`
ModuleRoot string `json:"module_root,omitempty"`
SnapshotDigest string `json:"snapshot_digest,omitempty"`
BuildDigest string `json:"build_digest,omitempty"`
BuiltAt time.Time `json:"built_at"`
ArtifactPath string `json:"artifact_path,omitempty"`
Status string `json:"status,omitempty"`
}
Entry describes one active custom workload artifact.
type ModuleIdentity ¶
type ModuleIdentity struct {
Path string `json:"path"`
Version string `json:"version,omitempty"`
Sum string `json:"sum,omitempty"`
Replacement string `json:"replacement,omitempty"`
}
ModuleIdentity is one resolved module dependency or replacement.
type Package ¶
type Package struct {
ImportPath string
Directory string
ModulePath string
ModuleRoot string
SnapshotDigest string
}
Package describes one importable workload package and its module.
type RunnerRequest ¶
type RunnerRequest struct {
Packages []Package
IncludeBuiltIns bool
Output string
TargetOS string
TargetArch string
Offline bool
Diagnostics io.Writer
StroppyRoot string
CacheRoot string
BuildVersion string
BuildDigest string
}
RunnerRequest describes one generated Stroppy executable.
type RuntimeProcess ¶
type RuntimeProcess struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
Env []string
Dir string
}
RuntimeProcess describes direct argument and stream forwarding to local Stroppy.
type Snapshot ¶
type Snapshot struct {
Schema int `json:"schema"`
Digest string `json:"digest"`
ImportPath string `json:"import_path"`
ModulePath string `json:"module_path"`
PackageDirectory string `json:"package_directory"`
Modules []SnapshotModule `json:"modules"`
}
Snapshot describes immutable workload compiler inputs owned by Stroppy.
type SnapshotFile ¶
SnapshotFile identifies one immutable compiler input.
type SnapshotModule ¶
type SnapshotModule struct {
Path string `json:"path"`
Directory string `json:"directory"`
Files []SnapshotFile `json:"files"`
}
SnapshotModule describes one local module copied into a snapshot.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store owns one local custom-workload catalog.
func (*Store) ActiveRuntime ¶
func (store *Store) ActiveRuntime() (ActiveRuntime, error)
ActiveRuntime returns published local runtime state.
func (*Store) BuildSnapshot ¶
func (store *Store) BuildSnapshot( ctx context.Context, compiler *toolchain.Compiler, source string, diagnostics io.Writer, offline bool, stroppyRoot string, ) (BuildResult, Snapshot, error)
BuildSnapshot stores compiler inputs and probes one package from its owned snapshot.
func (*Store) CreateSnapshot ¶
func (store *Store) CreateSnapshot( ctx context.Context, compiler *toolchain.Compiler, pkg *Package, offline bool, ) (Snapshot, Package, error)
CreateSnapshot copies exact local compiler inputs into Stroppy-owned storage.
func (*Store) Publish ¶
func (store *Store) Publish(entry *Entry, sourceArtifact string, replace bool) (publishedEntry Entry, returnErr error)
Publish atomically activates artifact or source snapshot for entry.Name.
func (*Store) RebuildRuntime ¶
func (store *Store) RebuildRuntime( ctx context.Context, compiler *toolchain.Compiler, diagnostics io.Writer, offline bool, stroppyRoot, buildVersion string, ) (ActiveRuntime, bool, error)
RebuildRuntime builds and atomically activates Stroppy with every catalog workload.
func (*Store) RemoveRuntime ¶
RemoveRuntime removes active augmented runtime but preserves snapshots and build cache.
func (*Store) Restore ¶
Restore atomically restores a previously read catalog manifest without copying artifacts.
func (*Store) RunRuntime ¶
func (store *Store) RunRuntime( ctx context.Context, stroppyVersion string, args []string, process *RuntimeProcess, ) error
RunRuntime starts current local Stroppy with direct argument and stream forwarding.
func (*Store) RuntimeStatus ¶
func (store *Store) RuntimeStatus(stroppyVersion string) (ActiveRuntime, bool, error)
RuntimeStatus reports active state and whether catalog or Stroppy changed.
func (*Store) StroppyRoot ¶
StroppyRoot returns ~/.stroppy for toolchains, caches, and generated builds.
type WorkloadProbe ¶
type WorkloadProbe struct {
Name string `json:"name"`
}
WorkloadProbe is minimal machine-readable identity from a standalone workload.