repointerface

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const REPO_APT = "Apt"
View Source
const REPO_DOCKERHUB = "DockerHub"
View Source
const REPO_PREFABHUB = "PrefabHub"
View Source
const REPO_PYPI = "PyPI"

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo interface {
	// create work directory and temp directory under workDir and tmpDir
	New(workDir string, tmpDir string) (err error)

	// init repository parameters by deployment context
	Init(context *dcontext.DeployContext) (err error)

	// generate a SpecSheet by repository parametes and the given name & specifier
	// Should Init() the Repo before calling this function
	GenerateSpecSheet(name string, specifier string) (specSheet SpecSheet, err error)

	// request repository to pull all the posible versions for a spec
	// Warning! Finding 0 version is not an error, should return []string{} and nil
	// This function MUST NOT rely on deployment context
	// Any New() Repo MUST be able to GetVersions based on the information ONLY in specSheet
	GetVersions(specSheet SpecSheet) (versions []string, err error)

	// request repository to pull all the posible environmets for a spec
	// SepcSheet.version must not be empty when calling this function
	// Warning! Finding 0 environment is not an error, should return []string{} and nil
	// This function MUST NOT rely on deployment context
	// Any New() Repo MUST be able to GetEnvs based on the information ONLY in specSheet
	GetEnvs(specSheet SpecSheet) (envs []string, err error)

	// fabricate a prefab according to a SpecSheet
	// Call prefab.Pack after unpacking the data pulled from the repository
	// and return the path to prefab and blueprint
	// This function MUST NOT rely on deployment context
	// Any New() Repo MUST be able to GetEnvs based on the information ONLY in specSheet
	Fabricate(specSheet SpecSheet) (prefabPath string, blueprintPath string, err error)

	// If one of the [#existVersions] satisfies the [#item.Specifier], return
	// otherwise, fabricate all possible environments for one or more versions of [#item.Name] package
	FabricateDepend(item *prefab.Prefab, existVersions []string) (prefabPaths []string, blueprintPaths []string, err error)
}

Init() and GenerateSpecSheet() are executed by developers and executors GetVersions(), GetEnvs() and Fabricate are exectued by PrefabService and advanced Prefab developers

type SpecSheet

type SpecSheet interface {
	Type() string // type of SpecSheet, e.g. DockerHub
	Name() string
	Version() string
	Environment() string
	VersionSpecifier() string

	// 1. set [environmet] to ""
	// 2. select one version and fill it into [version]
	// Warning! no matched version is not an error, should leave [version] empty and return nil
	SelectVersion(versions []string) (err error)
	// select one environment and fill it into [environmet]
	// Warning! no matched environment is not an error, should leave [environment] empty and return nil
	SelectEnv(envs []string) (err error)
}

MUST have a SpecType field

Jump to

Keyboard shortcuts

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