host

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2016 License: Apache-2.0 Imports: 18 Imported by: 10

Documentation

Overview

Package host contains the core implementation for a Lever OS host. A Lever OS host is the main process in a Lever deployment. It manages traffic through the Lever network and manages Lever instances.

Index

Constants

View Source
const PackageName = "host"

PackageName is the name of this package.

Variables

View Source
var (
	// InstanceConstructTimeoutFlag is the deadline for an instance to spin up.
	InstanceConstructTimeoutFlag = config.DeclareDuration(
		PackageName, "instanceConstructTimeout", 15*time.Second)
	// ResourceConstructTimeoutFlag is the deadline for a resource to get
	// allocated (the time necessary might include spinning up an instance).
	ResourceConstructTimeoutFlag = config.DeclareDuration(
		PackageName, "resourceConstructTimeout", 20*time.Second)
)
View Source
var (
	// ConnectionExpiryFlag is the inactivity time after which client
	// connections are closed.
	ConnectionExpiryFlag = config.DeclareDuration(
		PackageName, "connectionExpiry", 5*time.Minute)
	// ConnectionConnectTimeoutFlag is the timeout for client connections to
	// establish.
	ConnectionConnectTimeoutFlag = config.DeclareDuration(
		PackageName, "connectionConnectTimeout", 20*time.Second)

	// DisableProxyExtFlag enables listening to the external interface
	// (regional LB).
	DisableProxyExtFlag = config.DeclareBool(
		PackageName, "disableProxyExt")
	// DisableProxyInOutFlag enables listening to requests going to or coming
	// from a local environment.
	DisableProxyInOutFlag = config.DeclareBool(
		PackageName, "disableProxyInOut")

	// EnvOutListenPortFlag is the environment listen port for outward
	// connections. This port is accessible only from within the env network.
	EnvOutListenPortFlag = config.DeclareString(
		PackageName, "envOutListenPort", "3838")
	// EnvInListenPortFlag is the listen port for inward connections.
	EnvInListenPortFlag = config.DeclareString(
		PackageName, "envInListenPort", "3500")
	// EnvExtListenPortFlag is the listen port for external connections.
	EnvExtListenPortFlag = config.DeclareString(
		PackageName, "envExtListenPort", "3502")
)

Functions

func GetHostAddrOnNode

func GetHostAddrOnNode(node string) (string, error)

GetHostAddrOnNode returns the address of the Lever host running on given node.

func RegisterThisHost

func RegisterThisHost(
	hostAddr string) (
	serviceSka *scale.SelfKeepAlive, sessionSka *scale.SelfKeepAlive,
	err error)

RegisterThisHost registers the current swarm node against the current service.

Types

type Finder

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

Finder is a structure that is able to allocate Lever containers across the Lever fleet.

func NewFinder

func NewFinder(docker *dockerapi.Client, as *aerospike.Client) *Finder

NewFinder returns a new Finder instance.

func (*Finder) GetHost

func (finder *Finder) GetHost(env, service, resource string, fromExt bool) (
	hostInfo *LeverHostInfo, err error)

GetHost returns the address of an allocated Lever service of the type specified.

type LevInstTarget

type LevInstTarget struct {
	HostAddr    string `json:"ha,omitempty"`
	InstanceID  string `json:"iid,omitempty"`
	ContainerID string `json:"cid,omitempty"`
}

LevInstTarget is the information associated that is stored with the LevInst resource. Note: Only the first instance within a service gets a LevInstResourceID and

is registered as an internal resource.

type LevResTarget

type LevResTarget struct {
	HostAddr         string `json:"ha,omitempty"`
	InstanceID       string `json:"iid,omitempty"`
	ContainerID      string `json:"cid,omitempty"`
	LevInstSessionID string `json:"lisid,omitempty"`
}

LevResTarget is the information associated that is stored with the LevRes resource.

type LeverHostInfo

type LeverHostInfo struct {
	HostAddr string
	// May be "" if instance was found via DNS.
	InstanceID string
	// May be "" if instance was found via DNS.
	ContainerID   string
	ServingID     string
	CodeVersion   int64
	IsNewInstance bool
	// May be "" if it's non-first instance.
	LevInstResourceID string
	// May be "" if it's non-first instance.
	LevInstSessionID string
	// May be "" if no resource was specified.
	LevResResourceID string
	// May be "" if no resource was specified.
	LevResSessionID string
}

LeverHostInfo is the information returned by a call to GetHost.

type LeverProxy

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

LeverProxy is a proxy server that mediates Lever RPCs from the outside world to Lever containers and RPCs between Lever containers. The In / Out terminology is relative to the Lever containers (not to the proxy).

func NewLeverProxy

func NewLeverProxy(
	manager *hostman.Manager, finder *Finder, ownIPv4 string,
	grpcPool *scale.GRPCPool) (
	*LeverProxy, error)

NewLeverProxy creates a new instance of LeverProxy.

Jump to

Keyboard shortcuts

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