engine

package
v0.0.0-...-bd4c8a3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	GitGetterType           = "git"
	GithubReleaseGetterType = "github-release"
	GoGetGetterType         = "go-get"

	GoBuildRunnerType = "go-build"
	Python2RunnerType = "python2"
	Python3RunnerType = "python3"
	PythonRunnerType  = "python"
	ShellRunnerType   = "shell"
)
View Source
const (
	DefaultToolUpdateFrequency = tool.UpdateWeekly

	DefaultToolGetterType = GitGetterType
	DefaultToolRunnerType = ShellRunnerType
)

Variables

This section is empty.

Functions

func New

func New() (stoic.Stoic, error)

func NewWithOptions

func NewWithOptions(o EngineOptions) (stoic.Stoic, error)

func RegisterGetter

func RegisterGetter(name string, ctor GetterCtor)

func RegisterRunner

func RegisterRunner(name string, ctor RunnerCtor)

Types

type EngineOptions

type EngineOptions struct {
	Root            string
	UpdateFrequency tool.UpdateFrequency
}

type GetterCtor

type GetterCtor func(stoic.Stoic, stoic.Tool) (tool.Getter, error)

type RunnerCtor

type RunnerCtor func(stoic.Stoic, stoic.Tool) (tool.Runner, error)

type State

type State interface {
	// ToolId identifies the tool the instance pertains too.
	ToolId() string

	// Filename returns the filesystem path where the state is persisted.
	Filename() string

	// UpstreamVersion returns the latest upstream version of the tool that is
	// available locally, for the specified channel.
	UpstreamVersion(tc tool.Channel) tool.Version

	// LastUpstreamUpdate returns the time at which the upstream version for the
	// specified channel was last updated.
	LastUpstreamUpdate(tc tool.Channel) time.Time

	// CurrentCheckout returns the most recent checkout marked as current.
	CurrentCheckout() tool.Checkout

	// CheckoutForVersion returns the most recent checkout for the requested
	// version.
	CheckoutForVersion(version tool.Version) tool.Checkout
}

State represents metadata persisted by the engine for a given tool.

type ToolChannelInfoFormat

type ToolChannelInfoFormat struct {
	Version    tool.Version  `json:"version,omitempty"`
	LastUpdate UnixTimestamp `json:"last-update,omitempty"`
}

ToolChannelInfoFormat defines the low-level format for persisting information about an upstream source.

type ToolCheckoutFormat

type ToolCheckoutFormat struct {
	CheckoutVersion tool.Version  `json:"version"`
	CheckoutPath    string        `json:"path"`
	Created         UnixTimestamp `json:"created"`
	SetCurrent      UnixTimestamp `json:"set-current,omitempty"`
}

ToolCheckoutFormat defines the low-level format for persisting information about a tool.Checkout.

func (ToolCheckoutFormat) Path

func (tcf ToolCheckoutFormat) Path() string

func (ToolCheckoutFormat) Version

func (tcf ToolCheckoutFormat) Version() tool.Version

type ToolStateFormat

type ToolStateFormat struct {
	Upstream  *ToolChannelInfoFormat                 `json:"upstream,omitempty"`
	Channels  map[tool.Channel]ToolChannelInfoFormat `json:"channels,omitempty"`
	Checkouts []ToolCheckoutFormat                   `json:"checkouts,omitempty"`
}

ToolStateFormat defines the low-level format for persisting State.

func (*ToolStateFormat) CheckoutForVersion

func (tsf *ToolStateFormat) CheckoutForVersion(version tool.Version) tool.Checkout

func (*ToolStateFormat) CurrentCheckout

func (tsf *ToolStateFormat) CurrentCheckout() tool.Checkout

func (*ToolStateFormat) LastUpstreamUpdate

func (tsf *ToolStateFormat) LastUpstreamUpdate(tc tool.Channel) time.Time

func (*ToolStateFormat) UpstreamVersion

func (tsf *ToolStateFormat) UpstreamVersion(tc tool.Channel) tool.Version

type UnixTimestamp

type UnixTimestamp int64

Jump to

Keyboard shortcuts

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