Help us shape the future of Go! Take the 2026 Go Developer Survey

state

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DockerIPLabel is the key of the Label which holds the Docker containerizer IP value.
	DockerIPLabel = "Docker.NetworkSettings.IPAddress"
	// MesosIPLabel is the key of the label which holds the Mesos containerizer IP value.
	MesosIPLabel = "MesosContainerizer.NetworkSettings.IPAddress"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContainerStatus

type ContainerStatus struct {
	NetworkInfos []NetworkInfo `json:"network_infos,omitempty"`
}

ContainerStatus holds container metadata as defined in the /state.json Mesos HTTP endpoint.

type DiscoveryInfo

type DiscoveryInfo struct {
	Visibilty   string `json:"visibility"`
	Version     string `json:"version,omitempty"`
	Name        string `json:"name,omitempty"`
	Location    string `json:"location,omitempty"`
	Environment string `json:"environment,omitempty"`
	Labels      struct {
		Labels []Label `json:"labels"`
	} `json:"labels"`
	Ports struct {
		DiscoveryPorts []DiscoveryPort `json:"ports"`
	} `json:"ports"`
}

DiscoveryInfo holds the discovery meta data for a task defined in the /state.json Mesos HTTP endpoint.

type DiscoveryPort

type DiscoveryPort struct {
	Protocol string `json:"protocol"`
	Number   int    `json:"number"`
	Name     string `json:"name"`
}

DiscoveryPort holds a port for a task defined in the /state.json Mesos HTTP endpoint.

type Framework

type Framework struct {
	Tasks    []Task `json:"tasks"`
	PID      PID    `json:"pid"`
	Name     string `json:"name"`
	Hostname string `json:"hostname"`
}

Framework holds a framework as defined in the /state.json Mesos HTTP endpoint.

func (Framework) HostPort

func (f Framework) HostPort() (string, string)

HostPort returns the hostname and port where a framework's scheduler is listening on.

type IPAddress added in v0.3.1

type IPAddress struct {
	IPAddress string `json:"ip_address,omitempty"`
}

IPAddress holds a single IP address configured on an interface, as defined in the /state.json Mesos HTTP endpoint.

type Label

type Label struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

Label holds a label as defined in the /state.json Mesos HTTP endpoint.

type NetworkInfo

type NetworkInfo struct {
	IPAddresses []IPAddress `json:"ip_addresses,omitempty"`
	// back-compat with 0.25 IPAddress format
	IPAddress string `json:"ip_address,omitempty"`
}

NetworkInfo holds the network configuration for a single interface as defined in the /state.json Mesos HTTP endpoint.

type PID

type PID struct{ *upid.UPID }

PID holds a Mesos PID and implements the json.Unmarshaler interface.

func (*PID) UnmarshalJSON

func (p *PID) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface for PIDs.

type Resources

type Resources struct {
	PortRanges string `json:"ports"`
}

Resources holds resources as defined in the /state.json Mesos HTTP endpoint.

func (Resources) Ports

func (r Resources) Ports() []string

Ports returns a slice of individual ports expanded from PortRanges.

type Slave

type Slave struct {
	ID       string `json:"id"`
	Hostname string `json:"hostname"`
	PID      PID    `json:"pid"`
}

Slave holds a slave as defined in the /state.json Mesos HTTP endpoint.

type State

type State struct {
	Frameworks []Framework `json:"frameworks"`
	Slaves     []Slave     `json:"slaves"`
	Leader     string      `json:"leader"`
}

State holds the state defined in the /state.json Mesos HTTP endpoint.

type Status

type Status struct {
	Timestamp       float64         `json:"timestamp"`
	State           string          `json:"state"`
	Labels          []Label         `json:"labels,omitempty"`
	ContainerStatus ContainerStatus `json:"container_status,omitempty"`
}

Status holds a task status as defined in the /state.json Mesos HTTP endpoint.

type Task

type Task struct {
	FrameworkID   string   `json:"framework_id"`
	ID            string   `json:"id"`
	Name          string   `json:"name"`
	SlaveID       string   `json:"slave_id"`
	State         string   `json:"state"`
	Statuses      []Status `json:"statuses"`
	Labels        []Label  `json:"labels"`
	Resources     `json:"resources"`
	DiscoveryInfo DiscoveryInfo `json:"discovery"`

	SlaveIP string `json:"-"`
}

Task holds a task as defined in the /state.json Mesos HTTP endpoint.

func (*Task) HasDiscoveryInfo

func (t *Task) HasDiscoveryInfo() bool

HasDiscoveryInfo return whether the DiscoveryInfo was provided in the state.json

func (*Task) IP

func (t *Task) IP(srcs ...string) string

IP returns the first Task IP found in the given sources.

func (*Task) IPs

func (t *Task) IPs(srcs ...string) (ips []net.IP)

IPs returns a slice of IPs sourced from the given sources with ascending priority.

func (*Task) Label

func (t *Task) Label(name string) string

Label returns the label.Value of the key matching the passed in string

Jump to

Keyboard shortcuts

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