core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: BSD-3-Clause Imports: 10 Imported by: 25

Documentation

Index

Constants

View Source
const FRIENDLY_TIME_F = "2006-01-02 15:04"

Variables

View Source
var CAPSTANIGNORE_ALWAYS []string = []string{
	"/meta/*", "/mpm-pkg", "/.git", "/.capstanignore", "/.gitignore", "/volumes",
}

Functions

func IsTemplateFile

func IsTemplateFile(filename string) bool

IsTemplateFile returns true if filename points to a valid template file; otherwise returns false.

Types

type Capstanignore

type Capstanignore interface {
	LoadFile(path string) error
	AddPattern(pattern string) error
	PrintPatterns()
	IsIgnored(path string) bool
}

func CapstanignoreInit

func CapstanignoreInit(path string) (Capstanignore, error)

CapstanignoreInit creates a new Capstanignore struct that is used when deciding whether a file should be included in unikernel or not. You can provide `path` to the .capstanignore file to load it or pass empty string "" if you have none. Note that once having capstanignore struct you can load as many files as you want (using .LoadFile function) or manually add as many patterns as you like (using .AddPattern function).

type HashCache

type HashCache map[string]string

func NewHashCache

func NewHashCache() HashCache

func ParseHashCache

func ParseHashCache(cachePath string) (HashCache, error)

ParseHashCache looks for a file at given location and tries to parse the HashCache config. In case the file does not exist or is not a valid HashCache file, it fails with an error.

func (*HashCache) WriteToFile

func (h *HashCache) WriteToFile(path string) error

type Image

type Image struct {
	Name       string
	Hypervisor string
}

type Package

type Package struct {
	Name     string
	Title    string
	Author   string            `yaml:"author,omitempty"`
	Version  string            `yaml:"version,omitempty"`
	Require  []string          `yaml:"require,omitempty"`
	Binary   map[string]string `yaml:"binary,omitempty"`
	Created  YamlTime          `yaml:"created"`
	Platform string            `yaml:"platform,omitempty"`
}

func ParsePackageManifest

func ParsePackageManifest(manifestFile string) (Package, error)

func ParsePackageManifestAndFallbackToDefault

func ParsePackageManifestAndFallbackToDefault(manifestFile string) (Package, error)

func (*Package) Parse

func (p *Package) Parse(data []byte) error

func (*Package) String

func (p *Package) String() string

type RpmPackage

type RpmPackage struct {
	Name    string
	Version string
	Release string
	Arch    string
}

func (*RpmPackage) Download

func (p *RpmPackage) Download() error

func (*RpmPackage) Filename

func (p *RpmPackage) Filename() string

func (*RpmPackage) URL

func (p *RpmPackage) URL() string

type Template

type Template struct {
	Base    string
	RpmBase *RpmPackage "rpm-base"
	Cmdline string
	Build   string
	Files   map[string]string
	Rootfs  string
}

A template is a configuration file that describes how to build a VM image. It is usually representeed as a `Capstanfile` file on disk.

func ParseTemplate

func ParseTemplate(data []byte) (*Template, error)

ParseTemplate parses a Template from a byte array.

func ReadTemplateFile

func ReadTemplateFile(filename string) (*Template, error)

ReadTemplateFile parses a Template from a file.

type YamlTime

type YamlTime struct {
	Time interface{}
}

func (YamlTime) GetTime

func (t YamlTime) GetTime() *time.Time

func (YamlTime) MarshalYAML

func (t YamlTime) MarshalYAML() (interface{}, error)

MarshalYAML transforms YamlTime object into a RFC3339 string.

func (YamlTime) String

func (t YamlTime) String() string

func (*YamlTime) UnmarshalYAML

func (t *YamlTime) UnmarshalYAML(unmarshaller func(interface{}) error) error

UnmarshalYAML parses string into YamlTime object. Following formats are supported: RFC3339, FRIENDLY_TIME_F If time string is invalid, a special YamlTime is created that is then marked as '?' when printed as string.

Jump to

Keyboard shortcuts

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