repointerface

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const FILETYPE_COMPRESS string = "application/gzip"
View Source
const FILETYPE_RAW string = "application/octet-stream"
View Source
const REPO_APT = "Apt"
View Source
const REPO_CLOSURE = "Closure"
View Source
const REPO_DOCKERHUB = "DockerHub"
View Source
const REPO_HUGGINGFACE = "HuggingFace"
View Source
const REPO_K8S = "k8s"
View Source
const REPO_PREFAB = "Prefab"
View Source
const REPO_PYPI = "PyPI"

Variables

View Source
var AnyConstraint = Constraint{
	Ranges: []VersionRange{{
		LowerBound:     nil,
		UpperBound:     nil,
		LowerInclusive: false,
		UpperInclusive: false,
	}},
	Raw: "any",
}

Functions

This section is empty.

Types

type Constraint added in v0.2.2

type Constraint struct {
	RepoType string
	Ranges   []VersionRange
	Raw      string
}

func NewConstraintFromVersionSubset added in v0.2.2

func NewConstraintFromVersionSubset(versions []Version, allVersions []Version) (c Constraint)

NewConstraintFromVersionSubset returns a minimal constraint that matches exactly the given versions out of the given set of all versions. Both slices must be sorted in ascending order

func SingleVersionConstraint added in v0.2.2

func SingleVersionConstraint(v Version) (c Constraint)

func (*Constraint) AddRange added in v0.2.2

func (c *Constraint) AddRange(lowerBound Version, upperBound Version, lowerInclusive bool, upperInclusive bool)

func (Constraint) Contains added in v0.2.2

func (c Constraint) Contains(other Version) bool

func (Constraint) Difference added in v0.2.2

func (c Constraint) Difference(other Constraint) Constraint

func (Constraint) Encode added in v0.2.2

func (c Constraint) Encode() (string, error)

func (Constraint) Equal added in v0.2.2

func (c Constraint) Equal(other Constraint) bool

func (Constraint) FilterAndSort added in v0.2.2

func (c Constraint) FilterAndSort(versions []Version) []Version

func (Constraint) Intersect added in v0.2.2

func (c Constraint) Intersect(other Constraint) Constraint

func (Constraint) Inverse added in v0.2.2

func (c Constraint) Inverse() Constraint

func (Constraint) IsAny added in v0.2.2

func (c Constraint) IsAny() bool

func (Constraint) IsEmpty added in v0.2.2

func (c Constraint) IsEmpty() bool

func (Constraint) String added in v0.2.2

func (c Constraint) String() string

func (Constraint) Union added in v0.2.2

func (c Constraint) Union(other Constraint) Constraint

type ConstraintString added in v0.2.2

type ConstraintString struct {
	RepoType string               `json:"repo_type"`
	Ranges   []VersionRangeString `json:"ranges"`
	Raw      string               `json:"raw"`
}

type EnvSpec added in v0.2.2

type EnvSpec interface {
	Encode() string
}

type Repo

type Repo interface {
	// init repository parameters by deployment context
	Init(context *dcontext.DeployContext) (err error)
	// generate a Environemnt SpecSheet by repository parametes and the given name & specifier
	// Should Init() the Repo before calling this function
	GetEnvSpec() EnvSpec

	// Finding 0 version is not an error, should return []Version{} and nil
	// This function MUST NOT rely on deployment context
	GetVersions(name string) (versions []Version, err error)
	SelectVersion(versions []Version) (selected Version, err error)

	// Finding 0 environment is not an error, should return []string{} and nil
	// This function MUST NOT rely on deployment context
	GetEnvs(name string, version Version) (envs []string, err error)
	SelectEnv(envs []string, envSpec EnvSpec) (selected string, err error)
	FilterEnv(envs []string) (selected []string)

	// fabricate a prefab according to a SpecSheet, then save the prefab and blueprint to dstDir
	// and return the path to prefab and blueprint
	// This function MUST NOT rely on deployment context
	Fabricate(name string, version Version, envs []string, dstDir string) (prefabPaths []string, blueprintPaths []string, fileType string, err error)
}

type SpecSheet

type SpecSheet struct {
	Type      string
	Name      string
	Version   Version
	Env       string
	Specifier Constraint
	EnvSpec   EnvSpec
}

func (SpecSheet) Encode added in v0.2.2

func (specSheet SpecSheet) Encode() (encoded []byte, err error)

type SpecSheetString added in v0.2.2

type SpecSheetString struct {
	Type      string
	Name      string
	Version   string
	Env       string
	Specifier string
	EnvSpec   string
}

func (*SpecSheetString) Decode added in v0.2.2

func (s *SpecSheetString) Decode(raw []byte) error

func (*SpecSheetString) Encode added in v0.2.2

func (s *SpecSheetString) Encode() []byte

type Version added in v0.2.2

type Version interface {
	Compare(Version) int
	String() string
}

type VersionRange added in v0.2.2

type VersionRange struct {
	LowerBound     Version
	UpperBound     Version
	LowerInclusive bool
	UpperInclusive bool
}

VersionRange represents a continuous range of versions

type VersionRangeString added in v0.2.2

type VersionRangeString struct {
	LowerBound     string `json:"lower_bound"`
	UpperBound     string `json:"upper_bound"`
	LowerInclusive bool   `json:"lower_inclusive"`
	UpperInclusive bool   `json:"upper_inclusive"`
}

Jump to

Keyboard shortcuts

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