engine

package
v0.0.0-...-53e3d08 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyName       = "name"
	KeyStatus     = "status"
	KeyCreateTime = "create_time"
	KeyStartTime  = "start_time"
	KeyFinishTime = "finish_time"

	// Created    = "created"    // 已创建
	Running = "running" // 运行中
	// Paused     = "paused"     // 已暂停
	Restarting = "restarting" // 重启中
	// Removing   = "removing"   // 退出中
	// Exited     = "exited"     // 已退出
	Dead = "dead" // 未启动(默认值)

)

all status

Variables

This section is empty.

Functions

func Factories

func Factories() map[string]Factory

Factories of engines

func GenerateInstanceEnv

func GenerateInstanceEnv(name string, static []string, dynamic map[string]string) []string

GenerateInstanceEnv generates new env of the instance

func Supervising

func Supervising(instance Instance) error

Supervising supervise an instance

Types

type Engine

type Engine interface {
	io.Closer
	Name() string
	Recover()
	Prepare([]openedge.ServiceInfo)
	SetInstanceStats(serviceName, instanceName string, partialStats PartialStats, persist bool)
	DelInstanceStats(serviceName, instanceName string, persist bool)
	DelServiceStats(serviceName string, persist bool)
	Run(openedge.ServiceInfo, map[string]openedge.VolumeInfo) (Service, error)
}

Engine interface

func New

func New(name string, grace time.Duration, pwd string, is InfoStats) (Engine, error)

New engine by given name

type Factory

type Factory func(grace time.Duration, pwd string, is InfoStats) (Engine, error)

Factory create engine by given config

type InfoStats

type InfoStats interface {
	LoadStats(sss interface{}) bool
	SetInstanceStats(serviceName, instanceName string, partialStats PartialStats, persist bool)
	DelInstanceStats(serviceName, instanceName string, persist bool)
	DelServiceStats(serviceName string, persist bool)
}

InfoStats interfaces of the storage of info and stats

type Instance

type Instance interface {
	Service() Service
	Name() string
	Info() PartialStats
	Stats() PartialStats
	Wait(w chan<- error)
	Dying() <-chan struct{}
	Restart() error
	Stop()
	io.Closer
}

Instance interfaces of instance

type InstancesStats

type InstancesStats map[string]PartialStats

InstancesStats stats of all instances of the service

type PartialStats

type PartialStats map[string]interface{}

PartialStats partial stats of the instance

func NewPartialStatsByStatus

func NewPartialStatsByStatus(status string) PartialStats

NewPartialStatsByStatus creates a new stats by status

type Service

type Service interface {
	Name() string
	Engine() Engine
	RestartPolicy() openedge.RestartPolicyInfo
	Start() error
	Stop()
	Stats()
	StartInstance(instanceName string, dynamicConfig map[string]string) error
	StopInstance(instanceName string) error
}

Service interfaces of service

type ServicesStats

type ServicesStats map[string]InstancesStats

ServicesStats stats of all services

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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