go-container/sources/source.go
Snider 8bc93ce610 feat: extract container/, devops/, sources/ from go-devops
Container runtime (LinuxKit, hypervisor, state, templates), dev
environment management (renamed devops → devenv), and image sources
(CDN, GitHub). 254 tests passing. Package devops renamed to devenv
to avoid collision with parent repo name.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-03-09 11:42:51 +00:00

33 lines
958 B
Go

// Package sources provides image download sources for go-container.
package sources
import (
"context"
"forge.lthn.ai/core/go-io"
)
// ImageSource defines the interface for downloading dev images.
type ImageSource interface {
// Name returns the source identifier.
Name() string
// Available checks if this source can be used.
Available() bool
// LatestVersion returns the latest available version.
LatestVersion(ctx context.Context) (string, error)
// Download downloads the image to the destination path.
// Reports progress via the callback if provided.
Download(ctx context.Context, m io.Medium, dest string, progress func(downloaded, total int64)) error
}
// SourceConfig holds configuration for a source.
type SourceConfig struct {
// GitHub configuration
GitHubRepo string
// Registry configuration
RegistryImage string
// CDN configuration
CDNURL string
// Image name (e.g., core-devops-darwin-arm64.qcow2)
ImageName string
}