connector

package
v0.0.0-...-7b2e207 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: AGPL-3.0 Imports: 26 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DockerEndpoint = "unix:///var/run/docker.sock"

DockerEndpoint is the endpoint to docker API

Functions

This section is empty.

Types

type Connector

type Connector struct {
	Platform *platform.Platform
	// contains filtered or unexported fields
}

Connector defines a structure for starting and managing a cocoon (ccode)

func NewConnector

func NewConnector(platform *platform.Platform, spec *types.Spec, waitCh chan bool) *Connector

NewConnector creates a new connector

func (*Connector) AddLanguage

func (cn *Connector) AddLanguage(lang languages.Language) error

AddLanguage adds a new langauge to the launcher. Will return error if language is already added

func (*Connector) ExecInContainer

func (cn *Connector) ExecInContainer(id string, commands []*modo.Do, privileged bool, outputCB modo.OutputFunc, stateCB func(modo.State, *modo.Do)) ([]error, error)

ExecInContainer executes one of more commands in a command in series. Returns a any error for each command in their respective index location.

func (*Connector) GetCocoonCodeRPCAddr

func (cn *Connector) GetCocoonCodeRPCAddr() string

GetCocoonCodeRPCAddr returns the RPC address of the cocoon code

func (*Connector) GetLanguage

func (cn *Connector) GetLanguage(name string) languages.Language

GetLanguage will return a langauges or nil if not found

func (*Connector) GetLanguages

func (cn *Connector) GetLanguages() []languages.Language

GetLanguages returns all languages added to the launcher

func (*Connector) GetOrdererDiscoverer

func (cn *Connector) GetOrdererDiscoverer() *orderer.Discovery

GetOrdererDiscoverer returns the orderer discovery instance

func (*Connector) GetSpec

func (cn *Connector) GetSpec() *types.Spec

GetSpec returns the current cocoon launch spec

func (*Connector) HookToMonitor

func (cn *Connector) HookToMonitor()

HookToMonitor is where all listeners to the monitor are attached.

func (*Connector) Launch

func (cn *Connector) Launch(connectorRPCAddr, cocoonCodeRPCAddr string)

Launch starts a cocoon code

func (*Connector) RestartIfDiskAllocExceeded

func (cn *Connector) RestartIfDiskAllocExceeded(curDiskSize int64) bool

RestartIfDiskAllocExceeded restarts the cocoon code is disk usages has exceeded its set limit.

func (*Connector) SetAddrs

func (cn *Connector) SetAddrs(connectorRPCAddr, cocoonCodeRPCAddr string)

SetAddrs sets the address of the connector and cocoon code RPC servers

func (*Connector) SetRouterHelper

func (cn *Connector) SetRouterHelper(rh *router.Helper)

SetRouterHelper sets the router helpder

func (*Connector) Stop

func (cn *Connector) Stop(failed bool) error

Stop stops all sub routines and releases resources.

type HealthChecker

type HealthChecker struct {
	OnDeadFunc func()
	// contains filtered or unexported fields
}

HealthChecker checks the health status of the cocoon code. It repeatedly calls the cocoon coder health check method. If cocoon code refuses to respond, it calls the OnDeadFunc method attached to it

func NewHealthChecker

func NewHealthChecker(cocoonCodeAddr string, onDeadFunc func()) *HealthChecker

NewHealthChecker creates a cocoon code health checker instance

func (*HealthChecker) Start

func (hc *HealthChecker) Start()

Start runs the health check immediately and on future intervals. if check returns err, it calls the OnDeadFunc and stops the health check.

func (*HealthChecker) Stop

func (hc *HealthChecker) Stop()

Stop health check

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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