Help us shape the future of Go! Take the 2026 Go Developer Survey

contract

package
v0.4.22 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const RuntimeProviderContractVersion = "baseharbor.runtime/v1"

Variables

This section is empty.

Functions

func RequireCapabilities

func RequireCapabilities(provider Provider, required ...RuntimeCapability) error

Types

type ImageIdentity

type ImageIdentity struct {
	Reference string
	ImageID   string
	Digest    string
}

type InternalWorkloadProvider added in v0.4.19

InternalWorkloadProvider is BaseHarbor Core's in-process semantic runtime lifecycle seam. It is deliberately smaller than the existing local Docker/Podman project/file/container mechanics and MUST NOT be treated as the public external Runtime Provider protocol.

External providers use the versioned language-neutral baseharbor.runtime.provider/v1 protocol and adapt into equivalent semantics.

type LogCollectionMode

type LogCollectionMode string
const (
	LogCollectionSyslog   LogCollectionMode = "syslog"
	LogCollectionJournald LogCollectionMode = "journald"
)

type LogSourceAdapter

type LogSourceAdapter interface {
	LogCollectionMode() LogCollectionMode
	VerifyProjectServiceLogCollection(context.Context, string, string, string) error
}

type ProjectResource

type ProjectResource struct {
	Kind string
	Name string
}

type Provider

type Provider interface {
	Kind() ProviderKind
	Descriptor() ProviderDescriptor
	Capabilities() ProviderCapabilities
}

type ProviderCapabilities

type ProviderCapabilities struct {
	WorkloadLifecycle bool
	ServiceExec       bool
	PublishedPorts    bool
	ResourceOwnership bool
}

func (ProviderCapabilities) Supports

func (c ProviderCapabilities) Supports(capability RuntimeCapability) bool

type ProviderDescriptor

type ProviderDescriptor struct {
	Kind            ProviderKind
	ContractVersion string
	ProviderVersion string
	Standards       []string
	WorkloadSources []string
	Realization     string
	Capabilities    ProviderCapabilities
	Availability    availability.Support
}

type ProviderFactory

type ProviderFactory func(context.Context) (Provider, error)

type ProviderKind

type ProviderKind string
const (
	ProviderDocker     ProviderKind = "docker"
	ProviderPodman     ProviderKind = "podman"
	ProviderKubernetes ProviderKind = "kubernetes"
	ProviderOpenShift  ProviderKind = "openshift"
)

func ParseProviderKind

func ParseProviderKind(value string) (ProviderKind, error)

type ProviderRegistration

type ProviderRegistration struct {
	Descriptor ProviderDescriptor
	Factory    ProviderFactory
}

type ProviderRegistry

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

func NewProviderRegistry

func NewProviderRegistry(registrations ...ProviderRegistration) (*ProviderRegistry, error)

func (*ProviderRegistry) Descriptor

func (r *ProviderRegistry) Descriptor(kind ProviderKind) (ProviderDescriptor, error)

func (*ProviderRegistry) Register

func (r *ProviderRegistry) Register(registration ProviderRegistration) error

func (*ProviderRegistry) Resolve

func (r *ProviderRegistry) Resolve(ctx context.Context, kind ProviderKind) (Provider, error)

func (*ProviderRegistry) ResolveRuntimeProvider

func (r *ProviderRegistry) ResolveRuntimeProvider(ctx context.Context, kind ProviderKind) (RuntimeProvider, error)

type PublishedPort

type PublishedPort struct {
	URL           string
	TargetPort    int
	PublishedPort int
	Protocol      string
}

type RuntimeCapability

type RuntimeCapability string
const (
	CapabilityWorkloadLifecycle RuntimeCapability = "workload-lifecycle"
	CapabilityServiceExec       RuntimeCapability = "service-exec"
	CapabilityPublishedPorts    RuntimeCapability = "published-ports"
	CapabilityResourceOwnership RuntimeCapability = "resource-ownership"
)

type RuntimeContainer

type RuntimeContainer struct {
	ID       string
	Name     string
	Project  string
	Service  string
	Running  bool
	State    string
	Health   string
	ExitCode int
	Error    string
}

type RuntimeProvider

type RuntimeProvider interface {
	Provider
	LogSourceAdapter

	PreferredLocalHTTPSPort() int

	Up(context.Context, string, string) error
	Down(context.Context, string, string) error
	Status(context.Context, string, string) (string, error)
	Config(context.Context, string, string) error
	UpProject(context.Context, string, string, string) error
	UpProjectProgress(context.Context, string, string, string, func(string)) error
	DownProject(context.Context, string, string, string) error
	StopProject(context.Context, string, string, string) error
	DownProjectRemoveOrphans(context.Context, string, string, string) error
	DestroyProject(context.Context, string, string, string) error
	DestroyProjectRemoveOrphans(context.Context, string, string, string) error
	StatusProject(context.Context, string, string, string) (string, error)
	LogsProject(context.Context, string, string, string, ...string) (string, error)
	DiagnosticsProject(context.Context, string, string, string) string
	ConfigProject(context.Context, string, string, string) error
	ExecProject(context.Context, string, string, string, string, ...string) (string, error)
	ExecProjectInput(context.Context, string, string, string, []byte, string, ...string) (string, error)
	ConfigProjectFiles(context.Context, string, string, ...string) error
	ConfigProjectFilesEnv(context.Context, string, string, map[string]string, ...string) error
	ConfigJSONProjectFilesEnv(context.Context, string, string, map[string]string, ...string) (string, error)
	UpProjectFiles(context.Context, string, string, ...string) error
	UpProjectFilesSelected(context.Context, string, string, map[string]string, []string, ...string) error
	BuildProjectFilesSelectedProgress(context.Context, string, string, map[string]string, []string, func(string), ...string) error
	UpProjectFilesSelectedForceRecreateNoBuild(context.Context, string, string, map[string]string, []string, ...string) error
	UpProjectFilesSelectedNoBuildProgress(context.Context, string, string, map[string]string, []string, func(string), ...string) error
	UpProjectFilesSelectedProgress(context.Context, string, string, map[string]string, []string, func(string), ...string) error
	DownProjectFiles(context.Context, string, string, ...string) error
	DownProjectFilesEnv(context.Context, string, string, map[string]string, ...string) error
	StopProjectFilesSelected(context.Context, string, string, map[string]string, []string, ...string) error
	StatusProjectFiles(context.Context, string, string, ...string) (string, error)
	ExecProjectFiles(context.Context, string, string, string, []string, ...string) (string, error)
	ExecProjectFilesInput(context.Context, string, string, string, []string, []byte, ...string) (string, error)
	ServicesProjectFiles(context.Context, string, string, ...string) ([]string, error)
	ServicesProjectFilesEnv(context.Context, string, string, map[string]string, ...string) ([]string, error)
	RunningServicesProjectFiles(context.Context, string, string, ...string) ([]string, error)
	RunningServicesProjectFilesEnv(context.Context, string, string, map[string]string, ...string) ([]string, error)
	ServiceStatesProjectFilesEnv(context.Context, string, string, map[string]string, ...string) ([]ServiceState, error)
	RunProjectFilesEnv(context.Context, string, string, map[string]string, io.Reader, io.Writer, io.Writer, []string, ...string) error
	PullImage(context.Context, string) error
	ContainerHealthStatus(context.Context, string) (string, error)
	ContainerNetworks(context.Context, string) ([]string, error)
	NetworkProjectOwner(context.Context, string) (string, error)
	ContainerExposedTCPPorts(context.Context, string) ([]int, error)
	EnsureManagedNetwork(context.Context, string) error
	ConnectManagedNetwork(context.Context, string, string, string) error
	DisconnectManagedNetwork(context.Context, string, string) error
	RemoveManagedNetwork(context.Context, string) error
	ProjectServiceLogDriver(context.Context, string, string) (string, error)
	RunningServicesProject(context.Context, string, string, string) ([]string, error)
	InspectProjectResource(context.Context, string, ProjectResource) (bool, error)
	InspectProjectResources(context.Context, string, []ProjectResource) ([]ProjectResource, error)
	DestroyOwnedProjectResources(context.Context, string, []ProjectResource) error
	ListOwnedProjectResources(context.Context, string) ([]ProjectResource, error)
	StopOwnedProjectContainers(context.Context, string) error
	ListRuntimeContainers(context.Context) ([]RuntimeContainer, error)
	ProjectServiceImageIdentity(context.Context, string, string) (ImageIdentity, error)
	ContainerLogConfigProjectService(context.Context, string, string) (string, string, error)
	ExportOwnedVolume(context.Context, string, string) ([]byte, error)
	EnsureOwnedVolume(context.Context, string, string) error
	RestoreOwnedVolume(context.Context, string, string, []byte) error
}

type ServiceState

type ServiceState struct {
	Service    string
	State      string
	Health     string
	ExitCode   int
	Error      string
	Publishers []PublishedPort
}

func (ServiceState) Ready

func (s ServiceState) Ready() bool

func (ServiceState) TerminalFailure added in v0.4.18

func (s ServiceState) TerminalFailure() bool

Jump to

Keyboard shortcuts

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