runtime

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 9 Imported by: 26

README

Runtime

A runtime for self governing services.

Overview

In recent years we've started to develop complex architectures for the pipeline between writing code and running it. This philosophy of build, run, manage or however many variations, has created a number of layers of abstraction that make it all the more difficult to run code.

Runtime manages the lifecycle of a service from source to running process. If the source is the source of truth then everything in between running is wasted breath. Applications should be self governing and self sustaining. To enable that we need libraries which make it possible.

Runtime will fetch source code, build a binary and execute it. Any Go program that uses this library should be able to run dependencies or itself with ease, with the ability to update itself as the source is updated.

Features

  • Source - Fetches source whether it be git, go, docker, etc
  • Package - Compiles the source into a binary which can be executed
  • Process - Executes a binary and creates a running process

Usage

TODO

Documentation

Overview

Package runtime is a service runtime manager

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultRuntime = newRuntime()
)

Functions

func Create

func Create(s *Service, opts ...CreateOption) error

func Delete

func Delete(s *Service) error

func Start

func Start() error

func Stop

func Stop() error

Types

type CreateOption

type CreateOption func(o *CreateOptions)

func WithCommand

func WithCommand(c string, args ...string) CreateOption

WithCommand specifies the command to execute

func WithEnv

func WithEnv(env []string) CreateOption

WithEnv sets the created service env

func WithOutput

func WithOutput(out io.Writer) CreateOption

WithOutput sets the arg output

type CreateOptions

type CreateOptions struct {
	// command to execute including args
	Command []string
	// Environment to configure
	Env []string
	// Log output
	Output io.Writer
}

type Runtime

type Runtime interface {
	// Registers a service
	Create(*Service, ...CreateOption) error
	// Remove a service
	Delete(*Service) error
	// starts the runtime
	Start() error
	// Shutdown the runtime
	Stop() error
}

Runtime is a service runtime manager

type Service

type Service struct {
	// name of the service
	Name string
	// url location of source
	Source string
	// path to store source
	Path string
	// exec command
	Exec string
}

Directories

Path Synopsis
Package packager creates a binary image.
Package packager creates a binary image.
docker
Package docker builds docker images
Package docker builds docker images
go
Package golang is a go package manager
Package golang is a go package manager
Package process executes a binary
Package process executes a binary
os
Package os runs processes locally
Package os runs processes locally
Package source retrieves source code
Package source retrieves source code
git
Package git provides a git source
Package git provides a git source
go
Package golang is a source for Go
Package golang is a source for Go

Jump to

Keyboard shortcuts

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