server

package
v2.90.1-0...-9a7c53c Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2015 License: Apache-2.0 Imports: 12 Imported by: 35

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDockerHostIp

func GetDockerHostIp() (string, error)

func InsideDocker

func InsideDocker() bool

InsideDocker returns true if the process is run in a docker container.

func LocalIP

func LocalIP() (string, error)

LocalIP returns the externally visible address of localhost

func LocalIPMust

func LocalIPMust() string

func MarkRunning

func MarkRunning(name string)

MarkRunning marks the current process, identified by name `name`, as "running" for kato-status.

func NewNatsClient

func NewNatsClient(retries int) *nats.EncodedConn

NewNatsClient connects to the NATS server of the Stackato cluster

func NewRedisClient

func NewRedisClient(addr, password string, database int64) (*redis.Client, error)

NewRedisClient connects to redis after ensuring that the server is indeed running.

func NewRedisClientMust

func NewRedisClientMust(addr, password string, database int64) *redis.Client

func NewRedisClientRetry

func NewRedisClientRetry(addr, password string, database, retries int64) (*redis.Client, error)

func NodeIP

func NodeIP() (string, error)

NodeIP returns the externally visible address of the docker host. If the current process is not running in a docker container, returns LocalIP()

func NodeIPMust

func NodeIPMust() string

Types

type ClusterConfig

type ClusterConfig struct {
	MbusIp   string `json:"mbusip"`
	Endpoint string `json:"endpoint"`
}

func GetClusterConfig

func GetClusterConfig() *ClusterConfig

func (ClusterConfig) CurrentNodeId

func (c ClusterConfig) CurrentNodeId() (string, error)

func (*ClusterConfig) GetMbusIP

func (c *ClusterConfig) GetMbusIP() string

GetMbusIP returns a docker-friendly value for MbusIP

func (*ClusterConfig) IsMicro

func (c *ClusterConfig) IsMicro() bool

IsMicro returns true if the cluster is configured as a micro cloud.

type Config

type Config struct {
	*confdis.ConfDis
	// contains filtered or unexported fields
}

Config refers to Stackato configuration under a specific group, such as "dea" or "cluster".

func NewConfig

func NewConfig(group string, s interface{}) (*Config, error)

func (*Config) GetChangesChannel

func (g *Config) GetChangesChannel() chan error

GetChangesChannel returns a channel of (always) nil values that updates upon config changes.

type NodeConfig

type NodeConfig map[string]NodeInfo

NodeConfig corresponds to Kato's /node config, which is a hash of ipaddr => NodeInfo

func GetNodeConfig

func GetNodeConfig() *NodeConfig

type NodeInfo

type NodeInfo struct {
	Roles map[string]string `json:"roles"` // role name -> role status
}

type RunningConfig

type RunningConfig map[string]runningInfo

RunningConfig corresponds to Kato's /running config, which is a hash of ipaddr => runningInfo

func GetRunningConfig

func GetRunningConfig() *RunningConfig

Jump to

Keyboard shortcuts

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