Version: v2.5.1+incompatible Latest Latest

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

Go to latest
Published: Oct 4, 2019 License: Apache-2.0 Imports: 7 Imported by: 0




This section is empty.


View Source
var ErrContainerHostAddrNotDefined = errors.New("container host address was not defined")

ErrContainerHostAddrNotDefined is returned when GetContainerHostAddress is not defined

View Source
var ErrNoContainerName = errors.New("container name was not defined")

ErrNoContainerName is returned when GetContainerName is not defined

View Source
var ErrNoServiceName = errors.New("service name was not defined")

ErrNoServiceName is returned when GetServiceName is not defined

View Source
var ErrNoSpecificHostDefined = errors.New("no host defined for container of service")

ErrNoSpecificHostDefined is returned when GetSpecificHost cannot find the host in the container

View Source
var ErrPortNotDefined = errors.New("port env not defined")

ErrPortNotDefined is returned when the port cannot be found


This section is empty.


type Config

type Config struct {
	Name     string
	Ships    map[string]Ships
	Services map[string]Service

A Config is our maestro config

func (*Config) ShipsForService

func (c *Config) ShipsForService(name string) []string

ShipsForService is a helper that gets the connections for a service inside a config

type EnvVal

type EnvVal interface{}

EnvVal is the value in the instance's shell env

type Instance

type Instance struct {
	Ports map[string]Port
	Ship  string

Instance running code

func ArbitraryInstance

func ArbitraryInstance(m map[string]Instance) Instance

ArbitraryInstance returns a (possibly random) instance in a map, or panics if the map is empty

type LoadError

type LoadError struct {
	// contains filtered or unexported fields

LoadError is returned when Load() fails, including extra information about the python error.

func (*LoadError) Error

func (l *LoadError) Error() string

type Loader

type Loader struct {
	ExecFunc       func(name string, stdin string, args ...string) (string, string, error)
	PythonLocation string

Loader can load a maestro config execing out to the python module and returning its json object.

func (*Loader) Load

func (l *Loader) Load(filename string) (*Config, error)

Load a maestro config, shelling out to python

type Maestro

type Maestro struct {
	// contains filtered or unexported fields

Maestro is the golang client for

func New

func New(osGetenv func(string) string) *Maestro

New creates a new maestro client, using the given function to get env variables. You usually want to call New(os.Getenv)

func (*Maestro) GetContainerHostAddress

func (m *Maestro) GetContainerHostAddress() (string, error)

GetContainerHostAddress returns the publicly-addressable IP address of the host of the container

func (*Maestro) GetContainerName

func (m *Maestro) GetContainerName() (string, error)

GetContainerName returns the name of the container calling it

func (*Maestro) GetEnvironmentName

func (m *Maestro) GetEnvironmentName() string

GetEnvironmentName returns the name of the environment the container calling this in a part of

func (*Maestro) GetNodeList

func (m *Maestro) GetNodeList(service string, ports []string) []string

GetNodeList builds a list of nodes for the given service from the environment, eventually adding the ports from the list of port names. The resulting entries will be of the form 'host[:port1[:port2]]' and sorted by container name.

func (*Maestro) GetPort

func (m *Maestro) GetPort(name string) (uint16, error)

GetPort returns the exposed (internal) port number for the given port

func (*Maestro) GetServiceName

func (m *Maestro) GetServiceName() (string, error)

GetServiceName returns the service name of the container calling it

func (*Maestro) GetSpecificExposedPort

func (m *Maestro) GetSpecificExposedPort(service string, container string, port string) (uint16, error)

GetSpecificExposedPort returns the exposed (internal) port number of a specific port of a specific container from a given service.

func (*Maestro) GetSpecificHost

func (m *Maestro) GetSpecificHost(service string, container string) (string, error)

GetSpecificHost returns the hostname/address of a specific container/instance of the given service

func (*Maestro) GetSpecificPort

func (m *Maestro) GetSpecificPort(service string, container string, port string) (uint16, error)

GetSpecificPort returns the external port number of a specific port of a specific container from a given service

type Port

type Port interface{}

Port is the port a service is running in. Can sometimes be port ranges...

type Service

type Service struct {
	Instances map[string]Instance
	Env       map[string]EnvVal

Service running in maestro

type Ships

type Ships struct {
	IP string

Ships are the location of an instance

Source Files

Jump to

Keyboard shortcuts

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