dsdl

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

+build linux

Index

Constants

View Source
const DefaultPolling = 5 * time.Second

DefaultPolling for Run when RunConf.Polling is set to the zero time.Duration

Variables

This section is empty.

Functions

func AddTarget

func AddTarget(target Target) error

AddTarget loads the config from the default path, adds the new target, and saves the new config file

func Deploy

func Deploy(target Target) (types.Version, error)

Deploy deploys the target patterned matches files to the target provider service

func Download

func Download(service string) error

Download the assets deployed on service

func SaveConfig

func SaveConfig(conf Config) error

SaveConfig saves conf on the default path

Types

type Config

type Config struct {
	Targets map[string]*Target
}

Config is a set of targets

func LoadConfig

func LoadConfig() (Config, error)

LoadConfig loads the config from the default path

type RunConf

type RunConf struct {
	Args      []string
	HotReload bool
	OnSuccess RunReaction
	OnFailure RunReaction
	Polling   time.Duration
}

RunConf is the Runner's configuration

type RunEvent

type RunEvent struct {
	Type     RunEventType
	Version  types.Version
	ExitCode int
	Reason   string
}

RunEvent is an event generated by the Runner Version is only valid for AppStarted events ExitCode is only valid for Stopped events

func (RunEvent) String

func (e RunEvent) String() string

type RunEventType

type RunEventType int

RunEventType is the type of events generated by Runner

const (
	// AppStarted events are sent when the application process gets started
	AppStarted RunEventType = iota
	// AppExit events are sent when the application process ends without being interrupted/killed for hotreloading updates
	AppExit
	// Stopped events are sent when the runner ends its execution, this is controlled by the OnSuccess/OnFailure properties of RunConf
	Stopped
)

type RunReaction

type RunReaction int

RunReaction is the action to take when the deployed application exits

const (
	// Exit will stop the Runner's goroutine, returning "Stopped" to WaitForEvent()
	Exit RunReaction = iota
	// Wait will wait for future update (deploys), which will be started
	Wait
	// Restart will restart the application inmediatly
	Restart
)

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner manages the download, execution and updating process of a deployed application

func Run

func Run(service string, conf RunConf) (*Runner, error)

Run runs a deployed application on service with a configuration

func (*Runner) Stop

func (r *Runner) Stop()

Stop stops the current runner, interrupting/killing the application

func (*Runner) WaitForEvent

func (r *Runner) WaitForEvent() RunEvent

WaitForEvent waits for the generation of the next RunEvent

type Target

type Target struct {
	Name     string `json:"-"`
	Service  string
	Patterns []string
}

Target is a combination of an alias name to deploy, a provider service, and a list of glob patterns

func (Target) String

func (t Target) String() string

Jump to

Keyboard shortcuts

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