plans

package
v1.3.1-beta1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 9 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detail

type Detail struct {
	Summary

	// Inputs are the input mountpoints of the plan.
	Inputs []Mountpoint `json:"inputs"`

	// Outputs are the output mountpoints of the plan.
	Outputs []Mountpoint `json:"outputs"`

	// Log is the log point of the plan.
	//
	// If nil, the plan does not record logs.
	Log *LogPoint `json:"log,omitempty"`

	// Active shows Plan's activeness.
	//
	// It is true if the plan is active and new runs can be created.
	Active bool `json:"active"`

	// OnNode is the node affinity/torelance of the plan.
	//
	// If nil, the plan does not have node affinity/torelance.
	OnNode *OnNode `json:"on_node,omitempty"`

	// Resources is the resource limits and requiremnts of the plan.
	Resources Resources `json:"resources,omitempty"`
}

Detail is the format for the response body from Knitfab APIs below:

- GET /api/plans/ (as list)

- POST /api/plans/

- GET /api/plans/{planId}

- PUT /api/plans/{planId}/active

- PUT /api/plans/{planId}/resources

func (Detail) Equal

func (d Detail) Equal(o Detail) bool

type Image

type Image struct {
	Repository string
	Tag        string
}

func (*Image) Equal

func (i *Image) Equal(o *Image) bool

func (Image) MarshalJSON

func (i Image) MarshalJSON() ([]byte, error)

func (Image) MarshalYAML

func (i Image) MarshalYAML() (interface{}, error)

func (*Image) Parse

func (i *Image) Parse(s string) error

parse string as Image Tag, and upgate itself.

this spec is based on docker image tag spec^1.

func (*Image) String

func (i *Image) String() string

func (*Image) UnmarshalJSON

func (i *Image) UnmarshalJSON(b []byte) error

func (*Image) UnmarshalYAML

func (i *Image) UnmarshalYAML(node *yaml.Node) error

type LogPoint

type LogPoint struct {
	Tags []tags.Tag
}

func (LogPoint) Equal

func (lp LogPoint) Equal(o LogPoint) bool

func (LogPoint) String

func (lp LogPoint) String() string

type Mountpoint

type Mountpoint struct {
	Path string     `json:"path"`
	Tags []tags.Tag `json:"tags"`
}

func (Mountpoint) Equal

func (m Mountpoint) Equal(o Mountpoint) bool

type OnNode

type OnNode struct {
	May    []OnSpecLabel `json:"may,omitempty" yaml:"may,omitempty"`
	Prefer []OnSpecLabel `json:"prefer,omitempty" yaml:"prefer,omitempty"`
	Must   []OnSpecLabel `json:"must,omitempty" yaml:"must,omitempty"`
}

func (OnNode) Equal

func (o OnNode) Equal(oo OnNode) bool

type OnSpecLabel

type OnSpecLabel struct {
	Key   string
	Value string
}

func (OnSpecLabel) Equal

func (l OnSpecLabel) Equal(o OnSpecLabel) bool

func (OnSpecLabel) MarshalJSON

func (l OnSpecLabel) MarshalJSON() ([]byte, error)

func (OnSpecLabel) MarshalYAML

func (l OnSpecLabel) MarshalYAML() (interface{}, error)

func (*OnSpecLabel) Parse

func (l *OnSpecLabel) Parse(s string) error

func (OnSpecLabel) String

func (l OnSpecLabel) String() string

func (*OnSpecLabel) UnmarshalJSON

func (l *OnSpecLabel) UnmarshalJSON(value []byte) error

func (*OnSpecLabel) UnmarshalYAML

func (l *OnSpecLabel) UnmarshalYAML(node *yaml.Node) error

type PlanSpec

type PlanSpec struct {
	Image     Image        `json:"image" yaml:"image"`
	Inputs    []Mountpoint `json:"inputs" yaml:"inputs"`
	Outputs   []Mountpoint `json:"outputs" yaml:"outputs"`
	Log       *LogPoint    `json:"log,omitempty" yaml:"log,omitempty"`
	OnNode    *OnNode      `json:"on_node,omitempty" yaml:"on_node,omitempty"`
	Resources Resources    `json:"resources,omitempty" yaml:"resources,omitempty"`
	Active    *bool        `json:"active" yaml:"active,omitempty"`
}

PlanSpec is the format for request body to Knitfab APIs below:

- POST /api/plans/

func (PlanSpec) Equal

func (ps PlanSpec) Equal(o PlanSpec) bool

type ResourceLimitChange

type ResourceLimitChange struct {

	// Resource to be set.
	Set Resources `json:"set,omitempty" yaml:"set,omitempty"`

	// Resource types to be unset.
	//
	// If same type Set and Unset, Unset is affected.
	Unset []string `json:"unset,omitempty" yaml:"unset,omitempty"`
}

ResourceLimitChange is a change of resource limit of plan.

type Resources

type Resources map[string]resource.Quantity

func (Resources) Equal

func (r Resources) Equal(o Resources) bool

func (Resources) MarshalJSON

func (r Resources) MarshalJSON() ([]byte, error)

func (Resources) MarshalYAML

func (r Resources) MarshalYAML() (interface{}, error)

func (*Resources) UnmarshalJSON

func (r *Resources) UnmarshalJSON(b []byte) error

func (*Resources) UnmarshalYAML

func (r *Resources) UnmarshalYAML(node *yaml.Node) error

type Summary

type Summary struct {
	// PlanId is the id of the Plan.
	PlanId string `json:"planId"`

	// Image is the container image of the Plan.
	//
	// This is exclusive with Name.
	Image *Image `json:"image,omitempty"`

	// Name is the name of the Plan.
	//
	// This is exclusive with Image, and used only for the system-builtin Plan with no image.
	Name string `json:"name,omitempty"`
}

func (Summary) Equal

func (s Summary) Equal(o Summary) bool

Jump to

Keyboard shortcuts

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